| 1 |
;; AltiVec patterns. |
| 2 |
;; Copyright (C) 2002-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Aldy Hernandez ([email protected]) |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 7 |
;; GCC is free software; you can redistribute it and/or modify it |
| 8 |
;; under the terms of the GNU General Public License as published |
| 9 |
;; by the Free Software Foundation; either version 3, or (at your |
| 10 |
;; option) any later version. |
| 11 |
|
| 12 |
;; GCC is distributed in the hope that it will be useful, but WITHOUT |
| 13 |
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 |
;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 15 |
;; License for more details. |
| 16 |
|
| 17 |
;; You should have received a copy of the GNU General Public License |
| 18 |
;; along with GCC; see the file COPYING3. If not see |
| 19 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
(define_c_enum "unspec" |
| 22 |
[UNSPEC_VCMPBFP |
| 23 |
UNSPEC_VMSUMU |
| 24 |
UNSPEC_VMSUMUDM |
| 25 |
UNSPEC_VMSUMM |
| 26 |
UNSPEC_VMSUMSHM |
| 27 |
UNSPEC_VMSUMUHS |
| 28 |
UNSPEC_VMSUMSHS |
| 29 |
UNSPEC_VMHADDSHS |
| 30 |
UNSPEC_VMHRADDSHS |
| 31 |
UNSPEC_VADDCUW |
| 32 |
UNSPEC_VAVGU |
| 33 |
UNSPEC_VAVGS |
| 34 |
UNSPEC_VMULEUB |
| 35 |
UNSPEC_VMULESB |
| 36 |
UNSPEC_VMULEUH |
| 37 |
UNSPEC_VMULESH |
| 38 |
UNSPEC_VMULEUW |
| 39 |
UNSPEC_VMULESW |
| 40 |
UNSPEC_VMULEUD |
| 41 |
UNSPEC_VMULESD |
| 42 |
UNSPEC_VMULOUB |
| 43 |
UNSPEC_VMULOSB |
| 44 |
UNSPEC_VMULOUH |
| 45 |
UNSPEC_VMULOSH |
| 46 |
UNSPEC_VMULOUW |
| 47 |
UNSPEC_VMULOSW |
| 48 |
UNSPEC_VMULOUD |
| 49 |
UNSPEC_VMULOSD |
| 50 |
UNSPEC_VPKPX |
| 51 |
UNSPEC_VPACK_SIGN_SIGN_SAT |
| 52 |
UNSPEC_VPACK_SIGN_UNS_SAT |
| 53 |
UNSPEC_VPACK_UNS_UNS_SAT |
| 54 |
UNSPEC_VPACK_UNS_UNS_MOD |
| 55 |
UNSPEC_VPACK_UNS_UNS_MOD_DIRECT |
| 56 |
UNSPEC_VREVEV |
| 57 |
UNSPEC_VSLV4SI |
| 58 |
UNSPEC_VSLO |
| 59 |
UNSPEC_VSR |
| 60 |
UNSPEC_VSRO |
| 61 |
UNSPEC_VSUBCUW |
| 62 |
UNSPEC_VSUM4UBS |
| 63 |
UNSPEC_VSUM4S |
| 64 |
UNSPEC_VSUM2SWS |
| 65 |
UNSPEC_VSUMSWS |
| 66 |
UNSPEC_VPERM |
| 67 |
UNSPEC_VPERMR |
| 68 |
UNSPEC_VPERM_UNS |
| 69 |
UNSPEC_VRFIN |
| 70 |
UNSPEC_VCFUX |
| 71 |
UNSPEC_VCFSX |
| 72 |
UNSPEC_VCTUXS |
| 73 |
UNSPEC_VCTSXS |
| 74 |
UNSPEC_VLOGEFP |
| 75 |
UNSPEC_VEXPTEFP |
| 76 |
UNSPEC_VSLDOI |
| 77 |
UNSPEC_VUNPACK_HI_SIGN |
| 78 |
UNSPEC_VUNPACK_LO_SIGN |
| 79 |
UNSPEC_VUNPACK_HI_SIGN_DIRECT |
| 80 |
UNSPEC_VUNPACK_LO_SIGN_DIRECT |
| 81 |
UNSPEC_VUPKHPX |
| 82 |
UNSPEC_VUPKLPX |
| 83 |
UNSPEC_CONVERT_4F32_8I16 |
| 84 |
UNSPEC_CONVERT_4F32_8F16 |
| 85 |
UNSPEC_DST |
| 86 |
UNSPEC_DSTT |
| 87 |
UNSPEC_DSTST |
| 88 |
UNSPEC_DSTSTT |
| 89 |
UNSPEC_LVSL |
| 90 |
UNSPEC_LVSR |
| 91 |
UNSPEC_LVE |
| 92 |
UNSPEC_STVX |
| 93 |
UNSPEC_STVXL |
| 94 |
UNSPEC_STVE |
| 95 |
UNSPEC_SET_VSCR |
| 96 |
UNSPEC_GET_VRSAVE |
| 97 |
UNSPEC_LVX |
| 98 |
UNSPEC_REDUC_PLUS |
| 99 |
UNSPEC_VECSH |
| 100 |
UNSPEC_EXTEVEN_V4SI |
| 101 |
UNSPEC_EXTEVEN_V8HI |
| 102 |
UNSPEC_EXTEVEN_V16QI |
| 103 |
UNSPEC_EXTEVEN_V4SF |
| 104 |
UNSPEC_EXTODD_V4SI |
| 105 |
UNSPEC_EXTODD_V8HI |
| 106 |
UNSPEC_EXTODD_V16QI |
| 107 |
UNSPEC_EXTODD_V4SF |
| 108 |
UNSPEC_INTERHI_V4SI |
| 109 |
UNSPEC_INTERHI_V8HI |
| 110 |
UNSPEC_INTERHI_V16QI |
| 111 |
UNSPEC_INTERLO_V4SI |
| 112 |
UNSPEC_INTERLO_V8HI |
| 113 |
UNSPEC_INTERLO_V16QI |
| 114 |
UNSPEC_LVLX |
| 115 |
UNSPEC_LVLXL |
| 116 |
UNSPEC_LVRX |
| 117 |
UNSPEC_LVRXL |
| 118 |
UNSPEC_STVLX |
| 119 |
UNSPEC_STVLXL |
| 120 |
UNSPEC_STVRX |
| 121 |
UNSPEC_STVRXL |
| 122 |
UNSPEC_VSLV |
| 123 |
UNSPEC_VSRV |
| 124 |
UNSPEC_VMULWHUB |
| 125 |
UNSPEC_VMULWLUB |
| 126 |
UNSPEC_VMULWHSB |
| 127 |
UNSPEC_VMULWLSB |
| 128 |
UNSPEC_VMULWHUH |
| 129 |
UNSPEC_VMULWLUH |
| 130 |
UNSPEC_VMULWHSH |
| 131 |
UNSPEC_VMULWLSH |
| 132 |
UNSPEC_VUPKHU |
| 133 |
UNSPEC_VUPKLU |
| 134 |
UNSPEC_VPERMSI |
| 135 |
UNSPEC_VPERMHI |
| 136 |
UNSPEC_INTERHI |
| 137 |
UNSPEC_INTERLO |
| 138 |
UNSPEC_VUPKHS_V4SF |
| 139 |
UNSPEC_VUPKLS_V4SF |
| 140 |
UNSPEC_VUPKHU_V4SF |
| 141 |
UNSPEC_VUPKLU_V4SF |
| 142 |
UNSPEC_VGBBD |
| 143 |
UNSPEC_VSPLT_DIRECT |
| 144 |
UNSPEC_VMRGEW_DIRECT |
| 145 |
UNSPEC_VMRGOW_DIRECT |
| 146 |
UNSPEC_VSUMSWS_DIRECT |
| 147 |
UNSPEC_VADDCUQ |
| 148 |
UNSPEC_VADDEUQM |
| 149 |
UNSPEC_VADDECUQ |
| 150 |
UNSPEC_VSUBCUQ |
| 151 |
UNSPEC_VSUBEUQM |
| 152 |
UNSPEC_VSUBECUQ |
| 153 |
UNSPEC_VBPERMQ |
| 154 |
UNSPEC_VBPERMD |
| 155 |
UNSPEC_BCDADD |
| 156 |
UNSPEC_BCDSUB |
| 157 |
UNSPEC_BCD_OVERFLOW |
| 158 |
UNSPEC_BCDSHIFT |
| 159 |
UNSPEC_VRLMI |
| 160 |
UNSPEC_VRLNM |
| 161 |
UNSPEC_VCFUGED |
| 162 |
UNSPEC_VCLZDM |
| 163 |
UNSPEC_VCTZDM |
| 164 |
UNSPEC_VGNB |
| 165 |
UNSPEC_VPDEPD |
| 166 |
UNSPEC_VPEXTD |
| 167 |
UNSPEC_VCLRLB |
| 168 |
UNSPEC_VCLRRB |
| 169 |
UNSPEC_VSTRIR |
| 170 |
UNSPEC_VSTRIL |
| 171 |
UNSPEC_SLDB |
| 172 |
UNSPEC_SRDB |
| 173 |
UNSPEC_VECTOR_SHIFT |
| 174 |
]) |
| 175 |
|
| 176 |
(define_c_enum "unspecv" |
| 177 |
[UNSPECV_SET_VRSAVE |
| 178 |
UNSPECV_MTVSCR |
| 179 |
UNSPECV_MFVSCR |
| 180 |
UNSPECV_DSSALL |
| 181 |
UNSPECV_DSS |
| 182 |
]) |
| 183 |
|
| 184 |
;; Short vec int modes |
| 185 |
(define_mode_iterator VIshort [V8HI V16QI]) |
| 186 |
;; Vec float modes |
| 187 |
(define_mode_iterator VF [V4SF]) |
| 188 |
;; Vec modes, pity mode iterators are not composable |
| 189 |
(define_mode_iterator V [V4SI V8HI V16QI V4SF]) |
| 190 |
;; Vec modes for move/logical/permute ops, include vector types for move not |
| 191 |
;; otherwise handled by altivec (v2df, v2di, ti) |
| 192 |
(define_mode_iterator VM [V4SI |
| 193 |
V8HI |
| 194 |
V16QI |
| 195 |
V4SF |
| 196 |
V2DF |
| 197 |
V2DI |
| 198 |
V1TI |
| 199 |
TI |
| 200 |
(KF "FLOAT128_VECTOR_P (KFmode)") |
| 201 |
(TF "FLOAT128_VECTOR_P (TFmode)")]) |
| 202 |
|
| 203 |
;; Like VM, except don't do TImode |
| 204 |
(define_mode_iterator VM2 [V4SI |
| 205 |
V8HI |
| 206 |
V16QI |
| 207 |
V4SF |
| 208 |
V2DF |
| 209 |
V2DI |
| 210 |
V1TI |
| 211 |
(KF "FLOAT128_VECTOR_P (KFmode)") |
| 212 |
(TF "FLOAT128_VECTOR_P (TFmode)")]) |
| 213 |
|
| 214 |
;; Map the Vector convert single precision to double precision for integer |
| 215 |
;; versus floating point |
| 216 |
(define_mode_attr VS_sxwsp [(V4SI "sxw") (V4SF "sp")]) |
| 217 |
|
| 218 |
;; Specific iterator for parity which does not have a byte/half-word form, but |
| 219 |
;; does have a quad word form |
| 220 |
(define_mode_iterator VParity [V4SI |
| 221 |
V2DI |
| 222 |
V1TI |
| 223 |
TI]) |
| 224 |
|
| 225 |
(define_mode_attr VI_char [(V2DI "d") (V4SI "w") (V8HI "h") (V16QI "b")]) |
| 226 |
(define_mode_attr VI_scalar [(V2DI "DI") (V4SI "SI") (V8HI "HI") (V16QI "QI")]) |
| 227 |
(define_mode_attr VI_unit [(V16QI "VECTOR_UNIT_ALTIVEC_P (V16QImode)") |
| 228 |
(V8HI "VECTOR_UNIT_ALTIVEC_P (V8HImode)") |
| 229 |
(V4SI "VECTOR_UNIT_ALTIVEC_P (V4SImode)") |
| 230 |
(V2DI "VECTOR_UNIT_P8_VECTOR_P (V2DImode)")]) |
| 231 |
|
| 232 |
;; Vector pack/unpack |
| 233 |
(define_mode_iterator VP [V2DI V4SI V8HI]) |
| 234 |
(define_mode_attr VP_small [(V2DI "V4SI") (V4SI "V8HI") (V8HI "V16QI")]) |
| 235 |
(define_mode_attr VP_small_lc [(V2DI "v4si") (V4SI "v8hi") (V8HI "v16qi")]) |
| 236 |
(define_mode_attr VU_char [(V2DI "w") (V4SI "h") (V8HI "b")]) |
| 237 |
|
| 238 |
;; Vector negate |
| 239 |
(define_mode_iterator VNEG [V4SI V2DI]) |
| 240 |
|
| 241 |
;; Vector move instructions. |
| 242 |
(define_insn "*altivec_mov<mode>" |
| 243 |
[(set (match_operand:VM2 0 "nonimmediate_operand" "=Z,v,v,?Y,?*r,?*r,v,v,?*r") |
| 244 |
(match_operand:VM2 1 "input_operand" "v,Z,v,*r,Y,*r,j,W,W"))] |
| 245 |
"VECTOR_MEM_ALTIVEC_P (<MODE>mode) |
| 246 |
&& (register_operand (operands[0], <MODE>mode) |
| 247 |
|| register_operand (operands[1], <MODE>mode))" |
| 248 |
"@ |
| 249 |
stvx %1,%y0 |
| 250 |
lvx %0,%y1 |
| 251 |
vor %0,%1,%1 |
| 252 |
# |
| 253 |
# |
| 254 |
# |
| 255 |
vxor %0,%0,%0 |
| 256 |
* return output_vec_const_move (operands); |
| 257 |
#" |
| 258 |
[(set_attr "type" "vecstore,vecload,veclogical,store,load,*,veclogical,*,*") |
| 259 |
(set_attr "length" "*,*,*,20,20,20,*,8,32")]) |
| 260 |
|
| 261 |
;; Unlike other altivec moves, allow the GPRs, since a normal use of TImode |
| 262 |
;; is for unions. However for plain data movement, slightly favor the vector |
| 263 |
;; loads |
| 264 |
(define_insn "*altivec_movti" |
| 265 |
[(set (match_operand:TI 0 "nonimmediate_operand" "=Z,v,v,?Y,?r,?r,v,v") |
| 266 |
(match_operand:TI 1 "input_operand" "v,Z,v,r,Y,r,j,W"))] |
| 267 |
"VECTOR_MEM_ALTIVEC_P (TImode) |
| 268 |
&& (register_operand (operands[0], TImode) |
| 269 |
|| register_operand (operands[1], TImode))" |
| 270 |
"@ |
| 271 |
stvx %1,%y0 |
| 272 |
lvx %0,%y1 |
| 273 |
vor %0,%1,%1 |
| 274 |
# |
| 275 |
# |
| 276 |
# |
| 277 |
vxor %0,%0,%0 |
| 278 |
* return output_vec_const_move (operands);" |
| 279 |
[(set_attr "type" "vecstore,vecload,veclogical,store,load,*,veclogical,*")]) |
| 280 |
|
| 281 |
;; Load up a vector with the most significant bit set by loading up -1 and |
| 282 |
;; doing a shift left |
| 283 |
(define_split |
| 284 |
[(set (match_operand:VM 0 "altivec_register_operand") |
| 285 |
(match_operand:VM 1 "easy_vector_constant_msb"))] |
| 286 |
"VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode) && reload_completed" |
| 287 |
[(const_int 0)] |
| 288 |
{ |
| 289 |
rtx dest = operands[0]; |
| 290 |
machine_mode mode; |
| 291 |
rtvec v; |
| 292 |
int i, num_elements; |
| 293 |
|
| 294 |
switch (easy_altivec_constant (operands[1], <MODE>mode)) |
| 295 |
{ |
| 296 |
case 1: |
| 297 |
mode = V16QImode; |
| 298 |
break; |
| 299 |
case 2: |
| 300 |
mode = V8HImode; |
| 301 |
break; |
| 302 |
case 4: |
| 303 |
mode = V4SImode; |
| 304 |
break; |
| 305 |
default: |
| 306 |
gcc_unreachable (); |
| 307 |
} |
| 308 |
if (mode != <MODE>mode) |
| 309 |
dest = gen_lowpart (mode, dest); |
| 310 |
|
| 311 |
num_elements = GET_MODE_NUNITS (mode); |
| 312 |
v = rtvec_alloc (num_elements); |
| 313 |
for (i = 0; i < num_elements; i++) |
| 314 |
RTVEC_ELT (v, i) = constm1_rtx; |
| 315 |
|
| 316 |
rs6000_expand_vector_init (dest, gen_rtx_PARALLEL (mode, v)); |
| 317 |
emit_insn (gen_rtx_SET (dest, gen_rtx_ASHIFT (mode, dest, dest))); |
| 318 |
DONE; |
| 319 |
}) |
| 320 |
|
| 321 |
(define_split |
| 322 |
[(set (match_operand:VM 0 "altivec_register_operand") |
| 323 |
(match_operand:VM 1 "easy_vector_constant_add_self"))] |
| 324 |
"VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode) && reload_completed" |
| 325 |
[(set (match_dup 0) (match_dup 3)) |
| 326 |
(set (match_dup 0) (match_dup 4))] |
| 327 |
{ |
| 328 |
rtx dup = gen_easy_altivec_constant (operands[1]); |
| 329 |
rtx const_vec; |
| 330 |
machine_mode op_mode = <MODE>mode; |
| 331 |
|
| 332 |
/* Divide the operand of the resulting VEC_DUPLICATE, and use |
| 333 |
simplify_rtx to make a CONST_VECTOR. */ |
| 334 |
XEXP (dup, 0) = simplify_const_binary_operation (ASHIFTRT, QImode, |
| 335 |
XEXP (dup, 0), const1_rtx); |
| 336 |
const_vec = simplify_rtx (dup); |
| 337 |
|
| 338 |
if (op_mode == V4SFmode) |
| 339 |
{ |
| 340 |
op_mode = V4SImode; |
| 341 |
operands[0] = gen_lowpart (op_mode, operands[0]); |
| 342 |
} |
| 343 |
if (GET_MODE (const_vec) == op_mode) |
| 344 |
operands[3] = const_vec; |
| 345 |
else |
| 346 |
operands[3] = gen_lowpart (op_mode, const_vec); |
| 347 |
operands[4] = gen_rtx_PLUS (op_mode, operands[0], operands[0]); |
| 348 |
}) |
| 349 |
|
| 350 |
(define_split |
| 351 |
[(set (match_operand:VM 0 "altivec_register_operand") |
| 352 |
(match_operand:VM 1 "easy_vector_constant_vsldoi"))] |
| 353 |
"VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode) && can_create_pseudo_p ()" |
| 354 |
[(set (match_dup 2) (match_dup 3)) |
| 355 |
(set (match_dup 4) (match_dup 5)) |
| 356 |
(set (match_dup 0) |
| 357 |
(unspec:VM [(match_dup 2) |
| 358 |
(match_dup 4) |
| 359 |
(match_dup 6)] |
| 360 |
UNSPEC_VSLDOI))] |
| 361 |
{ |
| 362 |
rtx op1 = operands[1]; |
| 363 |
int elt = (BYTES_BIG_ENDIAN) ? 0 : GET_MODE_NUNITS (<MODE>mode) - 1; |
| 364 |
HOST_WIDE_INT val = const_vector_elt_as_int (op1, elt); |
| 365 |
rtx rtx_val = GEN_INT (val); |
| 366 |
int shift = vspltis_shifted (op1); |
| 367 |
|
| 368 |
gcc_assert (shift != 0); |
| 369 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 370 |
operands[3] = gen_const_vec_duplicate (<MODE>mode, rtx_val); |
| 371 |
operands[4] = gen_reg_rtx (<MODE>mode); |
| 372 |
|
| 373 |
if (shift < 0) |
| 374 |
{ |
| 375 |
operands[5] = CONSTM1_RTX (<MODE>mode); |
| 376 |
operands[6] = GEN_INT (-shift); |
| 377 |
} |
| 378 |
else |
| 379 |
{ |
| 380 |
operands[5] = CONST0_RTX (<MODE>mode); |
| 381 |
operands[6] = GEN_INT (shift); |
| 382 |
} |
| 383 |
}) |
| 384 |
|
| 385 |
(define_insn_and_split "sldoi_to_mov<mode>" |
| 386 |
[(set (match_operand:VM 0 "altivec_register_operand") |
| 387 |
(unspec:VM [(match_operand:VM 1 "const_vector_each_byte_same") |
| 388 |
(match_dup 1) |
| 389 |
(match_operand:QI 2 "u5bit_cint_operand")] |
| 390 |
UNSPEC_VSLDOI))] |
| 391 |
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode) && can_create_pseudo_p ()" |
| 392 |
"#" |
| 393 |
"&& 1" |
| 394 |
[(set (match_dup 0) (match_dup 1))] |
| 395 |
"{ |
| 396 |
if (!easy_vector_constant (operands[1], <MODE>mode)) |
| 397 |
{ |
| 398 |
rtx dest = gen_reg_rtx (<MODE>mode); |
| 399 |
emit_move_insn (dest, operands[1]); |
| 400 |
operands[1] = dest; |
| 401 |
} |
| 402 |
}") |
| 403 |
|
| 404 |
(define_insn "get_vrsave_internal" |
| 405 |
[(set (match_operand:SI 0 "register_operand" "=r") |
| 406 |
(unspec:SI [(reg:SI VRSAVE_REGNO)] UNSPEC_GET_VRSAVE))] |
| 407 |
"TARGET_ALTIVEC" |
| 408 |
{ |
| 409 |
if (TARGET_MACHO) |
| 410 |
return "mfspr %0,256"; |
| 411 |
else |
| 412 |
return "mfvrsave %0"; |
| 413 |
} |
| 414 |
[(set_attr "type" "*")]) |
| 415 |
|
| 416 |
(define_insn "*set_vrsave_internal" |
| 417 |
[(match_parallel 0 "vrsave_operation" |
| 418 |
[(set (reg:SI VRSAVE_REGNO) |
| 419 |
(unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r") |
| 420 |
(reg:SI VRSAVE_REGNO)] UNSPECV_SET_VRSAVE))])] |
| 421 |
"TARGET_ALTIVEC" |
| 422 |
{ |
| 423 |
if (TARGET_MACHO) |
| 424 |
return "mtspr 256,%1"; |
| 425 |
else |
| 426 |
return "mtvrsave %1"; |
| 427 |
} |
| 428 |
[(set_attr "type" "*")]) |
| 429 |
|
| 430 |
(define_insn "*save_world" |
| 431 |
[(match_parallel 0 "save_world_operation" |
| 432 |
[(clobber (reg:SI LR_REGNO)) |
| 433 |
(use (match_operand:SI 1 "call_operand" "s"))])] |
| 434 |
"TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT" |
| 435 |
"bl %z1" |
| 436 |
[(set_attr "type" "branch")]) |
| 437 |
|
| 438 |
(define_insn "*restore_world" |
| 439 |
[(match_parallel 0 "restore_world_operation" |
| 440 |
[(return) |
| 441 |
(use (match_operand:SI 1 "call_operand" "s")) |
| 442 |
(clobber (match_operand:SI 2 "gpc_reg_operand" "=r"))])] |
| 443 |
"TARGET_MACHO && (DEFAULT_ABI == ABI_DARWIN) && TARGET_32BIT" |
| 444 |
"b %z1") |
| 445 |
|
| 446 |
;; The save_vregs and restore_vregs patterns don't use memory_operand |
| 447 |
;; because (plus (reg) (const_int)) is not a valid vector address. |
| 448 |
;; This way is more compact than describing exactly what happens in |
| 449 |
;; the out-of-line functions, ie. loading the constant into r11/r12 |
| 450 |
;; then using indexed addressing, and requires less editing of rtl |
| 451 |
;; to describe the operation to dwarf2out_frame_debug_expr. |
| 452 |
(define_insn "*save_vregs_<mode>_r11" |
| 453 |
[(match_parallel 0 "any_parallel_operand" |
| 454 |
[(clobber (reg:P LR_REGNO)) |
| 455 |
(use (match_operand:P 1 "symbol_ref_operand" "s")) |
| 456 |
(clobber (reg:P 11)) |
| 457 |
(use (reg:P 0)) |
| 458 |
(set (mem:V4SI (plus:P (match_operand:P 2 "gpc_reg_operand" "b") |
| 459 |
(match_operand:P 3 "short_cint_operand" "I"))) |
| 460 |
(match_operand:V4SI 4 "altivec_register_operand" "v"))])] |
| 461 |
"TARGET_ALTIVEC" |
| 462 |
"bl %1" |
| 463 |
[(set_attr "type" "branch")]) |
| 464 |
|
| 465 |
(define_insn "*save_vregs_<mode>_r12" |
| 466 |
[(match_parallel 0 "any_parallel_operand" |
| 467 |
[(clobber (reg:P LR_REGNO)) |
| 468 |
(use (match_operand:P 1 "symbol_ref_operand" "s")) |
| 469 |
(clobber (reg:P 12)) |
| 470 |
(use (reg:P 0)) |
| 471 |
(set (mem:V4SI (plus:P (match_operand:P 2 "gpc_reg_operand" "b") |
| 472 |
(match_operand:P 3 "short_cint_operand" "I"))) |
| 473 |
(match_operand:V4SI 4 "altivec_register_operand" "v"))])] |
| 474 |
"TARGET_ALTIVEC" |
| 475 |
"bl %1" |
| 476 |
[(set_attr "type" "branch")]) |
| 477 |
|
| 478 |
(define_insn "*restore_vregs_<mode>_r11" |
| 479 |
[(match_parallel 0 "any_parallel_operand" |
| 480 |
[(clobber (reg:P LR_REGNO)) |
| 481 |
(use (match_operand:P 1 "symbol_ref_operand" "s")) |
| 482 |
(clobber (reg:P 11)) |
| 483 |
(use (reg:P 0)) |
| 484 |
(set (match_operand:V4SI 2 "altivec_register_operand" "=v") |
| 485 |
(mem:V4SI (plus:P (match_operand:P 3 "gpc_reg_operand" "b") |
| 486 |
(match_operand:P 4 "short_cint_operand" "I"))))])] |
| 487 |
"TARGET_ALTIVEC" |
| 488 |
"bl %1" |
| 489 |
[(set_attr "type" "branch")]) |
| 490 |
|
| 491 |
(define_insn "*restore_vregs_<mode>_r12" |
| 492 |
[(match_parallel 0 "any_parallel_operand" |
| 493 |
[(clobber (reg:P LR_REGNO)) |
| 494 |
(use (match_operand:P 1 "symbol_ref_operand" "s")) |
| 495 |
(clobber (reg:P 12)) |
| 496 |
(use (reg:P 0)) |
| 497 |
(set (match_operand:V4SI 2 "altivec_register_operand" "=v") |
| 498 |
(mem:V4SI (plus:P (match_operand:P 3 "gpc_reg_operand" "b") |
| 499 |
(match_operand:P 4 "short_cint_operand" "I"))))])] |
| 500 |
"TARGET_ALTIVEC" |
| 501 |
"bl %1" |
| 502 |
[(set_attr "type" "branch")]) |
| 503 |
|
| 504 |
;; Simple binary operations. |
| 505 |
|
| 506 |
;; add |
| 507 |
(define_insn "add<mode>3" |
| 508 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 509 |
(plus:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 510 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 511 |
"<VI_unit>" |
| 512 |
"vaddu<VI_char>m %0,%1,%2" |
| 513 |
[(set_attr "type" "vecsimple")]) |
| 514 |
|
| 515 |
(define_insn "*altivec_addv4sf3" |
| 516 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 517 |
(plus:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 518 |
(match_operand:V4SF 2 "register_operand" "v")))] |
| 519 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 520 |
"vaddfp %0,%1,%2" |
| 521 |
[(set_attr "type" "vecfloat")]) |
| 522 |
|
| 523 |
(define_insn "altivec_vaddcuw" |
| 524 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 525 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 526 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 527 |
UNSPEC_VADDCUW))] |
| 528 |
"VECTOR_UNIT_ALTIVEC_P (V4SImode)" |
| 529 |
"vaddcuw %0,%1,%2" |
| 530 |
[(set_attr "type" "vecsimple")]) |
| 531 |
|
| 532 |
(define_insn "altivec_vaddu<VI_char>s" |
| 533 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 534 |
(us_plus:VI (match_operand:VI 1 "register_operand" "v") |
| 535 |
(match_operand:VI 2 "register_operand" "v"))) |
| 536 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 537 |
"<VI_unit>" |
| 538 |
"vaddu<VI_char>s %0,%1,%2" |
| 539 |
[(set_attr "type" "vecsimple")]) |
| 540 |
|
| 541 |
(define_insn "altivec_vadds<VI_char>s" |
| 542 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 543 |
(ss_plus:VI (match_operand:VI 1 "register_operand" "v") |
| 544 |
(match_operand:VI 2 "register_operand" "v"))) |
| 545 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 546 |
"VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" |
| 547 |
"vadds<VI_char>s %0,%1,%2" |
| 548 |
[(set_attr "type" "vecsimple")]) |
| 549 |
|
| 550 |
;; sub |
| 551 |
(define_insn "sub<mode>3" |
| 552 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 553 |
(minus:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 554 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 555 |
"<VI_unit>" |
| 556 |
"vsubu<VI_char>m %0,%1,%2" |
| 557 |
[(set_attr "type" "vecsimple")]) |
| 558 |
|
| 559 |
(define_insn "*altivec_subv4sf3" |
| 560 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 561 |
(minus:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 562 |
(match_operand:V4SF 2 "register_operand" "v")))] |
| 563 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 564 |
"vsubfp %0,%1,%2" |
| 565 |
[(set_attr "type" "vecfloat")]) |
| 566 |
|
| 567 |
(define_insn "altivec_vsubcuw" |
| 568 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 569 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 570 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 571 |
UNSPEC_VSUBCUW))] |
| 572 |
"VECTOR_UNIT_ALTIVEC_P (V4SImode)" |
| 573 |
"vsubcuw %0,%1,%2" |
| 574 |
[(set_attr "type" "vecsimple")]) |
| 575 |
|
| 576 |
(define_insn "altivec_vsubu<VI_char>s" |
| 577 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 578 |
(us_minus:VI (match_operand:VI 1 "register_operand" "v") |
| 579 |
(match_operand:VI 2 "register_operand" "v"))) |
| 580 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 581 |
"VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" |
| 582 |
"vsubu<VI_char>s %0,%1,%2" |
| 583 |
[(set_attr "type" "vecsimple")]) |
| 584 |
|
| 585 |
(define_insn "altivec_vsubs<VI_char>s" |
| 586 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 587 |
(ss_minus:VI (match_operand:VI 1 "register_operand" "v") |
| 588 |
(match_operand:VI 2 "register_operand" "v"))) |
| 589 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 590 |
"VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" |
| 591 |
"vsubs<VI_char>s %0,%1,%2" |
| 592 |
[(set_attr "type" "vecsimple")]) |
| 593 |
|
| 594 |
;; |
| 595 |
(define_insn "uavg<mode>3_ceil" |
| 596 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 597 |
(unspec:VI [(match_operand:VI 1 "register_operand" "v") |
| 598 |
(match_operand:VI 2 "register_operand" "v")] |
| 599 |
UNSPEC_VAVGU))] |
| 600 |
"TARGET_ALTIVEC" |
| 601 |
"vavgu<VI_char> %0,%1,%2" |
| 602 |
[(set_attr "type" "vecsimple")]) |
| 603 |
|
| 604 |
(define_insn "avg<mode>3_ceil" |
| 605 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 606 |
(unspec:VI [(match_operand:VI 1 "register_operand" "v") |
| 607 |
(match_operand:VI 2 "register_operand" "v")] |
| 608 |
UNSPEC_VAVGS))] |
| 609 |
"VECTOR_UNIT_ALTIVEC_P (<MODE>mode)" |
| 610 |
"vavgs<VI_char> %0,%1,%2" |
| 611 |
[(set_attr "type" "vecsimple")]) |
| 612 |
|
| 613 |
(define_insn "altivec_vcmpbfp" |
| 614 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 615 |
(unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v") |
| 616 |
(match_operand:V4SF 2 "register_operand" "v")] |
| 617 |
UNSPEC_VCMPBFP))] |
| 618 |
"VECTOR_UNIT_ALTIVEC_P (V4SImode)" |
| 619 |
"vcmpbfp %0,%1,%2" |
| 620 |
[(set_attr "type" "veccmp")]) |
| 621 |
|
| 622 |
(define_insn "altivec_eqv1ti" |
| 623 |
[(set (match_operand:V1TI 0 "altivec_register_operand" "=v") |
| 624 |
(eq:V1TI (match_operand:V1TI 1 "altivec_register_operand" "v") |
| 625 |
(match_operand:V1TI 2 "altivec_register_operand" "v")))] |
| 626 |
"TARGET_POWER10" |
| 627 |
"vcmpequq %0,%1,%2" |
| 628 |
[(set_attr "type" "veccmpfx")]) |
| 629 |
|
| 630 |
(define_insn "altivec_eq<mode>" |
| 631 |
[(set (match_operand:VI2 0 "altivec_register_operand" "=v") |
| 632 |
(eq:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") |
| 633 |
(match_operand:VI2 2 "altivec_register_operand" "v")))] |
| 634 |
"<VI_unit>" |
| 635 |
"vcmpequ<VI_char> %0,%1,%2" |
| 636 |
[(set_attr "type" "veccmpfx")]) |
| 637 |
|
| 638 |
(define_insn "*altivec_gt<mode>" |
| 639 |
[(set (match_operand:VI2 0 "altivec_register_operand" "=v") |
| 640 |
(gt:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") |
| 641 |
(match_operand:VI2 2 "altivec_register_operand" "v")))] |
| 642 |
"<VI_unit>" |
| 643 |
"vcmpgts<VI_char> %0,%1,%2" |
| 644 |
[(set_attr "type" "veccmpfx")]) |
| 645 |
|
| 646 |
(define_insn "*altivec_gtv1ti" |
| 647 |
[(set (match_operand:V1TI 0 "altivec_register_operand" "=v") |
| 648 |
(gt:V1TI (match_operand:V1TI 1 "altivec_register_operand" "v") |
| 649 |
(match_operand:V1TI 2 "altivec_register_operand" "v")))] |
| 650 |
"TARGET_POWER10" |
| 651 |
"vcmpgtsq %0,%1,%2" |
| 652 |
[(set_attr "type" "veccmpfx")]) |
| 653 |
|
| 654 |
(define_insn "*altivec_gtu<mode>" |
| 655 |
[(set (match_operand:VI2 0 "altivec_register_operand" "=v") |
| 656 |
(gtu:VI2 (match_operand:VI2 1 "altivec_register_operand" "v") |
| 657 |
(match_operand:VI2 2 "altivec_register_operand" "v")))] |
| 658 |
"<VI_unit>" |
| 659 |
"vcmpgtu<VI_char> %0,%1,%2" |
| 660 |
[(set_attr "type" "veccmpfx")]) |
| 661 |
|
| 662 |
(define_insn "*altivec_gtuv1ti" |
| 663 |
[(set (match_operand:V1TI 0 "altivec_register_operand" "=v") |
| 664 |
(gtu:V1TI (match_operand:V1TI 1 "altivec_register_operand" "v") |
| 665 |
(match_operand:V1TI 2 "altivec_register_operand" "v")))] |
| 666 |
"TARGET_POWER10" |
| 667 |
"vcmpgtuq %0,%1,%2" |
| 668 |
[(set_attr "type" "veccmpfx")]) |
| 669 |
|
| 670 |
(define_insn "*altivec_eqv4sf" |
| 671 |
[(set (match_operand:V4SF 0 "altivec_register_operand" "=v") |
| 672 |
(eq:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v") |
| 673 |
(match_operand:V4SF 2 "altivec_register_operand" "v")))] |
| 674 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 675 |
"vcmpeqfp %0,%1,%2" |
| 676 |
[(set_attr "type" "veccmp")]) |
| 677 |
|
| 678 |
(define_insn "*altivec_gtv4sf" |
| 679 |
[(set (match_operand:V4SF 0 "altivec_register_operand" "=v") |
| 680 |
(gt:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v") |
| 681 |
(match_operand:V4SF 2 "altivec_register_operand" "v")))] |
| 682 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 683 |
"vcmpgtfp %0,%1,%2" |
| 684 |
[(set_attr "type" "veccmp")]) |
| 685 |
|
| 686 |
(define_insn "*altivec_gev4sf" |
| 687 |
[(set (match_operand:V4SF 0 "altivec_register_operand" "=v") |
| 688 |
(ge:V4SF (match_operand:V4SF 1 "altivec_register_operand" "v") |
| 689 |
(match_operand:V4SF 2 "altivec_register_operand" "v")))] |
| 690 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 691 |
"vcmpgefp %0,%1,%2" |
| 692 |
[(set_attr "type" "veccmp")]) |
| 693 |
|
| 694 |
(define_insn "altivec_vsel<mode>" |
| 695 |
[(set (match_operand:VM 0 "register_operand" "=wa,v") |
| 696 |
(ior:VM |
| 697 |
(and:VM |
| 698 |
(not:VM (match_operand:VM 3 "register_operand" "wa,v")) |
| 699 |
(match_operand:VM 1 "register_operand" "wa,v")) |
| 700 |
(and:VM |
| 701 |
(match_dup 3) |
| 702 |
(match_operand:VM 2 "register_operand" "wa,v"))))] |
| 703 |
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" |
| 704 |
"@ |
| 705 |
xxsel %x0,%x1,%x2,%x3 |
| 706 |
vsel %0,%1,%2,%3" |
| 707 |
[(set_attr "type" "vecmove") |
| 708 |
(set_attr "isa" "<VSisa>")]) |
| 709 |
|
| 710 |
(define_insn "altivec_vsel<mode>2" |
| 711 |
[(set (match_operand:VM 0 "register_operand" "=wa,v") |
| 712 |
(ior:VM |
| 713 |
(and:VM |
| 714 |
(not:VM (match_operand:VM 3 "register_operand" "wa,v")) |
| 715 |
(match_operand:VM 1 "register_operand" "wa,v")) |
| 716 |
(and:VM |
| 717 |
(match_operand:VM 2 "register_operand" "wa,v") |
| 718 |
(match_dup 3))))] |
| 719 |
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" |
| 720 |
"@ |
| 721 |
xxsel %x0,%x1,%x2,%x3 |
| 722 |
vsel %0,%1,%2,%3" |
| 723 |
[(set_attr "type" "vecmove") |
| 724 |
(set_attr "isa" "<VSisa>")]) |
| 725 |
|
| 726 |
(define_insn "altivec_vsel<mode>3" |
| 727 |
[(set (match_operand:VM 0 "register_operand" "=wa,v") |
| 728 |
(ior:VM |
| 729 |
(and:VM |
| 730 |
(match_operand:VM 3 "register_operand" "wa,v") |
| 731 |
(match_operand:VM 1 "register_operand" "wa,v")) |
| 732 |
(and:VM |
| 733 |
(not:VM (match_dup 3)) |
| 734 |
(match_operand:VM 2 "register_operand" "wa,v"))))] |
| 735 |
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" |
| 736 |
"@ |
| 737 |
xxsel %x0,%x2,%x1,%x3 |
| 738 |
vsel %0,%2,%1,%3" |
| 739 |
[(set_attr "type" "vecmove") |
| 740 |
(set_attr "isa" "<VSisa>")]) |
| 741 |
|
| 742 |
(define_insn "altivec_vsel<mode>4" |
| 743 |
[(set (match_operand:VM 0 "register_operand" "=wa,v") |
| 744 |
(ior:VM |
| 745 |
(and:VM |
| 746 |
(match_operand:VM 1 "register_operand" "wa,v") |
| 747 |
(match_operand:VM 3 "register_operand" "wa,v")) |
| 748 |
(and:VM |
| 749 |
(not:VM (match_dup 3)) |
| 750 |
(match_operand:VM 2 "register_operand" "wa,v"))))] |
| 751 |
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)" |
| 752 |
"@ |
| 753 |
xxsel %x0,%x2,%x1,%x3 |
| 754 |
vsel %0,%2,%1,%3" |
| 755 |
[(set_attr "type" "vecmove") |
| 756 |
(set_attr "isa" "<VSisa>")]) |
| 757 |
|
| 758 |
;; Fused multiply add. |
| 759 |
|
| 760 |
(define_insn "*altivec_fmav4sf4" |
| 761 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 762 |
(fma:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 763 |
(match_operand:V4SF 2 "register_operand" "v") |
| 764 |
(match_operand:V4SF 3 "register_operand" "v")))] |
| 765 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 766 |
"vmaddfp %0,%1,%2,%3" |
| 767 |
[(set_attr "type" "vecfloat")]) |
| 768 |
|
| 769 |
;; We do multiply as a fused multiply-add with an add of a -0.0 vector. |
| 770 |
|
| 771 |
(define_expand "altivec_mulv4sf3" |
| 772 |
[(set (match_operand:V4SF 0 "register_operand") |
| 773 |
(fma:V4SF (match_operand:V4SF 1 "register_operand") |
| 774 |
(match_operand:V4SF 2 "register_operand") |
| 775 |
(match_dup 3)))] |
| 776 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 777 |
{ |
| 778 |
rtx neg0; |
| 779 |
|
| 780 |
/* Generate [-0.0, -0.0, -0.0, -0.0]. */ |
| 781 |
neg0 = gen_reg_rtx (V4SImode); |
| 782 |
emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx)); |
| 783 |
emit_insn (gen_vashlv4si3 (neg0, neg0, neg0)); |
| 784 |
|
| 785 |
operands[3] = gen_lowpart (V4SFmode, neg0); |
| 786 |
}) |
| 787 |
|
| 788 |
;; 32-bit integer multiplication |
| 789 |
;; A_high = Operand_0 & 0xFFFF0000 >> 16 |
| 790 |
;; A_low = Operand_0 & 0xFFFF |
| 791 |
;; B_high = Operand_1 & 0xFFFF0000 >> 16 |
| 792 |
;; B_low = Operand_1 & 0xFFFF |
| 793 |
;; result = A_low * B_low + (A_high * B_low + B_high * A_low) << 16 |
| 794 |
|
| 795 |
;; (define_insn "mulv4si3" |
| 796 |
;; [(set (match_operand:V4SI 0 "register_operand" "=v") |
| 797 |
;; (mult:V4SI (match_operand:V4SI 1 "register_operand" "v") |
| 798 |
;; (match_operand:V4SI 2 "register_operand" "v")))] |
| 799 |
(define_insn "mulv4si3_p8" |
| 800 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 801 |
(mult:V4SI (match_operand:V4SI 1 "register_operand" "v") |
| 802 |
(match_operand:V4SI 2 "register_operand" "v")))] |
| 803 |
"TARGET_P8_VECTOR" |
| 804 |
"vmuluwm %0,%1,%2" |
| 805 |
[(set_attr "type" "veccomplex")]) |
| 806 |
|
| 807 |
(define_expand "mulv4si3" |
| 808 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 809 |
(use (match_operand:V4SI 1 "register_operand")) |
| 810 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 811 |
"TARGET_ALTIVEC" |
| 812 |
{ |
| 813 |
rtx zero; |
| 814 |
rtx swap; |
| 815 |
rtx small_swap; |
| 816 |
rtx sixteen; |
| 817 |
rtx one; |
| 818 |
rtx two; |
| 819 |
rtx low_product; |
| 820 |
rtx high_product; |
| 821 |
|
| 822 |
if (TARGET_P8_VECTOR) |
| 823 |
{ |
| 824 |
emit_insn (gen_mulv4si3_p8 (operands[0], operands[1], operands[2])); |
| 825 |
DONE; |
| 826 |
} |
| 827 |
|
| 828 |
zero = gen_reg_rtx (V4SImode); |
| 829 |
emit_insn (gen_altivec_vspltisw (zero, const0_rtx)); |
| 830 |
|
| 831 |
sixteen = gen_reg_rtx (V4SImode); |
| 832 |
emit_insn (gen_altivec_vspltisw (sixteen, gen_rtx_CONST_INT (V4SImode, -16))); |
| 833 |
|
| 834 |
swap = gen_reg_rtx (V4SImode); |
| 835 |
emit_insn (gen_vrotlv4si3 (swap, operands[2], sixteen)); |
| 836 |
|
| 837 |
one = gen_reg_rtx (V8HImode); |
| 838 |
convert_move (one, operands[1], 0); |
| 839 |
|
| 840 |
two = gen_reg_rtx (V8HImode); |
| 841 |
convert_move (two, operands[2], 0); |
| 842 |
|
| 843 |
small_swap = gen_reg_rtx (V8HImode); |
| 844 |
convert_move (small_swap, swap, 0); |
| 845 |
|
| 846 |
low_product = gen_reg_rtx (V4SImode); |
| 847 |
emit_insn (gen_altivec_vmulouh (low_product, one, two)); |
| 848 |
|
| 849 |
high_product = gen_reg_rtx (V4SImode); |
| 850 |
emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero)); |
| 851 |
|
| 852 |
emit_insn (gen_vashlv4si3 (high_product, high_product, sixteen)); |
| 853 |
|
| 854 |
emit_insn (gen_addv4si3 (operands[0], high_product, low_product)); |
| 855 |
|
| 856 |
DONE; |
| 857 |
}) |
| 858 |
|
| 859 |
(define_expand "mulv8hi3" |
| 860 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 861 |
(use (match_operand:V8HI 1 "register_operand")) |
| 862 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 863 |
"TARGET_ALTIVEC" |
| 864 |
{ |
| 865 |
rtx zero = gen_reg_rtx (V8HImode); |
| 866 |
|
| 867 |
emit_insn (gen_altivec_vspltish (zero, const0_rtx)); |
| 868 |
emit_insn (gen_fmav8hi4 (operands[0], operands[1], operands[2], zero)); |
| 869 |
|
| 870 |
DONE; |
| 871 |
}) |
| 872 |
|
| 873 |
;; Map UNSPEC_SLDB to "l" and UNSPEC_SRDB to "r". |
| 874 |
(define_int_attr SLDB_lr [(UNSPEC_SLDB "l") |
| 875 |
(UNSPEC_SRDB "r")]) |
| 876 |
|
| 877 |
(define_int_iterator VSHIFT_DBL_LR [UNSPEC_SLDB UNSPEC_SRDB]) |
| 878 |
|
| 879 |
(define_insn "vs<SLDB_lr>db_<mode>" |
| 880 |
[(set (match_operand:VEC_IC 0 "register_operand" "=v") |
| 881 |
(unspec:VEC_IC [(match_operand:VEC_IC 1 "register_operand" "v") |
| 882 |
(match_operand:VEC_IC 2 "register_operand" "v") |
| 883 |
(match_operand:QI 3 "const_0_to_12_operand" "n")] |
| 884 |
VSHIFT_DBL_LR))] |
| 885 |
"TARGET_POWER10" |
| 886 |
"vs<SLDB_lr>dbi %0,%1,%2,%3" |
| 887 |
[(set_attr "type" "vecsimple")]) |
| 888 |
|
| 889 |
(define_expand "vstrir_<mode>" |
| 890 |
[(set (match_operand:VIshort 0 "altivec_register_operand") |
| 891 |
(unspec:VIshort [(match_operand:VIshort 1 "altivec_register_operand")] |
| 892 |
UNSPEC_VSTRIR))] |
| 893 |
"TARGET_POWER10" |
| 894 |
{ |
| 895 |
if (BYTES_BIG_ENDIAN) |
| 896 |
emit_insn (gen_vstrir_direct_<mode> (operands[0], operands[1])); |
| 897 |
else |
| 898 |
emit_insn (gen_vstril_direct_<mode> (operands[0], operands[1])); |
| 899 |
DONE; |
| 900 |
}) |
| 901 |
|
| 902 |
(define_insn "vstrir_direct_<mode>" |
| 903 |
[(set (match_operand:VIshort 0 "altivec_register_operand" "=v") |
| 904 |
(unspec:VIshort |
| 905 |
[(match_operand:VIshort 1 "altivec_register_operand" "v")] |
| 906 |
UNSPEC_VSTRIR))] |
| 907 |
"TARGET_POWER10" |
| 908 |
"vstri<wd>r %0,%1" |
| 909 |
[(set_attr "type" "vecsimple")]) |
| 910 |
|
| 911 |
;; This expands into same code as vstrir<mode> followed by condition logic |
| 912 |
;; so that a single vstribr. or vstrihr. or vstribl. or vstrihl. instruction |
| 913 |
;; can, for example, satisfy the needs of a vec_strir () function paired |
| 914 |
;; with a vec_strir_p () function if both take the same incoming arguments. |
| 915 |
(define_expand "vstrir_p_<mode>" |
| 916 |
[(match_operand:SI 0 "gpc_reg_operand") |
| 917 |
(match_operand:VIshort 1 "altivec_register_operand")] |
| 918 |
"TARGET_POWER10" |
| 919 |
{ |
| 920 |
rtx scratch = gen_reg_rtx (<MODE>mode); |
| 921 |
if (BYTES_BIG_ENDIAN) |
| 922 |
emit_insn (gen_vstrir_p_direct_<mode> (scratch, operands[1])); |
| 923 |
else |
| 924 |
emit_insn (gen_vstril_p_direct_<mode> (scratch, operands[1])); |
| 925 |
emit_insn (gen_cr6_test_for_zero (operands[0])); |
| 926 |
DONE; |
| 927 |
}) |
| 928 |
|
| 929 |
(define_insn "vstrir_p_direct_<mode>" |
| 930 |
[(set (match_operand:VIshort 0 "altivec_register_operand" "=v") |
| 931 |
(unspec:VIshort |
| 932 |
[(match_operand:VIshort 1 "altivec_register_operand" "v")] |
| 933 |
UNSPEC_VSTRIR)) |
| 934 |
(set (reg:CC CR6_REGNO) |
| 935 |
(unspec:CC [(match_dup 1)] |
| 936 |
UNSPEC_VSTRIR))] |
| 937 |
"TARGET_POWER10" |
| 938 |
"vstri<wd>r. %0,%1" |
| 939 |
[(set_attr "type" "vecsimple")]) |
| 940 |
|
| 941 |
(define_expand "vstril_<mode>" |
| 942 |
[(set (match_operand:VIshort 0 "altivec_register_operand") |
| 943 |
(unspec:VIshort [(match_operand:VIshort 1 "altivec_register_operand")] |
| 944 |
UNSPEC_VSTRIR))] |
| 945 |
"TARGET_POWER10" |
| 946 |
{ |
| 947 |
if (BYTES_BIG_ENDIAN) |
| 948 |
emit_insn (gen_vstril_direct_<mode> (operands[0], operands[1])); |
| 949 |
else |
| 950 |
emit_insn (gen_vstrir_direct_<mode> (operands[0], operands[1])); |
| 951 |
DONE; |
| 952 |
}) |
| 953 |
|
| 954 |
(define_insn "vstril_direct_<mode>" |
| 955 |
[(set (match_operand:VIshort 0 "altivec_register_operand" "=v") |
| 956 |
(unspec:VIshort |
| 957 |
[(match_operand:VIshort 1 "altivec_register_operand" "v")] |
| 958 |
UNSPEC_VSTRIL))] |
| 959 |
"TARGET_POWER10" |
| 960 |
"vstri<wd>l %0,%1" |
| 961 |
[(set_attr "type" "vecsimple")]) |
| 962 |
|
| 963 |
;; This expands into same code as vstril_<mode> followed by condition logic |
| 964 |
;; so that a single vstribr. or vstrihr. or vstribl. or vstrihl. instruction |
| 965 |
;; can, for example, satisfy the needs of a vec_stril () function paired |
| 966 |
;; with a vec_stril_p () function if both take the same incoming arguments. |
| 967 |
(define_expand "vstril_p_<mode>" |
| 968 |
[(match_operand:SI 0 "gpc_reg_operand") |
| 969 |
(match_operand:VIshort 1 "altivec_register_operand")] |
| 970 |
"TARGET_POWER10" |
| 971 |
{ |
| 972 |
rtx scratch = gen_reg_rtx (<MODE>mode); |
| 973 |
if (BYTES_BIG_ENDIAN) |
| 974 |
emit_insn (gen_vstril_p_direct_<mode> (scratch, operands[1])); |
| 975 |
else |
| 976 |
emit_insn (gen_vstrir_p_direct_<mode> (scratch, operands[1])); |
| 977 |
emit_insn (gen_cr6_test_for_zero (operands[0])); |
| 978 |
DONE; |
| 979 |
}) |
| 980 |
|
| 981 |
(define_insn "vstril_p_direct_<mode>" |
| 982 |
[(set (match_operand:VIshort 0 "altivec_register_operand" "=v") |
| 983 |
(unspec:VIshort |
| 984 |
[(match_operand:VIshort 1 "altivec_register_operand" "v")] |
| 985 |
UNSPEC_VSTRIL)) |
| 986 |
(set (reg:CC CR6_REGNO) |
| 987 |
(unspec:CC [(match_dup 1)] |
| 988 |
UNSPEC_VSTRIR))] |
| 989 |
"TARGET_POWER10" |
| 990 |
"vstri<wd>l. %0,%1" |
| 991 |
[(set_attr "type" "vecsimple")]) |
| 992 |
|
| 993 |
;; Fused multiply subtract |
| 994 |
(define_insn "*altivec_vnmsubfp" |
| 995 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 996 |
(neg:V4SF |
| 997 |
(fma:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 998 |
(match_operand:V4SF 2 "register_operand" "v") |
| 999 |
(neg:V4SF |
| 1000 |
(match_operand:V4SF 3 "register_operand" "v")))))] |
| 1001 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 1002 |
"vnmsubfp %0,%1,%2,%3" |
| 1003 |
[(set_attr "type" "vecfloat")]) |
| 1004 |
|
| 1005 |
(define_insn "altivec_vmsumu<VI_char>m" |
| 1006 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1007 |
(unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v") |
| 1008 |
(match_operand:VIshort 2 "register_operand" "v") |
| 1009 |
(match_operand:V4SI 3 "register_operand" "v")] |
| 1010 |
UNSPEC_VMSUMU))] |
| 1011 |
"TARGET_ALTIVEC" |
| 1012 |
"vmsumu<VI_char>m %0,%1,%2,%3" |
| 1013 |
[(set_attr "type" "veccomplex")]) |
| 1014 |
|
| 1015 |
(define_insn "altivec_vmsumudm" |
| 1016 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 1017 |
(unspec:V1TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1018 |
(match_operand:V2DI 2 "register_operand" "v") |
| 1019 |
(match_operand:V1TI 3 "register_operand" "v")] |
| 1020 |
UNSPEC_VMSUMUDM))] |
| 1021 |
"TARGET_P8_VECTOR" |
| 1022 |
"vmsumudm %0,%1,%2,%3" |
| 1023 |
[(set_attr "type" "veccomplex")]) |
| 1024 |
|
| 1025 |
(define_insn "altivec_vmsumm<VI_char>m" |
| 1026 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1027 |
(unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v") |
| 1028 |
(match_operand:VIshort 2 "register_operand" "v") |
| 1029 |
(match_operand:V4SI 3 "register_operand" "v")] |
| 1030 |
UNSPEC_VMSUMM))] |
| 1031 |
"TARGET_ALTIVEC" |
| 1032 |
"vmsumm<VI_char>m %0,%1,%2,%3" |
| 1033 |
[(set_attr "type" "veccomplex")]) |
| 1034 |
|
| 1035 |
(define_insn "altivec_vmsumshm" |
| 1036 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1037 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1038 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1039 |
(match_operand:V4SI 3 "register_operand" "v")] |
| 1040 |
UNSPEC_VMSUMSHM))] |
| 1041 |
"TARGET_ALTIVEC" |
| 1042 |
"vmsumshm %0,%1,%2,%3" |
| 1043 |
[(set_attr "type" "veccomplex")]) |
| 1044 |
|
| 1045 |
(define_insn "altivec_vmsumuhs" |
| 1046 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1047 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1048 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1049 |
(match_operand:V4SI 3 "register_operand" "v")] |
| 1050 |
UNSPEC_VMSUMUHS)) |
| 1051 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 1052 |
"TARGET_ALTIVEC" |
| 1053 |
"vmsumuhs %0,%1,%2,%3" |
| 1054 |
[(set_attr "type" "veccomplex")]) |
| 1055 |
|
| 1056 |
(define_insn "altivec_vmsumshs" |
| 1057 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1058 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1059 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1060 |
(match_operand:V4SI 3 "register_operand" "v")] |
| 1061 |
UNSPEC_VMSUMSHS)) |
| 1062 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 1063 |
"TARGET_ALTIVEC" |
| 1064 |
"vmsumshs %0,%1,%2,%3" |
| 1065 |
[(set_attr "type" "veccomplex")]) |
| 1066 |
|
| 1067 |
;; max |
| 1068 |
|
| 1069 |
(define_insn "umax<mode>3" |
| 1070 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 1071 |
(umax:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 1072 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 1073 |
"<VI_unit>" |
| 1074 |
"vmaxu<VI_char> %0,%1,%2" |
| 1075 |
[(set_attr "type" "vecsimple")]) |
| 1076 |
|
| 1077 |
(define_insn "smax<mode>3" |
| 1078 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 1079 |
(smax:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 1080 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 1081 |
"<VI_unit>" |
| 1082 |
"vmaxs<VI_char> %0,%1,%2" |
| 1083 |
[(set_attr "type" "vecsimple")]) |
| 1084 |
|
| 1085 |
(define_insn "*altivec_smaxv4sf3" |
| 1086 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 1087 |
(smax:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 1088 |
(match_operand:V4SF 2 "register_operand" "v")))] |
| 1089 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 1090 |
"vmaxfp %0,%1,%2" |
| 1091 |
[(set_attr "type" "veccmp")]) |
| 1092 |
|
| 1093 |
(define_insn "umin<mode>3" |
| 1094 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 1095 |
(umin:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 1096 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 1097 |
"<VI_unit>" |
| 1098 |
"vminu<VI_char> %0,%1,%2" |
| 1099 |
[(set_attr "type" "vecsimple")]) |
| 1100 |
|
| 1101 |
(define_insn "smin<mode>3" |
| 1102 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 1103 |
(smin:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 1104 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 1105 |
"<VI_unit>" |
| 1106 |
"vmins<VI_char> %0,%1,%2" |
| 1107 |
[(set_attr "type" "vecsimple")]) |
| 1108 |
|
| 1109 |
(define_insn "*altivec_sminv4sf3" |
| 1110 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 1111 |
(smin:V4SF (match_operand:V4SF 1 "register_operand" "v") |
| 1112 |
(match_operand:V4SF 2 "register_operand" "v")))] |
| 1113 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 1114 |
"vminfp %0,%1,%2" |
| 1115 |
[(set_attr "type" "veccmp")]) |
| 1116 |
|
| 1117 |
(define_insn "altivec_vmhaddshs" |
| 1118 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1119 |
(unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") |
| 1120 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1121 |
(match_operand:V8HI 3 "register_operand" "v")] |
| 1122 |
UNSPEC_VMHADDSHS)) |
| 1123 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 1124 |
"TARGET_ALTIVEC" |
| 1125 |
"vmhaddshs %0,%1,%2,%3" |
| 1126 |
[(set_attr "type" "veccomplex")]) |
| 1127 |
|
| 1128 |
(define_insn "altivec_vmhraddshs" |
| 1129 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1130 |
(unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") |
| 1131 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1132 |
(match_operand:V8HI 3 "register_operand" "v")] |
| 1133 |
UNSPEC_VMHRADDSHS)) |
| 1134 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 1135 |
"TARGET_ALTIVEC" |
| 1136 |
"vmhraddshs %0,%1,%2,%3" |
| 1137 |
[(set_attr "type" "veccomplex")]) |
| 1138 |
|
| 1139 |
(define_insn "fmav8hi4" |
| 1140 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1141 |
(plus:V8HI (mult:V8HI (match_operand:V8HI 1 "register_operand" "v") |
| 1142 |
(match_operand:V8HI 2 "register_operand" "v")) |
| 1143 |
(match_operand:V8HI 3 "register_operand" "v")))] |
| 1144 |
"TARGET_ALTIVEC" |
| 1145 |
"vmladduhm %0,%1,%2,%3" |
| 1146 |
[(set_attr "type" "veccomplex")]) |
| 1147 |
|
| 1148 |
(define_expand "altivec_vmrghb" |
| 1149 |
[(use (match_operand:V16QI 0 "register_operand")) |
| 1150 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1151 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1152 |
"TARGET_ALTIVEC" |
| 1153 |
{ |
| 1154 |
if (BYTES_BIG_ENDIAN) |
| 1155 |
emit_insn ( |
| 1156 |
gen_altivec_vmrghb_direct_be (operands[0], operands[1], operands[2])); |
| 1157 |
else |
| 1158 |
emit_insn ( |
| 1159 |
gen_altivec_vmrglb_direct_le (operands[0], operands[2], operands[1])); |
| 1160 |
DONE; |
| 1161 |
}) |
| 1162 |
|
| 1163 |
(define_insn "altivec_vmrghb_direct_be" |
| 1164 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1165 |
(vec_select:V16QI |
| 1166 |
(vec_concat:V32QI |
| 1167 |
(match_operand:V16QI 1 "register_operand" "v") |
| 1168 |
(match_operand:V16QI 2 "register_operand" "v")) |
| 1169 |
(parallel [(const_int 0) (const_int 16) |
| 1170 |
(const_int 1) (const_int 17) |
| 1171 |
(const_int 2) (const_int 18) |
| 1172 |
(const_int 3) (const_int 19) |
| 1173 |
(const_int 4) (const_int 20) |
| 1174 |
(const_int 5) (const_int 21) |
| 1175 |
(const_int 6) (const_int 22) |
| 1176 |
(const_int 7) (const_int 23)])))] |
| 1177 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1178 |
"vmrghb %0,%1,%2" |
| 1179 |
[(set_attr "type" "vecperm")]) |
| 1180 |
|
| 1181 |
(define_insn "altivec_vmrghb_direct_le" |
| 1182 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1183 |
(vec_select:V16QI |
| 1184 |
(vec_concat:V32QI |
| 1185 |
(match_operand:V16QI 2 "register_operand" "v") |
| 1186 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 1187 |
(parallel [(const_int 8) (const_int 24) |
| 1188 |
(const_int 9) (const_int 25) |
| 1189 |
(const_int 10) (const_int 26) |
| 1190 |
(const_int 11) (const_int 27) |
| 1191 |
(const_int 12) (const_int 28) |
| 1192 |
(const_int 13) (const_int 29) |
| 1193 |
(const_int 14) (const_int 30) |
| 1194 |
(const_int 15) (const_int 31)])))] |
| 1195 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1196 |
"vmrghb %0,%1,%2" |
| 1197 |
[(set_attr "type" "vecperm")]) |
| 1198 |
|
| 1199 |
(define_expand "altivec_vmrghh" |
| 1200 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1201 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1202 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1203 |
"TARGET_ALTIVEC" |
| 1204 |
{ |
| 1205 |
if (BYTES_BIG_ENDIAN) |
| 1206 |
emit_insn ( |
| 1207 |
gen_altivec_vmrghh_direct_be (operands[0], operands[1], operands[2])); |
| 1208 |
else |
| 1209 |
emit_insn ( |
| 1210 |
gen_altivec_vmrglh_direct_le (operands[0], operands[2], operands[1])); |
| 1211 |
DONE; |
| 1212 |
}) |
| 1213 |
|
| 1214 |
(define_insn "altivec_vmrghh_direct_be" |
| 1215 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1216 |
(vec_select:V8HI |
| 1217 |
(vec_concat:V16HI |
| 1218 |
(match_operand:V8HI 1 "register_operand" "v") |
| 1219 |
(match_operand:V8HI 2 "register_operand" "v")) |
| 1220 |
(parallel [(const_int 0) (const_int 8) |
| 1221 |
(const_int 1) (const_int 9) |
| 1222 |
(const_int 2) (const_int 10) |
| 1223 |
(const_int 3) (const_int 11)])))] |
| 1224 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1225 |
"vmrghh %0,%1,%2" |
| 1226 |
[(set_attr "type" "vecperm")]) |
| 1227 |
|
| 1228 |
(define_insn "altivec_vmrghh_direct_le" |
| 1229 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1230 |
(vec_select:V8HI |
| 1231 |
(vec_concat:V16HI |
| 1232 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1233 |
(match_operand:V8HI 1 "register_operand" "v")) |
| 1234 |
(parallel [(const_int 4) (const_int 12) |
| 1235 |
(const_int 5) (const_int 13) |
| 1236 |
(const_int 6) (const_int 14) |
| 1237 |
(const_int 7) (const_int 15)])))] |
| 1238 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1239 |
"vmrghh %0,%1,%2" |
| 1240 |
[(set_attr "type" "vecperm")]) |
| 1241 |
|
| 1242 |
(define_expand "altivec_vmrghw" |
| 1243 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1244 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1245 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1246 |
"VECTOR_MEM_ALTIVEC_P (V4SImode)" |
| 1247 |
{ |
| 1248 |
if (BYTES_BIG_ENDIAN) |
| 1249 |
emit_insn (gen_altivec_vmrghw_direct_v4si_be (operands[0], |
| 1250 |
operands[1], |
| 1251 |
operands[2])); |
| 1252 |
else |
| 1253 |
emit_insn (gen_altivec_vmrglw_direct_v4si_le (operands[0], |
| 1254 |
operands[2], |
| 1255 |
operands[1])); |
| 1256 |
DONE; |
| 1257 |
}) |
| 1258 |
|
| 1259 |
(define_insn "altivec_vmrghw_direct_<mode>_be" |
| 1260 |
[(set (match_operand:VSX_W 0 "register_operand" "=wa,v") |
| 1261 |
(vec_select:VSX_W |
| 1262 |
(vec_concat:<VS_double> |
| 1263 |
(match_operand:VSX_W 1 "register_operand" "wa,v") |
| 1264 |
(match_operand:VSX_W 2 "register_operand" "wa,v")) |
| 1265 |
(parallel [(const_int 0) (const_int 4) |
| 1266 |
(const_int 1) (const_int 5)])))] |
| 1267 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1268 |
"@ |
| 1269 |
xxmrghw %x0,%x1,%x2 |
| 1270 |
vmrghw %0,%1,%2" |
| 1271 |
[(set_attr "type" "vecperm")]) |
| 1272 |
|
| 1273 |
(define_insn "altivec_vmrghw_direct_<mode>_le" |
| 1274 |
[(set (match_operand:VSX_W 0 "register_operand" "=wa,v") |
| 1275 |
(vec_select:VSX_W |
| 1276 |
(vec_concat:<VS_double> |
| 1277 |
(match_operand:VSX_W 2 "register_operand" "wa,v") |
| 1278 |
(match_operand:VSX_W 1 "register_operand" "wa,v")) |
| 1279 |
(parallel [(const_int 2) (const_int 6) |
| 1280 |
(const_int 3) (const_int 7)])))] |
| 1281 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1282 |
"@ |
| 1283 |
xxmrghw %x0,%x1,%x2 |
| 1284 |
vmrghw %0,%1,%2" |
| 1285 |
[(set_attr "type" "vecperm")]) |
| 1286 |
|
| 1287 |
(define_insn "*altivec_vmrghsf" |
| 1288 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 1289 |
(vec_select:V4SF |
| 1290 |
(vec_concat:V8SF |
| 1291 |
(match_operand:V4SF 1 "register_operand" "v") |
| 1292 |
(match_operand:V4SF 2 "register_operand" "v")) |
| 1293 |
(parallel [(const_int 0) (const_int 4) |
| 1294 |
(const_int 1) (const_int 5)])))] |
| 1295 |
"VECTOR_MEM_ALTIVEC_P (V4SFmode)" |
| 1296 |
{ |
| 1297 |
if (BYTES_BIG_ENDIAN) |
| 1298 |
return "vmrghw %0,%1,%2"; |
| 1299 |
else |
| 1300 |
return "vmrglw %0,%2,%1"; |
| 1301 |
} |
| 1302 |
[(set_attr "type" "vecperm")]) |
| 1303 |
|
| 1304 |
(define_expand "altivec_vmrglb" |
| 1305 |
[(use (match_operand:V16QI 0 "register_operand")) |
| 1306 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1307 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1308 |
"TARGET_ALTIVEC" |
| 1309 |
{ |
| 1310 |
if (BYTES_BIG_ENDIAN) |
| 1311 |
emit_insn ( |
| 1312 |
gen_altivec_vmrglb_direct_be (operands[0], operands[1], operands[2])); |
| 1313 |
else |
| 1314 |
emit_insn ( |
| 1315 |
gen_altivec_vmrghb_direct_le (operands[0], operands[2], operands[1])); |
| 1316 |
DONE; |
| 1317 |
}) |
| 1318 |
|
| 1319 |
(define_insn "altivec_vmrglb_direct_be" |
| 1320 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1321 |
(vec_select:V16QI |
| 1322 |
(vec_concat:V32QI |
| 1323 |
(match_operand:V16QI 1 "register_operand" "v") |
| 1324 |
(match_operand:V16QI 2 "register_operand" "v")) |
| 1325 |
(parallel [(const_int 8) (const_int 24) |
| 1326 |
(const_int 9) (const_int 25) |
| 1327 |
(const_int 10) (const_int 26) |
| 1328 |
(const_int 11) (const_int 27) |
| 1329 |
(const_int 12) (const_int 28) |
| 1330 |
(const_int 13) (const_int 29) |
| 1331 |
(const_int 14) (const_int 30) |
| 1332 |
(const_int 15) (const_int 31)])))] |
| 1333 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1334 |
"vmrglb %0,%1,%2" |
| 1335 |
[(set_attr "type" "vecperm")]) |
| 1336 |
|
| 1337 |
(define_insn "altivec_vmrglb_direct_le" |
| 1338 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1339 |
(vec_select:V16QI |
| 1340 |
(vec_concat:V32QI |
| 1341 |
(match_operand:V16QI 2 "register_operand" "v") |
| 1342 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 1343 |
(parallel [(const_int 0) (const_int 16) |
| 1344 |
(const_int 1) (const_int 17) |
| 1345 |
(const_int 2) (const_int 18) |
| 1346 |
(const_int 3) (const_int 19) |
| 1347 |
(const_int 4) (const_int 20) |
| 1348 |
(const_int 5) (const_int 21) |
| 1349 |
(const_int 6) (const_int 22) |
| 1350 |
(const_int 7) (const_int 23)])))] |
| 1351 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1352 |
"vmrglb %0,%1,%2" |
| 1353 |
[(set_attr "type" "vecperm")]) |
| 1354 |
|
| 1355 |
(define_expand "altivec_vmrglh" |
| 1356 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1357 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1358 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1359 |
"TARGET_ALTIVEC" |
| 1360 |
{ |
| 1361 |
if (BYTES_BIG_ENDIAN) |
| 1362 |
emit_insn ( |
| 1363 |
gen_altivec_vmrglh_direct_be (operands[0], operands[1], operands[2])); |
| 1364 |
else |
| 1365 |
emit_insn ( |
| 1366 |
gen_altivec_vmrghh_direct_le (operands[0], operands[2], operands[1])); |
| 1367 |
DONE; |
| 1368 |
}) |
| 1369 |
|
| 1370 |
(define_insn "altivec_vmrglh_direct_be" |
| 1371 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1372 |
(vec_select:V8HI |
| 1373 |
(vec_concat:V16HI |
| 1374 |
(match_operand:V8HI 1 "register_operand" "v") |
| 1375 |
(match_operand:V8HI 2 "register_operand" "v")) |
| 1376 |
(parallel [(const_int 4) (const_int 12) |
| 1377 |
(const_int 5) (const_int 13) |
| 1378 |
(const_int 6) (const_int 14) |
| 1379 |
(const_int 7) (const_int 15)])))] |
| 1380 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1381 |
"vmrglh %0,%1,%2" |
| 1382 |
[(set_attr "type" "vecperm")]) |
| 1383 |
|
| 1384 |
(define_insn "altivec_vmrglh_direct_le" |
| 1385 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1386 |
(vec_select:V8HI |
| 1387 |
(vec_concat:V16HI |
| 1388 |
(match_operand:V8HI 2 "register_operand" "v") |
| 1389 |
(match_operand:V8HI 1 "register_operand" "v")) |
| 1390 |
(parallel [(const_int 0) (const_int 8) |
| 1391 |
(const_int 1) (const_int 9) |
| 1392 |
(const_int 2) (const_int 10) |
| 1393 |
(const_int 3) (const_int 11)])))] |
| 1394 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1395 |
"vmrglh %0,%1,%2" |
| 1396 |
[(set_attr "type" "vecperm")]) |
| 1397 |
|
| 1398 |
(define_expand "altivec_vmrglw" |
| 1399 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1400 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1401 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1402 |
"VECTOR_MEM_ALTIVEC_P (V4SImode)" |
| 1403 |
{ |
| 1404 |
if (BYTES_BIG_ENDIAN) |
| 1405 |
emit_insn (gen_altivec_vmrglw_direct_v4si_be (operands[0], |
| 1406 |
operands[1], |
| 1407 |
operands[2])); |
| 1408 |
else |
| 1409 |
emit_insn (gen_altivec_vmrghw_direct_v4si_le (operands[0], |
| 1410 |
operands[2], |
| 1411 |
operands[1])); |
| 1412 |
DONE; |
| 1413 |
}) |
| 1414 |
|
| 1415 |
(define_insn "altivec_vmrglw_direct_<mode>_be" |
| 1416 |
[(set (match_operand:VSX_W 0 "register_operand" "=wa,v") |
| 1417 |
(vec_select:VSX_W |
| 1418 |
(vec_concat:<VS_double> |
| 1419 |
(match_operand:VSX_W 1 "register_operand" "wa,v") |
| 1420 |
(match_operand:VSX_W 2 "register_operand" "wa,v")) |
| 1421 |
(parallel [(const_int 2) (const_int 6) |
| 1422 |
(const_int 3) (const_int 7)])))] |
| 1423 |
"TARGET_ALTIVEC && BYTES_BIG_ENDIAN" |
| 1424 |
"@ |
| 1425 |
xxmrglw %x0,%x1,%x2 |
| 1426 |
vmrglw %0,%1,%2" |
| 1427 |
[(set_attr "type" "vecperm")]) |
| 1428 |
|
| 1429 |
(define_insn "altivec_vmrglw_direct_<mode>_le" |
| 1430 |
[(set (match_operand:VSX_W 0 "register_operand" "=wa,v") |
| 1431 |
(vec_select:VSX_W |
| 1432 |
(vec_concat:<VS_double> |
| 1433 |
(match_operand:VSX_W 2 "register_operand" "wa,v") |
| 1434 |
(match_operand:VSX_W 1 "register_operand" "wa,v")) |
| 1435 |
(parallel [(const_int 0) (const_int 4) |
| 1436 |
(const_int 1) (const_int 5)])))] |
| 1437 |
"TARGET_ALTIVEC && !BYTES_BIG_ENDIAN" |
| 1438 |
"@ |
| 1439 |
xxmrglw %x0,%x1,%x2 |
| 1440 |
vmrglw %0,%1,%2" |
| 1441 |
[(set_attr "type" "vecperm")]) |
| 1442 |
|
| 1443 |
(define_insn "*altivec_vmrglsf" |
| 1444 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 1445 |
(vec_select:V4SF |
| 1446 |
(vec_concat:V8SF |
| 1447 |
(match_operand:V4SF 1 "register_operand" "v") |
| 1448 |
(match_operand:V4SF 2 "register_operand" "v")) |
| 1449 |
(parallel [(const_int 2) (const_int 6) |
| 1450 |
(const_int 3) (const_int 7)])))] |
| 1451 |
"VECTOR_MEM_ALTIVEC_P (V4SFmode)" |
| 1452 |
{ |
| 1453 |
if (BYTES_BIG_ENDIAN) |
| 1454 |
return "vmrglw %0,%1,%2"; |
| 1455 |
else |
| 1456 |
return "vmrghw %0,%2,%1"; |
| 1457 |
} |
| 1458 |
[(set_attr "type" "vecperm")]) |
| 1459 |
|
| 1460 |
;; Power8 vector merge two V2DF/V2DI even words to V2DF |
| 1461 |
(define_expand "p8_vmrgew_<mode>" |
| 1462 |
[(use (match_operand:VSX_D 0 "vsx_register_operand")) |
| 1463 |
(use (match_operand:VSX_D 1 "vsx_register_operand")) |
| 1464 |
(use (match_operand:VSX_D 2 "vsx_register_operand"))] |
| 1465 |
"VECTOR_MEM_VSX_P (<MODE>mode)" |
| 1466 |
{ |
| 1467 |
rtvec v; |
| 1468 |
rtx x; |
| 1469 |
|
| 1470 |
v = gen_rtvec (2, GEN_INT (0), GEN_INT (2)); |
| 1471 |
x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[1], operands[2]); |
| 1472 |
|
| 1473 |
x = gen_rtx_VEC_SELECT (<MODE>mode, x, gen_rtx_PARALLEL (VOIDmode, v)); |
| 1474 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 1475 |
DONE; |
| 1476 |
}) |
| 1477 |
|
| 1478 |
;; Power8 vector merge two V4SF/V4SI even words to V4SF |
| 1479 |
(define_insn "p8_vmrgew_<mode>" |
| 1480 |
[(set (match_operand:VSX_W 0 "register_operand" "=v") |
| 1481 |
(vec_select:VSX_W |
| 1482 |
(vec_concat:<VS_double> |
| 1483 |
(match_operand:VSX_W 1 "register_operand" "v") |
| 1484 |
(match_operand:VSX_W 2 "register_operand" "v")) |
| 1485 |
(parallel [(const_int 0) (const_int 4) |
| 1486 |
(const_int 2) (const_int 6)])))] |
| 1487 |
"TARGET_P8_VECTOR" |
| 1488 |
{ |
| 1489 |
if (BYTES_BIG_ENDIAN) |
| 1490 |
return "vmrgew %0,%1,%2"; |
| 1491 |
else |
| 1492 |
return "vmrgow %0,%2,%1"; |
| 1493 |
} |
| 1494 |
[(set_attr "type" "vecperm")]) |
| 1495 |
|
| 1496 |
(define_insn "p8_vmrgow_<mode>" |
| 1497 |
[(set (match_operand:VSX_W 0 "register_operand" "=v") |
| 1498 |
(vec_select:VSX_W |
| 1499 |
(vec_concat:<VS_double> |
| 1500 |
(match_operand:VSX_W 1 "register_operand" "v") |
| 1501 |
(match_operand:VSX_W 2 "register_operand" "v")) |
| 1502 |
(parallel [(const_int 1) (const_int 5) |
| 1503 |
(const_int 3) (const_int 7)])))] |
| 1504 |
"TARGET_P8_VECTOR" |
| 1505 |
{ |
| 1506 |
if (BYTES_BIG_ENDIAN) |
| 1507 |
return "vmrgow %0,%1,%2"; |
| 1508 |
else |
| 1509 |
return "vmrgew %0,%2,%1"; |
| 1510 |
} |
| 1511 |
[(set_attr "type" "vecperm")]) |
| 1512 |
|
| 1513 |
(define_expand "p8_vmrgow_<mode>" |
| 1514 |
[(use (match_operand:VSX_D 0 "vsx_register_operand")) |
| 1515 |
(use (match_operand:VSX_D 1 "vsx_register_operand")) |
| 1516 |
(use (match_operand:VSX_D 2 "vsx_register_operand"))] |
| 1517 |
"VECTOR_MEM_VSX_P (<MODE>mode)" |
| 1518 |
{ |
| 1519 |
rtvec v; |
| 1520 |
rtx x; |
| 1521 |
|
| 1522 |
v = gen_rtvec (2, GEN_INT (1), GEN_INT (3)); |
| 1523 |
x = gen_rtx_VEC_CONCAT (<VS_double>mode, operands[1], operands[2]); |
| 1524 |
|
| 1525 |
x = gen_rtx_VEC_SELECT (<MODE>mode, x, gen_rtx_PARALLEL (VOIDmode, v)); |
| 1526 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 1527 |
DONE; |
| 1528 |
}) |
| 1529 |
|
| 1530 |
(define_insn "p8_vmrgew_<mode>_direct" |
| 1531 |
[(set (match_operand:VSX_W 0 "register_operand" "=v") |
| 1532 |
(unspec:VSX_W [(match_operand:VSX_W 1 "register_operand" "v") |
| 1533 |
(match_operand:VSX_W 2 "register_operand" "v")] |
| 1534 |
UNSPEC_VMRGEW_DIRECT))] |
| 1535 |
"TARGET_P8_VECTOR" |
| 1536 |
"vmrgew %0,%1,%2" |
| 1537 |
[(set_attr "type" "vecperm")]) |
| 1538 |
|
| 1539 |
(define_insn "p8_vmrgow_<mode>_direct" |
| 1540 |
[(set (match_operand:VSX_W 0 "register_operand" "=v") |
| 1541 |
(unspec:VSX_W [(match_operand:VSX_W 1 "register_operand" "v") |
| 1542 |
(match_operand:VSX_W 2 "register_operand" "v")] |
| 1543 |
UNSPEC_VMRGOW_DIRECT))] |
| 1544 |
"TARGET_P8_VECTOR" |
| 1545 |
"vmrgow %0,%1,%2" |
| 1546 |
[(set_attr "type" "vecperm")]) |
| 1547 |
|
| 1548 |
(define_expand "vec_widen_umult_even_v16qi" |
| 1549 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1550 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1551 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1552 |
"TARGET_ALTIVEC" |
| 1553 |
{ |
| 1554 |
if (BYTES_BIG_ENDIAN) |
| 1555 |
emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2])); |
| 1556 |
else |
| 1557 |
emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2])); |
| 1558 |
DONE; |
| 1559 |
}) |
| 1560 |
|
| 1561 |
(define_expand "vec_widen_smult_even_v16qi" |
| 1562 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1563 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1564 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1565 |
"TARGET_ALTIVEC" |
| 1566 |
{ |
| 1567 |
if (BYTES_BIG_ENDIAN) |
| 1568 |
emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2])); |
| 1569 |
else |
| 1570 |
emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2])); |
| 1571 |
DONE; |
| 1572 |
}) |
| 1573 |
|
| 1574 |
(define_expand "vec_widen_umult_even_v8hi" |
| 1575 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1576 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1577 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1578 |
"TARGET_ALTIVEC" |
| 1579 |
{ |
| 1580 |
if (BYTES_BIG_ENDIAN) |
| 1581 |
emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2])); |
| 1582 |
else |
| 1583 |
emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2])); |
| 1584 |
DONE; |
| 1585 |
}) |
| 1586 |
|
| 1587 |
(define_expand "vec_widen_smult_even_v8hi" |
| 1588 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1589 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1590 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1591 |
"TARGET_ALTIVEC" |
| 1592 |
{ |
| 1593 |
if (BYTES_BIG_ENDIAN) |
| 1594 |
emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2])); |
| 1595 |
else |
| 1596 |
emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2])); |
| 1597 |
DONE; |
| 1598 |
}) |
| 1599 |
|
| 1600 |
(define_expand "vec_widen_umult_even_v4si" |
| 1601 |
[(use (match_operand:V2DI 0 "register_operand")) |
| 1602 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1603 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1604 |
"TARGET_P8_VECTOR" |
| 1605 |
{ |
| 1606 |
if (BYTES_BIG_ENDIAN) |
| 1607 |
emit_insn (gen_altivec_vmuleuw (operands[0], operands[1], operands[2])); |
| 1608 |
else |
| 1609 |
emit_insn (gen_altivec_vmulouw (operands[0], operands[1], operands[2])); |
| 1610 |
DONE; |
| 1611 |
}) |
| 1612 |
|
| 1613 |
(define_expand "vec_widen_umult_even_v2di" |
| 1614 |
[(use (match_operand:V1TI 0 "register_operand")) |
| 1615 |
(use (match_operand:V2DI 1 "register_operand")) |
| 1616 |
(use (match_operand:V2DI 2 "register_operand"))] |
| 1617 |
"TARGET_POWER10" |
| 1618 |
{ |
| 1619 |
if (BYTES_BIG_ENDIAN) |
| 1620 |
emit_insn (gen_altivec_vmuleud (operands[0], operands[1], operands[2])); |
| 1621 |
else |
| 1622 |
emit_insn (gen_altivec_vmuloud (operands[0], operands[1], operands[2])); |
| 1623 |
DONE; |
| 1624 |
}) |
| 1625 |
|
| 1626 |
(define_expand "vec_widen_smult_even_v4si" |
| 1627 |
[(use (match_operand:V2DI 0 "register_operand")) |
| 1628 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1629 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1630 |
"TARGET_P8_VECTOR" |
| 1631 |
{ |
| 1632 |
if (BYTES_BIG_ENDIAN) |
| 1633 |
emit_insn (gen_altivec_vmulesw (operands[0], operands[1], operands[2])); |
| 1634 |
else |
| 1635 |
emit_insn (gen_altivec_vmulosw (operands[0], operands[1], operands[2])); |
| 1636 |
DONE; |
| 1637 |
}) |
| 1638 |
|
| 1639 |
(define_expand "vec_widen_smult_even_v2di" |
| 1640 |
[(use (match_operand:V1TI 0 "register_operand")) |
| 1641 |
(use (match_operand:V2DI 1 "register_operand")) |
| 1642 |
(use (match_operand:V2DI 2 "register_operand"))] |
| 1643 |
"TARGET_POWER10" |
| 1644 |
{ |
| 1645 |
if (BYTES_BIG_ENDIAN) |
| 1646 |
emit_insn (gen_altivec_vmulesd (operands[0], operands[1], operands[2])); |
| 1647 |
else |
| 1648 |
emit_insn (gen_altivec_vmulosd (operands[0], operands[1], operands[2])); |
| 1649 |
DONE; |
| 1650 |
}) |
| 1651 |
|
| 1652 |
(define_expand "vec_widen_umult_odd_v16qi" |
| 1653 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1654 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1655 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1656 |
"TARGET_ALTIVEC" |
| 1657 |
{ |
| 1658 |
if (BYTES_BIG_ENDIAN) |
| 1659 |
emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2])); |
| 1660 |
else |
| 1661 |
emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2])); |
| 1662 |
DONE; |
| 1663 |
}) |
| 1664 |
|
| 1665 |
(define_expand "vec_widen_smult_odd_v16qi" |
| 1666 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 1667 |
(use (match_operand:V16QI 1 "register_operand")) |
| 1668 |
(use (match_operand:V16QI 2 "register_operand"))] |
| 1669 |
"TARGET_ALTIVEC" |
| 1670 |
{ |
| 1671 |
if (BYTES_BIG_ENDIAN) |
| 1672 |
emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2])); |
| 1673 |
else |
| 1674 |
emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2])); |
| 1675 |
DONE; |
| 1676 |
}) |
| 1677 |
|
| 1678 |
(define_expand "vec_widen_umult_odd_v8hi" |
| 1679 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1680 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1681 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1682 |
"TARGET_ALTIVEC" |
| 1683 |
{ |
| 1684 |
if (BYTES_BIG_ENDIAN) |
| 1685 |
emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2])); |
| 1686 |
else |
| 1687 |
emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2])); |
| 1688 |
DONE; |
| 1689 |
}) |
| 1690 |
|
| 1691 |
(define_expand "vec_widen_smult_odd_v8hi" |
| 1692 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 1693 |
(use (match_operand:V8HI 1 "register_operand")) |
| 1694 |
(use (match_operand:V8HI 2 "register_operand"))] |
| 1695 |
"TARGET_ALTIVEC" |
| 1696 |
{ |
| 1697 |
if (BYTES_BIG_ENDIAN) |
| 1698 |
emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2])); |
| 1699 |
else |
| 1700 |
emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2])); |
| 1701 |
DONE; |
| 1702 |
}) |
| 1703 |
|
| 1704 |
(define_expand "vec_widen_umult_odd_v4si" |
| 1705 |
[(use (match_operand:V2DI 0 "register_operand")) |
| 1706 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1707 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1708 |
"TARGET_P8_VECTOR" |
| 1709 |
{ |
| 1710 |
if (BYTES_BIG_ENDIAN) |
| 1711 |
emit_insn (gen_altivec_vmulouw (operands[0], operands[1], operands[2])); |
| 1712 |
else |
| 1713 |
emit_insn (gen_altivec_vmuleuw (operands[0], operands[1], operands[2])); |
| 1714 |
DONE; |
| 1715 |
}) |
| 1716 |
|
| 1717 |
(define_expand "vec_widen_umult_odd_v2di" |
| 1718 |
[(use (match_operand:V1TI 0 "register_operand")) |
| 1719 |
(use (match_operand:V2DI 1 "register_operand")) |
| 1720 |
(use (match_operand:V2DI 2 "register_operand"))] |
| 1721 |
"TARGET_POWER10" |
| 1722 |
{ |
| 1723 |
if (BYTES_BIG_ENDIAN) |
| 1724 |
emit_insn (gen_altivec_vmuloud (operands[0], operands[1], operands[2])); |
| 1725 |
else |
| 1726 |
emit_insn (gen_altivec_vmuleud (operands[0], operands[1], operands[2])); |
| 1727 |
DONE; |
| 1728 |
}) |
| 1729 |
|
| 1730 |
(define_expand "vec_widen_smult_odd_v4si" |
| 1731 |
[(use (match_operand:V2DI 0 "register_operand")) |
| 1732 |
(use (match_operand:V4SI 1 "register_operand")) |
| 1733 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 1734 |
"TARGET_P8_VECTOR" |
| 1735 |
{ |
| 1736 |
if (BYTES_BIG_ENDIAN) |
| 1737 |
emit_insn (gen_altivec_vmulosw (operands[0], operands[1], operands[2])); |
| 1738 |
else |
| 1739 |
emit_insn (gen_altivec_vmulesw (operands[0], operands[1], operands[2])); |
| 1740 |
DONE; |
| 1741 |
}) |
| 1742 |
|
| 1743 |
(define_expand "vec_widen_smult_odd_v2di" |
| 1744 |
[(use (match_operand:V1TI 0 "register_operand")) |
| 1745 |
(use (match_operand:V2DI 1 "register_operand")) |
| 1746 |
(use (match_operand:V2DI 2 "register_operand"))] |
| 1747 |
"TARGET_POWER10" |
| 1748 |
{ |
| 1749 |
if (BYTES_BIG_ENDIAN) |
| 1750 |
emit_insn (gen_altivec_vmulosd (operands[0], operands[1], operands[2])); |
| 1751 |
else |
| 1752 |
emit_insn (gen_altivec_vmulesd (operands[0], operands[1], operands[2])); |
| 1753 |
DONE; |
| 1754 |
}) |
| 1755 |
|
| 1756 |
(define_insn "altivec_vmuleub" |
| 1757 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1758 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 1759 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 1760 |
UNSPEC_VMULEUB))] |
| 1761 |
"TARGET_ALTIVEC" |
| 1762 |
"vmuleub %0,%1,%2" |
| 1763 |
[(set_attr "type" "veccomplex")]) |
| 1764 |
|
| 1765 |
(define_insn "altivec_vmuloub" |
| 1766 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1767 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 1768 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 1769 |
UNSPEC_VMULOUB))] |
| 1770 |
"TARGET_ALTIVEC" |
| 1771 |
"vmuloub %0,%1,%2" |
| 1772 |
[(set_attr "type" "veccomplex")]) |
| 1773 |
|
| 1774 |
(define_insn "altivec_vmulesb" |
| 1775 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1776 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 1777 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 1778 |
UNSPEC_VMULESB))] |
| 1779 |
"TARGET_ALTIVEC" |
| 1780 |
"vmulesb %0,%1,%2" |
| 1781 |
[(set_attr "type" "veccomplex")]) |
| 1782 |
|
| 1783 |
(define_insn "altivec_vmulosb" |
| 1784 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1785 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 1786 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 1787 |
UNSPEC_VMULOSB))] |
| 1788 |
"TARGET_ALTIVEC" |
| 1789 |
"vmulosb %0,%1,%2" |
| 1790 |
[(set_attr "type" "veccomplex")]) |
| 1791 |
|
| 1792 |
(define_insn "altivec_vmuleuh" |
| 1793 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1794 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1795 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 1796 |
UNSPEC_VMULEUH))] |
| 1797 |
"TARGET_ALTIVEC" |
| 1798 |
"vmuleuh %0,%1,%2" |
| 1799 |
[(set_attr "type" "veccomplex")]) |
| 1800 |
|
| 1801 |
(define_insn "altivec_vmulouh" |
| 1802 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1803 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1804 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 1805 |
UNSPEC_VMULOUH))] |
| 1806 |
"TARGET_ALTIVEC" |
| 1807 |
"vmulouh %0,%1,%2" |
| 1808 |
[(set_attr "type" "veccomplex")]) |
| 1809 |
|
| 1810 |
(define_insn "altivec_vmulesh" |
| 1811 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1812 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1813 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 1814 |
UNSPEC_VMULESH))] |
| 1815 |
"TARGET_ALTIVEC" |
| 1816 |
"vmulesh %0,%1,%2" |
| 1817 |
[(set_attr "type" "veccomplex")]) |
| 1818 |
|
| 1819 |
(define_insn "altivec_vmulosh" |
| 1820 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 1821 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 1822 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 1823 |
UNSPEC_VMULOSH))] |
| 1824 |
"TARGET_ALTIVEC" |
| 1825 |
"vmulosh %0,%1,%2" |
| 1826 |
[(set_attr "type" "veccomplex")]) |
| 1827 |
|
| 1828 |
(define_insn "altivec_vmuleuw" |
| 1829 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1830 |
(unspec:V2DI [(match_operand:V4SI 1 "register_operand" "v") |
| 1831 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 1832 |
UNSPEC_VMULEUW))] |
| 1833 |
"TARGET_P8_VECTOR" |
| 1834 |
"vmuleuw %0,%1,%2" |
| 1835 |
[(set_attr "type" "veccomplex")]) |
| 1836 |
|
| 1837 |
(define_insn "altivec_vmuleud" |
| 1838 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 1839 |
(unspec:V1TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1840 |
(match_operand:V2DI 2 "register_operand" "v")] |
| 1841 |
UNSPEC_VMULEUD))] |
| 1842 |
"TARGET_POWER10" |
| 1843 |
"vmuleud %0,%1,%2" |
| 1844 |
[(set_attr "type" "veccomplex")]) |
| 1845 |
|
| 1846 |
(define_insn "altivec_vmulouw" |
| 1847 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1848 |
(unspec:V2DI [(match_operand:V4SI 1 "register_operand" "v") |
| 1849 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 1850 |
UNSPEC_VMULOUW))] |
| 1851 |
"TARGET_P8_VECTOR" |
| 1852 |
"vmulouw %0,%1,%2" |
| 1853 |
[(set_attr "type" "veccomplex")]) |
| 1854 |
|
| 1855 |
(define_insn "altivec_vmuloud" |
| 1856 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 1857 |
(unspec:V1TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1858 |
(match_operand:V2DI 2 "register_operand" "v")] |
| 1859 |
UNSPEC_VMULOUD))] |
| 1860 |
"TARGET_POWER10" |
| 1861 |
"vmuloud %0,%1,%2" |
| 1862 |
[(set_attr "type" "veccomplex")]) |
| 1863 |
|
| 1864 |
(define_insn "altivec_vmulesw" |
| 1865 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1866 |
(unspec:V2DI [(match_operand:V4SI 1 "register_operand" "v") |
| 1867 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 1868 |
UNSPEC_VMULESW))] |
| 1869 |
"TARGET_P8_VECTOR" |
| 1870 |
"vmulesw %0,%1,%2" |
| 1871 |
[(set_attr "type" "veccomplex")]) |
| 1872 |
|
| 1873 |
(define_insn "altivec_vmulesd" |
| 1874 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 1875 |
(unspec:V1TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1876 |
(match_operand:V2DI 2 "register_operand" "v")] |
| 1877 |
UNSPEC_VMULESD))] |
| 1878 |
"TARGET_POWER10" |
| 1879 |
"vmulesd %0,%1,%2" |
| 1880 |
[(set_attr "type" "veccomplex")]) |
| 1881 |
|
| 1882 |
(define_insn "altivec_vmulosw" |
| 1883 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1884 |
(unspec:V2DI [(match_operand:V4SI 1 "register_operand" "v") |
| 1885 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 1886 |
UNSPEC_VMULOSW))] |
| 1887 |
"TARGET_P8_VECTOR" |
| 1888 |
"vmulosw %0,%1,%2" |
| 1889 |
[(set_attr "type" "veccomplex")]) |
| 1890 |
|
| 1891 |
(define_insn "altivec_vmulosd" |
| 1892 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 1893 |
(unspec:V1TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1894 |
(match_operand:V2DI 2 "register_operand" "v")] |
| 1895 |
UNSPEC_VMULOSD))] |
| 1896 |
"TARGET_POWER10" |
| 1897 |
"vmulosd %0,%1,%2" |
| 1898 |
[(set_attr "type" "veccomplex")]) |
| 1899 |
|
| 1900 |
;; Vector pack/unpack |
| 1901 |
(define_insn "altivec_vpkpx" |
| 1902 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 1903 |
(unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v") |
| 1904 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 1905 |
UNSPEC_VPKPX))] |
| 1906 |
"TARGET_ALTIVEC" |
| 1907 |
{ |
| 1908 |
if (BYTES_BIG_ENDIAN) |
| 1909 |
return "vpkpx %0,%1,%2"; |
| 1910 |
else |
| 1911 |
return "vpkpx %0,%2,%1"; |
| 1912 |
} |
| 1913 |
[(set_attr "type" "vecperm")]) |
| 1914 |
|
| 1915 |
(define_insn "altivec_vpks<VI_char>ss" |
| 1916 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 1917 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 1918 |
(match_operand:VP 2 "register_operand" "v")] |
| 1919 |
UNSPEC_VPACK_SIGN_SIGN_SAT))] |
| 1920 |
"<VI_unit>" |
| 1921 |
{ |
| 1922 |
if (BYTES_BIG_ENDIAN) |
| 1923 |
return "vpks<VI_char>ss %0,%1,%2"; |
| 1924 |
else |
| 1925 |
return "vpks<VI_char>ss %0,%2,%1"; |
| 1926 |
} |
| 1927 |
[(set_attr "type" "vecperm")]) |
| 1928 |
|
| 1929 |
(define_insn "altivec_vpks<VI_char>us" |
| 1930 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 1931 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 1932 |
(match_operand:VP 2 "register_operand" "v")] |
| 1933 |
UNSPEC_VPACK_SIGN_UNS_SAT))] |
| 1934 |
"<VI_unit>" |
| 1935 |
{ |
| 1936 |
if (BYTES_BIG_ENDIAN) |
| 1937 |
return "vpks<VI_char>us %0,%1,%2"; |
| 1938 |
else |
| 1939 |
return "vpks<VI_char>us %0,%2,%1"; |
| 1940 |
} |
| 1941 |
[(set_attr "type" "vecperm")]) |
| 1942 |
|
| 1943 |
(define_insn "altivec_vpku<VI_char>us" |
| 1944 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 1945 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 1946 |
(match_operand:VP 2 "register_operand" "v")] |
| 1947 |
UNSPEC_VPACK_UNS_UNS_SAT))] |
| 1948 |
"<VI_unit>" |
| 1949 |
{ |
| 1950 |
if (BYTES_BIG_ENDIAN) |
| 1951 |
return "vpku<VI_char>us %0,%1,%2"; |
| 1952 |
else |
| 1953 |
return "vpku<VI_char>us %0,%2,%1"; |
| 1954 |
} |
| 1955 |
[(set_attr "type" "vecperm")]) |
| 1956 |
|
| 1957 |
(define_insn "altivec_vpku<VI_char>um" |
| 1958 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 1959 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 1960 |
(match_operand:VP 2 "register_operand" "v")] |
| 1961 |
UNSPEC_VPACK_UNS_UNS_MOD))] |
| 1962 |
"<VI_unit>" |
| 1963 |
{ |
| 1964 |
if (BYTES_BIG_ENDIAN) |
| 1965 |
return "vpku<VI_char>um %0,%1,%2"; |
| 1966 |
else |
| 1967 |
return "vpku<VI_char>um %0,%2,%1"; |
| 1968 |
} |
| 1969 |
[(set_attr "type" "vecperm")]) |
| 1970 |
|
| 1971 |
(define_insn "altivec_vpku<VI_char>um_direct" |
| 1972 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 1973 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 1974 |
(match_operand:VP 2 "register_operand" "v")] |
| 1975 |
UNSPEC_VPACK_UNS_UNS_MOD_DIRECT))] |
| 1976 |
"<VI_unit>" |
| 1977 |
{ |
| 1978 |
if (BYTES_BIG_ENDIAN) |
| 1979 |
return "vpku<VI_char>um %0,%1,%2"; |
| 1980 |
else |
| 1981 |
return "vpku<VI_char>um %0,%2,%1"; |
| 1982 |
} |
| 1983 |
[(set_attr "type" "vecperm")]) |
| 1984 |
|
| 1985 |
(define_insn "altivec_vrl<VI_char>" |
| 1986 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 1987 |
(rotate:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 1988 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 1989 |
"<VI_unit>" |
| 1990 |
"vrl<VI_char> %0,%1,%2" |
| 1991 |
[(set_attr "type" "vecsimple")]) |
| 1992 |
|
| 1993 |
(define_insn "altivec_vrlq" |
| 1994 |
[(set (match_operand:V1TI 0 "vsx_register_operand" "=v") |
| 1995 |
(rotate:V1TI (match_operand:V1TI 1 "vsx_register_operand" "v") |
| 1996 |
(match_operand:V1TI 2 "vsx_register_operand" "v")))] |
| 1997 |
"TARGET_POWER10" |
| 1998 |
;; rotate amount in needs to be in bits[57:63] of operand2. |
| 1999 |
"vrlq %0,%1,%2" |
| 2000 |
[(set_attr "type" "vecsimple")]) |
| 2001 |
|
| 2002 |
(define_insn "altivec_vrl<VI_char>mi" |
| 2003 |
[(set (match_operand:VIlong 0 "register_operand" "=v") |
| 2004 |
(unspec:VIlong [(match_operand:VIlong 1 "register_operand" "v") |
| 2005 |
(match_operand:VIlong 2 "register_operand" "0") |
| 2006 |
(match_operand:VIlong 3 "register_operand" "v")] |
| 2007 |
UNSPEC_VRLMI))] |
| 2008 |
"TARGET_P9_VECTOR" |
| 2009 |
"vrl<VI_char>mi %0,%1,%3" |
| 2010 |
[(set_attr "type" "veclogical")]) |
| 2011 |
|
| 2012 |
(define_expand "altivec_vrlqmi" |
| 2013 |
[(set (match_operand:V1TI 0 "vsx_register_operand") |
| 2014 |
(unspec:V1TI [(match_operand:V1TI 1 "vsx_register_operand") |
| 2015 |
(match_operand:V1TI 2 "vsx_register_operand") |
| 2016 |
(match_operand:V1TI 3 "vsx_register_operand")] |
| 2017 |
UNSPEC_VRLMI))] |
| 2018 |
"TARGET_POWER10" |
| 2019 |
{ |
| 2020 |
/* Mask bit begin, end fields need to be in bits [41:55] of 128-bit operand2. |
| 2021 |
Shift amount in needs to be put in bits[57:63] of 128-bit operand2. */ |
| 2022 |
rtx tmp = gen_reg_rtx (V1TImode); |
| 2023 |
|
| 2024 |
emit_insn (gen_xxswapd_v1ti (tmp, operands[3])); |
| 2025 |
emit_insn (gen_altivec_vrlqmi_inst (operands[0], operands[1], operands[2], |
| 2026 |
tmp)); |
| 2027 |
DONE; |
| 2028 |
}) |
| 2029 |
|
| 2030 |
(define_insn "altivec_vrlqmi_inst" |
| 2031 |
[(set (match_operand:V1TI 0 "vsx_register_operand" "=v") |
| 2032 |
(unspec:V1TI [(match_operand:V1TI 1 "vsx_register_operand" "v") |
| 2033 |
(match_operand:V1TI 2 "vsx_register_operand" "0") |
| 2034 |
(match_operand:V1TI 3 "vsx_register_operand" "v")] |
| 2035 |
UNSPEC_VRLMI))] |
| 2036 |
"TARGET_POWER10" |
| 2037 |
"vrlqmi %0,%1,%3" |
| 2038 |
[(set_attr "type" "veclogical")]) |
| 2039 |
|
| 2040 |
(define_insn "altivec_vrl<VI_char>nm" |
| 2041 |
[(set (match_operand:VIlong 0 "register_operand" "=v") |
| 2042 |
(unspec:VIlong [(match_operand:VIlong 1 "register_operand" "v") |
| 2043 |
(match_operand:VIlong 2 "register_operand" "v")] |
| 2044 |
UNSPEC_VRLNM))] |
| 2045 |
"TARGET_P9_VECTOR" |
| 2046 |
"vrl<VI_char>nm %0,%1,%2" |
| 2047 |
[(set_attr "type" "veclogical")]) |
| 2048 |
|
| 2049 |
(define_expand "altivec_vrlqnm" |
| 2050 |
[(set (match_operand:V1TI 0 "vsx_register_operand") |
| 2051 |
(unspec:V1TI [(match_operand:V1TI 1 "vsx_register_operand") |
| 2052 |
(match_operand:V1TI 2 "vsx_register_operand")] |
| 2053 |
UNSPEC_VRLNM))] |
| 2054 |
"TARGET_POWER10" |
| 2055 |
{ |
| 2056 |
/* Shift amount in needs to be put in bits[57:63] of 128-bit operand2. */ |
| 2057 |
rtx tmp = gen_reg_rtx (V1TImode); |
| 2058 |
|
| 2059 |
emit_insn (gen_xxswapd_v1ti (tmp, operands[2])); |
| 2060 |
emit_insn (gen_altivec_vrlqnm_inst (operands[0], operands[1], tmp)); |
| 2061 |
DONE; |
| 2062 |
}) |
| 2063 |
|
| 2064 |
(define_insn "altivec_vrlqnm_inst" |
| 2065 |
[(set (match_operand:V1TI 0 "vsx_register_operand" "=v") |
| 2066 |
(unspec:V1TI [(match_operand:V1TI 1 "vsx_register_operand" "v") |
| 2067 |
(match_operand:V1TI 2 "vsx_register_operand" "v")] |
| 2068 |
UNSPEC_VRLNM))] |
| 2069 |
"TARGET_POWER10" |
| 2070 |
;; rotate and mask bits need to be in upper 64-bits of operand2. |
| 2071 |
"vrlqnm %0,%1,%2" |
| 2072 |
[(set_attr "type" "veclogical")]) |
| 2073 |
|
| 2074 |
(define_insn "altivec_vsl" |
| 2075 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2076 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2077 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2078 |
UNSPEC_VSLV4SI))] |
| 2079 |
"TARGET_ALTIVEC" |
| 2080 |
"vsl %0,%1,%2" |
| 2081 |
[(set_attr "type" "vecperm")]) |
| 2082 |
|
| 2083 |
(define_insn "altivec_vslo" |
| 2084 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2085 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2086 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2087 |
UNSPEC_VSLO))] |
| 2088 |
"TARGET_ALTIVEC" |
| 2089 |
"vslo %0,%1,%2" |
| 2090 |
[(set_attr "type" "vecperm")]) |
| 2091 |
|
| 2092 |
(define_insn "vslv" |
| 2093 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 2094 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") |
| 2095 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 2096 |
UNSPEC_VSLV))] |
| 2097 |
"TARGET_P9_VECTOR" |
| 2098 |
"vslv %0,%1,%2" |
| 2099 |
[(set_attr "type" "vecsimple")]) |
| 2100 |
|
| 2101 |
(define_insn "vsrv" |
| 2102 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 2103 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") |
| 2104 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 2105 |
UNSPEC_VSRV))] |
| 2106 |
"TARGET_P9_VECTOR" |
| 2107 |
"vsrv %0,%1,%2" |
| 2108 |
[(set_attr "type" "vecsimple")]) |
| 2109 |
|
| 2110 |
(define_insn "*altivec_vsl<VI_char>" |
| 2111 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 2112 |
(ashift:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 2113 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 2114 |
"<VI_unit>" |
| 2115 |
"vsl<VI_char> %0,%1,%2" |
| 2116 |
[(set_attr "type" "vecsimple")]) |
| 2117 |
|
| 2118 |
(define_insn "altivec_vslq_<mode>" |
| 2119 |
[(set (match_operand:VEC_TI 0 "vsx_register_operand" "=v") |
| 2120 |
(ashift:VEC_TI (match_operand:VEC_TI 1 "vsx_register_operand" "v") |
| 2121 |
(match_operand:VEC_TI 2 "vsx_register_operand" "v")))] |
| 2122 |
"TARGET_POWER10" |
| 2123 |
/* Shift amount in needs to be in bits[57:63] of 128-bit operand. */ |
| 2124 |
"vslq %0,%1,%2" |
| 2125 |
[(set_attr "type" "vecsimple")]) |
| 2126 |
|
| 2127 |
(define_insn "*altivec_vsr<VI_char>" |
| 2128 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 2129 |
(lshiftrt:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 2130 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 2131 |
"<VI_unit>" |
| 2132 |
"vsr<VI_char> %0,%1,%2" |
| 2133 |
[(set_attr "type" "vecsimple")]) |
| 2134 |
|
| 2135 |
(define_insn "altivec_vsrq_<mode>" |
| 2136 |
[(set (match_operand:VEC_TI 0 "vsx_register_operand" "=v") |
| 2137 |
(lshiftrt:VEC_TI (match_operand:VEC_TI 1 "vsx_register_operand" "v") |
| 2138 |
(match_operand:VEC_TI 2 "vsx_register_operand" "v")))] |
| 2139 |
"TARGET_POWER10" |
| 2140 |
/* Shift amount in needs to be in bits[57:63] of 128-bit operand. */ |
| 2141 |
"vsrq %0,%1,%2" |
| 2142 |
[(set_attr "type" "vecsimple")]) |
| 2143 |
|
| 2144 |
(define_insn "*altivec_vsra<VI_char>" |
| 2145 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 2146 |
(ashiftrt:VI2 (match_operand:VI2 1 "register_operand" "v") |
| 2147 |
(match_operand:VI2 2 "register_operand" "v")))] |
| 2148 |
"<VI_unit>" |
| 2149 |
"vsra<VI_char> %0,%1,%2" |
| 2150 |
[(set_attr "type" "vecsimple")]) |
| 2151 |
|
| 2152 |
(define_insn "altivec_vsraq" |
| 2153 |
[(set (match_operand:V1TI 0 "vsx_register_operand" "=v") |
| 2154 |
(ashiftrt:V1TI (match_operand:V1TI 1 "vsx_register_operand" "v") |
| 2155 |
(match_operand:V1TI 2 "vsx_register_operand" "v")))] |
| 2156 |
"TARGET_POWER10" |
| 2157 |
/* Shift amount in needs to be in bits[57:63] of 128-bit operand. */ |
| 2158 |
"vsraq %0,%1,%2" |
| 2159 |
[(set_attr "type" "vecsimple")]) |
| 2160 |
|
| 2161 |
(define_insn "altivec_vsr" |
| 2162 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2163 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2164 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2165 |
UNSPEC_VSR))] |
| 2166 |
"TARGET_ALTIVEC" |
| 2167 |
"vsr %0,%1,%2" |
| 2168 |
[(set_attr "type" "vecperm")]) |
| 2169 |
|
| 2170 |
(define_insn "altivec_vsro" |
| 2171 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2172 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2173 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2174 |
UNSPEC_VSRO))] |
| 2175 |
"TARGET_ALTIVEC" |
| 2176 |
"vsro %0,%1,%2" |
| 2177 |
[(set_attr "type" "vecperm")]) |
| 2178 |
|
| 2179 |
;; Optimize V2DI shifts by constants. This relies on the shift instructions |
| 2180 |
;; only looking at the bits needed to do the shift. This means we can use |
| 2181 |
;; VSPLTISW or XXSPLTIB to load up the constant, and not worry about the bits |
| 2182 |
;; that the vector shift instructions will not use. |
| 2183 |
(define_mode_iterator VSHIFT_MODE [(V4SI "TARGET_P9_VECTOR") |
| 2184 |
(V2DI "TARGET_P8_VECTOR")]) |
| 2185 |
|
| 2186 |
(define_code_iterator vshift_code [ashift ashiftrt lshiftrt]) |
| 2187 |
(define_code_attr vshift_attr [(ashift "ashift") |
| 2188 |
(ashiftrt "ashiftrt") |
| 2189 |
(lshiftrt "lshiftrt")]) |
| 2190 |
|
| 2191 |
(define_insn_and_split "*altivec_<mode>_<vshift_attr>_const" |
| 2192 |
[(set (match_operand:VSHIFT_MODE 0 "register_operand" "=v") |
| 2193 |
(vshift_code:VSHIFT_MODE |
| 2194 |
(match_operand:VSHIFT_MODE 1 "register_operand" "v") |
| 2195 |
(match_operand:VSHIFT_MODE 2 "vector_shift_constant" ""))) |
| 2196 |
(clobber (match_scratch:VSHIFT_MODE 3 "=&v"))] |
| 2197 |
"((<MODE>mode == V2DImode && TARGET_P8_VECTOR) |
| 2198 |
|| (<MODE>mode == V4SImode && TARGET_P9_VECTOR))" |
| 2199 |
"#" |
| 2200 |
"&& 1" |
| 2201 |
[(set (match_dup 3) |
| 2202 |
(unspec:VSHIFT_MODE [(match_dup 4)] UNSPEC_VECTOR_SHIFT)) |
| 2203 |
(set (match_dup 0) |
| 2204 |
(vshift_code:VSHIFT_MODE (match_dup 1) |
| 2205 |
(match_dup 3)))] |
| 2206 |
{ |
| 2207 |
if (GET_CODE (operands[3]) == SCRATCH) |
| 2208 |
operands[3] = gen_reg_rtx (<MODE>mode); |
| 2209 |
|
| 2210 |
operands[4] = GET_CODE (operands[2]) == CONST_VECTOR |
| 2211 |
? CONST_VECTOR_ELT (operands[2], 0) |
| 2212 |
: XEXP (operands[2], 0); |
| 2213 |
}) |
| 2214 |
|
| 2215 |
(define_insn "*altivec_<mode>_shift_const" |
| 2216 |
[(set (match_operand:VSHIFT_MODE 0 "register_operand" "=v") |
| 2217 |
(unspec:VSHIFT_MODE [(match_operand 1 "const_int_operand" "n")] |
| 2218 |
UNSPEC_VECTOR_SHIFT))] |
| 2219 |
"TARGET_P8_VECTOR" |
| 2220 |
{ |
| 2221 |
if (UINTVAL (operands[1]) <= 15) |
| 2222 |
return "vspltisw %0,%1"; |
| 2223 |
else if (TARGET_P9_VECTOR) |
| 2224 |
return "xxspltib %x0,%1"; |
| 2225 |
else |
| 2226 |
gcc_unreachable (); |
| 2227 |
}) |
| 2228 |
|
| 2229 |
(define_insn "altivec_vsum4ubs" |
| 2230 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2231 |
(unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v") |
| 2232 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2233 |
UNSPEC_VSUM4UBS)) |
| 2234 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2235 |
"TARGET_ALTIVEC" |
| 2236 |
"vsum4ubs %0,%1,%2" |
| 2237 |
[(set_attr "type" "veccomplex")]) |
| 2238 |
|
| 2239 |
(define_insn "altivec_vsum4s<VI_char>s" |
| 2240 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2241 |
(unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v") |
| 2242 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2243 |
UNSPEC_VSUM4S)) |
| 2244 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2245 |
"TARGET_ALTIVEC" |
| 2246 |
"vsum4s<VI_char>s %0,%1,%2" |
| 2247 |
[(set_attr "type" "veccomplex")]) |
| 2248 |
|
| 2249 |
(define_expand "altivec_vsum2sws" |
| 2250 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 2251 |
(use (match_operand:V4SI 1 "register_operand")) |
| 2252 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 2253 |
"TARGET_ALTIVEC" |
| 2254 |
{ |
| 2255 |
if (BYTES_BIG_ENDIAN) |
| 2256 |
emit_insn (gen_altivec_vsum2sws_direct (operands[0], operands[1], |
| 2257 |
operands[2])); |
| 2258 |
else |
| 2259 |
{ |
| 2260 |
rtx tmp1 = gen_reg_rtx (V4SImode); |
| 2261 |
rtx tmp2 = gen_reg_rtx (V4SImode); |
| 2262 |
emit_insn (gen_altivec_vsldoi_v4si (tmp1, operands[2], |
| 2263 |
operands[2], GEN_INT (12))); |
| 2264 |
emit_insn (gen_altivec_vsum2sws_direct (tmp2, operands[1], tmp1)); |
| 2265 |
emit_insn (gen_altivec_vsldoi_v4si (operands[0], tmp2, tmp2, |
| 2266 |
GEN_INT (4))); |
| 2267 |
} |
| 2268 |
DONE; |
| 2269 |
}) |
| 2270 |
|
| 2271 |
; FIXME: This can probably be expressed without an UNSPEC. |
| 2272 |
(define_insn "altivec_vsum2sws_direct" |
| 2273 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2274 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2275 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2276 |
UNSPEC_VSUM2SWS)) |
| 2277 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2278 |
"TARGET_ALTIVEC" |
| 2279 |
"vsum2sws %0,%1,%2" |
| 2280 |
[(set_attr "type" "veccomplex")]) |
| 2281 |
|
| 2282 |
(define_expand "altivec_vsumsws" |
| 2283 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 2284 |
(use (match_operand:V4SI 1 "register_operand")) |
| 2285 |
(use (match_operand:V4SI 2 "register_operand"))] |
| 2286 |
"TARGET_ALTIVEC" |
| 2287 |
{ |
| 2288 |
if (BYTES_BIG_ENDIAN) |
| 2289 |
emit_insn (gen_altivec_vsumsws_direct (operands[0], operands[1], |
| 2290 |
operands[2])); |
| 2291 |
else |
| 2292 |
{ |
| 2293 |
rtx tmp1 = gen_reg_rtx (V4SImode); |
| 2294 |
rtx tmp2 = gen_reg_rtx (V4SImode); |
| 2295 |
emit_insn (gen_altivec_vspltw_direct (tmp1, operands[2], const0_rtx)); |
| 2296 |
emit_insn (gen_altivec_vsumsws_direct (tmp2, operands[1], tmp1)); |
| 2297 |
emit_insn (gen_altivec_vsldoi_v4si (operands[0], tmp2, tmp2, |
| 2298 |
GEN_INT (12))); |
| 2299 |
} |
| 2300 |
DONE; |
| 2301 |
}) |
| 2302 |
|
| 2303 |
; FIXME: This can probably be expressed without an UNSPEC. |
| 2304 |
(define_insn "altivec_vsumsws_direct" |
| 2305 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2306 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2307 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 2308 |
UNSPEC_VSUMSWS_DIRECT)) |
| 2309 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2310 |
"TARGET_ALTIVEC" |
| 2311 |
"vsumsws %0,%1,%2" |
| 2312 |
[(set_attr "type" "veccomplex")]) |
| 2313 |
|
| 2314 |
(define_expand "altivec_vspltb" |
| 2315 |
[(use (match_operand:V16QI 0 "register_operand")) |
| 2316 |
(use (match_operand:V16QI 1 "register_operand")) |
| 2317 |
(use (match_operand:QI 2 "const_0_to_15_operand"))] |
| 2318 |
"TARGET_ALTIVEC" |
| 2319 |
{ |
| 2320 |
rtvec v = gen_rtvec (1, operands[2]); |
| 2321 |
rtx x; |
| 2322 |
x = gen_rtx_VEC_SELECT (QImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); |
| 2323 |
x = gen_rtx_VEC_DUPLICATE (V16QImode, x); |
| 2324 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 2325 |
DONE; |
| 2326 |
}) |
| 2327 |
|
| 2328 |
(define_insn "*altivec_vspltb_internal" |
| 2329 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 2330 |
(vec_duplicate:V16QI |
| 2331 |
(vec_select:QI (match_operand:V16QI 1 "register_operand" "v") |
| 2332 |
(parallel |
| 2333 |
[(match_operand:QI 2 "const_0_to_15_operand" "")]))))] |
| 2334 |
"TARGET_ALTIVEC" |
| 2335 |
{ |
| 2336 |
if (!BYTES_BIG_ENDIAN) |
| 2337 |
operands[2] = GEN_INT (15 - INTVAL (operands[2])); |
| 2338 |
|
| 2339 |
return "vspltb %0,%1,%2"; |
| 2340 |
} |
| 2341 |
[(set_attr "type" "vecperm")]) |
| 2342 |
|
| 2343 |
(define_insn "altivec_vspltb_direct" |
| 2344 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 2345 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") |
| 2346 |
(match_operand:QI 2 "const_0_to_15_operand" "i")] |
| 2347 |
UNSPEC_VSPLT_DIRECT))] |
| 2348 |
"TARGET_ALTIVEC" |
| 2349 |
"vspltb %0,%1,%2" |
| 2350 |
[(set_attr "type" "vecperm")]) |
| 2351 |
|
| 2352 |
(define_expand "altivec_vsplth" |
| 2353 |
[(use (match_operand:V8HI 0 "register_operand")) |
| 2354 |
(use (match_operand:V8HI 1 "register_operand")) |
| 2355 |
(use (match_operand:QI 2 "const_0_to_7_operand"))] |
| 2356 |
"TARGET_ALTIVEC" |
| 2357 |
{ |
| 2358 |
rtvec v = gen_rtvec (1, operands[2]); |
| 2359 |
rtx x; |
| 2360 |
x = gen_rtx_VEC_SELECT (HImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); |
| 2361 |
x = gen_rtx_VEC_DUPLICATE (V8HImode, x); |
| 2362 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 2363 |
DONE; |
| 2364 |
}) |
| 2365 |
|
| 2366 |
(define_insn "*altivec_vsplth_internal" |
| 2367 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2368 |
(vec_duplicate:V8HI |
| 2369 |
(vec_select:HI (match_operand:V8HI 1 "register_operand" "v") |
| 2370 |
(parallel |
| 2371 |
[(match_operand:QI 2 "const_0_to_7_operand" "")]))))] |
| 2372 |
"TARGET_ALTIVEC" |
| 2373 |
{ |
| 2374 |
if (!BYTES_BIG_ENDIAN) |
| 2375 |
operands[2] = GEN_INT (7 - INTVAL (operands[2])); |
| 2376 |
|
| 2377 |
return "vsplth %0,%1,%2"; |
| 2378 |
} |
| 2379 |
[(set_attr "type" "vecperm")]) |
| 2380 |
|
| 2381 |
(define_insn "altivec_vsplth_direct" |
| 2382 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2383 |
(unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") |
| 2384 |
(match_operand:QI 2 "const_0_to_7_operand" "i")] |
| 2385 |
UNSPEC_VSPLT_DIRECT))] |
| 2386 |
"TARGET_ALTIVEC" |
| 2387 |
"vsplth %0,%1,%2" |
| 2388 |
[(set_attr "type" "vecperm")]) |
| 2389 |
|
| 2390 |
(define_expand "altivec_vspltw" |
| 2391 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 2392 |
(use (match_operand:V4SI 1 "register_operand")) |
| 2393 |
(use (match_operand:QI 2 "const_0_to_3_operand"))] |
| 2394 |
"TARGET_ALTIVEC" |
| 2395 |
{ |
| 2396 |
rtvec v = gen_rtvec (1, operands[2]); |
| 2397 |
rtx x; |
| 2398 |
x = gen_rtx_VEC_SELECT (SImode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); |
| 2399 |
x = gen_rtx_VEC_DUPLICATE (V4SImode, x); |
| 2400 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 2401 |
DONE; |
| 2402 |
}) |
| 2403 |
|
| 2404 |
(define_insn "*altivec_vspltw_internal" |
| 2405 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2406 |
(vec_duplicate:V4SI |
| 2407 |
(vec_select:SI (match_operand:V4SI 1 "register_operand" "v") |
| 2408 |
(parallel |
| 2409 |
[(match_operand:QI 2 "const_0_to_3_operand" "i")]))))] |
| 2410 |
"TARGET_ALTIVEC" |
| 2411 |
{ |
| 2412 |
if (!BYTES_BIG_ENDIAN) |
| 2413 |
operands[2] = GEN_INT (3 - INTVAL (operands[2])); |
| 2414 |
|
| 2415 |
return "vspltw %0,%1,%2"; |
| 2416 |
} |
| 2417 |
[(set_attr "type" "vecperm")]) |
| 2418 |
|
| 2419 |
(define_insn "altivec_vspltw_direct" |
| 2420 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2421 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 2422 |
(match_operand:QI 2 "const_0_to_3_operand" "i")] |
| 2423 |
UNSPEC_VSPLT_DIRECT))] |
| 2424 |
"TARGET_ALTIVEC" |
| 2425 |
"vspltw %0,%1,%2" |
| 2426 |
[(set_attr "type" "vecperm")]) |
| 2427 |
|
| 2428 |
(define_expand "altivec_vspltsf" |
| 2429 |
[(use (match_operand:V4SF 0 "register_operand")) |
| 2430 |
(use (match_operand:V4SF 1 "register_operand")) |
| 2431 |
(use (match_operand:QI 2 "const_0_to_3_operand"))] |
| 2432 |
"TARGET_ALTIVEC" |
| 2433 |
{ |
| 2434 |
rtvec v = gen_rtvec (1, operands[2]); |
| 2435 |
rtx x; |
| 2436 |
x = gen_rtx_VEC_SELECT (SFmode, operands[1], gen_rtx_PARALLEL (VOIDmode, v)); |
| 2437 |
x = gen_rtx_VEC_DUPLICATE (V4SFmode, x); |
| 2438 |
emit_insn (gen_rtx_SET (operands[0], x)); |
| 2439 |
DONE; |
| 2440 |
}) |
| 2441 |
|
| 2442 |
(define_insn "*altivec_vspltsf_internal" |
| 2443 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2444 |
(vec_duplicate:V4SF |
| 2445 |
(vec_select:SF (match_operand:V4SF 1 "register_operand" "v") |
| 2446 |
(parallel |
| 2447 |
[(match_operand:QI 2 "const_0_to_3_operand" "i")]))))] |
| 2448 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2449 |
{ |
| 2450 |
if (!BYTES_BIG_ENDIAN) |
| 2451 |
operands[2] = GEN_INT (3 - INTVAL (operands[2])); |
| 2452 |
|
| 2453 |
return "vspltw %0,%1,%2"; |
| 2454 |
} |
| 2455 |
[(set_attr "type" "vecperm")]) |
| 2456 |
|
| 2457 |
(define_insn "altivec_vspltis<VI_char>" |
| 2458 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 2459 |
(vec_duplicate:VI |
| 2460 |
(match_operand:QI 1 "s5bit_cint_operand" "i")))] |
| 2461 |
"TARGET_ALTIVEC" |
| 2462 |
"vspltis<VI_char> %0,%1" |
| 2463 |
[(set_attr "type" "vecperm")]) |
| 2464 |
|
| 2465 |
(define_insn "*altivec_vrfiz" |
| 2466 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2467 |
(fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))] |
| 2468 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2469 |
"vrfiz %0,%1" |
| 2470 |
[(set_attr "type" "vecfloat")]) |
| 2471 |
|
| 2472 |
(define_expand "altivec_vperm_<mode>" |
| 2473 |
[(set (match_operand:VM 0 "register_operand") |
| 2474 |
(unspec:VM [(match_operand:VM 1 "register_operand") |
| 2475 |
(match_operand:VM 2 "register_operand") |
| 2476 |
(match_operand:V16QI 3 "register_operand")] |
| 2477 |
UNSPEC_VPERM))] |
| 2478 |
"TARGET_ALTIVEC" |
| 2479 |
{ |
| 2480 |
if (!BYTES_BIG_ENDIAN) |
| 2481 |
{ |
| 2482 |
altivec_expand_vec_perm_le (operands); |
| 2483 |
DONE; |
| 2484 |
} |
| 2485 |
}) |
| 2486 |
|
| 2487 |
;; Slightly prefer vperm, since the target does not overlap the source |
| 2488 |
(define_insn "altivec_vperm_<mode>_direct" |
| 2489 |
[(set (match_operand:VM 0 "register_operand" "=?wa,v") |
| 2490 |
(unspec:VM [(match_operand:VM 1 "register_operand" "wa,v") |
| 2491 |
(match_operand:VM 2 "register_operand" "0,v") |
| 2492 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 2493 |
UNSPEC_VPERM))] |
| 2494 |
"TARGET_ALTIVEC" |
| 2495 |
"@ |
| 2496 |
xxperm %x0,%x1,%x3 |
| 2497 |
vperm %0,%1,%2,%3" |
| 2498 |
[(set_attr "type" "vecperm") |
| 2499 |
(set_attr "isa" "p9v,*")]) |
| 2500 |
|
| 2501 |
(define_insn "altivec_vperm_v8hiv16qi" |
| 2502 |
[(set (match_operand:V16QI 0 "register_operand" "=?wa,v") |
| 2503 |
(unspec:V16QI [(match_operand:V8HI 1 "register_operand" "wa,v") |
| 2504 |
(match_operand:V8HI 2 "register_operand" "0,v") |
| 2505 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 2506 |
UNSPEC_VPERM))] |
| 2507 |
"TARGET_ALTIVEC" |
| 2508 |
"@ |
| 2509 |
xxperm %x0,%x1,%x3 |
| 2510 |
vperm %0,%1,%2,%3" |
| 2511 |
[(set_attr "type" "vecperm") |
| 2512 |
(set_attr "isa" "p9v,*")]) |
| 2513 |
|
| 2514 |
(define_expand "altivec_vperm_<mode>_uns" |
| 2515 |
[(set (match_operand:VM 0 "register_operand") |
| 2516 |
(unspec:VM [(match_operand:VM 1 "register_operand") |
| 2517 |
(match_operand:VM 2 "register_operand") |
| 2518 |
(match_operand:V16QI 3 "register_operand")] |
| 2519 |
UNSPEC_VPERM_UNS))] |
| 2520 |
"TARGET_ALTIVEC" |
| 2521 |
{ |
| 2522 |
if (!BYTES_BIG_ENDIAN) |
| 2523 |
{ |
| 2524 |
altivec_expand_vec_perm_le (operands); |
| 2525 |
DONE; |
| 2526 |
} |
| 2527 |
}) |
| 2528 |
|
| 2529 |
(define_insn "*altivec_vperm_<mode>_uns_internal" |
| 2530 |
[(set (match_operand:VM 0 "register_operand" "=?wa,v") |
| 2531 |
(unspec:VM [(match_operand:VM 1 "register_operand" "wa,v") |
| 2532 |
(match_operand:VM 2 "register_operand" "0,v") |
| 2533 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 2534 |
UNSPEC_VPERM_UNS))] |
| 2535 |
"TARGET_ALTIVEC" |
| 2536 |
"@ |
| 2537 |
xxperm %x0,%x1,%x3 |
| 2538 |
vperm %0,%1,%2,%3" |
| 2539 |
[(set_attr "type" "vecperm") |
| 2540 |
(set_attr "isa" "p9v,*")]) |
| 2541 |
|
| 2542 |
(define_expand "vec_permv16qi" |
| 2543 |
[(set (match_operand:V16QI 0 "register_operand") |
| 2544 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand") |
| 2545 |
(match_operand:V16QI 2 "register_operand") |
| 2546 |
(match_operand:V16QI 3 "register_operand")] |
| 2547 |
UNSPEC_VPERM))] |
| 2548 |
"TARGET_ALTIVEC" |
| 2549 |
{ |
| 2550 |
if (!BYTES_BIG_ENDIAN) { |
| 2551 |
altivec_expand_vec_perm_le (operands); |
| 2552 |
DONE; |
| 2553 |
} |
| 2554 |
}) |
| 2555 |
|
| 2556 |
(define_insn "*altivec_vpermr_<mode>_internal" |
| 2557 |
[(set (match_operand:VM 0 "register_operand" "=?wa,v") |
| 2558 |
(unspec:VM [(match_operand:VM 1 "register_operand" "wa,v") |
| 2559 |
(match_operand:VM 2 "register_operand" "0,v") |
| 2560 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 2561 |
UNSPEC_VPERMR))] |
| 2562 |
"TARGET_P9_VECTOR" |
| 2563 |
"@ |
| 2564 |
xxpermr %x0,%x1,%x3 |
| 2565 |
vpermr %0,%1,%2,%3" |
| 2566 |
[(set_attr "type" "vecperm") |
| 2567 |
(set_attr "isa" "p9v,*")]) |
| 2568 |
|
| 2569 |
(define_insn "altivec_vrfip" ; ceil |
| 2570 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2571 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2572 |
UNSPEC_FRIP))] |
| 2573 |
"TARGET_ALTIVEC" |
| 2574 |
"vrfip %0,%1" |
| 2575 |
[(set_attr "type" "vecfloat")]) |
| 2576 |
|
| 2577 |
(define_insn "altivec_vrfin" |
| 2578 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2579 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2580 |
UNSPEC_VRFIN))] |
| 2581 |
"TARGET_ALTIVEC" |
| 2582 |
"vrfin %0,%1" |
| 2583 |
[(set_attr "type" "vecfloat")]) |
| 2584 |
|
| 2585 |
(define_insn "*altivec_vrfim" ; floor |
| 2586 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2587 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2588 |
UNSPEC_FRIM))] |
| 2589 |
"TARGET_ALTIVEC" |
| 2590 |
"vrfim %0,%1" |
| 2591 |
[(set_attr "type" "vecfloat")]) |
| 2592 |
|
| 2593 |
(define_insn "altivec_vcfux" |
| 2594 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2595 |
(unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v") |
| 2596 |
(match_operand:QI 2 "immediate_operand" "i")] |
| 2597 |
UNSPEC_VCFUX))] |
| 2598 |
"TARGET_ALTIVEC" |
| 2599 |
"vcfux %0,%1,%2" |
| 2600 |
[(set_attr "type" "vecfloat")]) |
| 2601 |
|
| 2602 |
(define_insn "altivec_vcfsx" |
| 2603 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2604 |
(unspec:V4SF [(match_operand:V4SI 1 "register_operand" "v") |
| 2605 |
(match_operand:QI 2 "immediate_operand" "i")] |
| 2606 |
UNSPEC_VCFSX))] |
| 2607 |
"TARGET_ALTIVEC" |
| 2608 |
"vcfsx %0,%1,%2" |
| 2609 |
[(set_attr "type" "vecfloat")]) |
| 2610 |
|
| 2611 |
(define_insn "altivec_vctuxs" |
| 2612 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2613 |
(unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v") |
| 2614 |
(match_operand:QI 2 "immediate_operand" "i")] |
| 2615 |
UNSPEC_VCTUXS)) |
| 2616 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2617 |
"TARGET_ALTIVEC" |
| 2618 |
"vctuxs %0,%1,%2" |
| 2619 |
[(set_attr "type" "vecfloat")]) |
| 2620 |
|
| 2621 |
(define_insn "altivec_vctsxs" |
| 2622 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2623 |
(unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v") |
| 2624 |
(match_operand:QI 2 "immediate_operand" "i")] |
| 2625 |
UNSPEC_VCTSXS)) |
| 2626 |
(set (reg:SI VSCR_REGNO) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))] |
| 2627 |
"TARGET_ALTIVEC" |
| 2628 |
"vctsxs %0,%1,%2" |
| 2629 |
[(set_attr "type" "vecfloat")]) |
| 2630 |
|
| 2631 |
(define_insn "altivec_vlogefp" |
| 2632 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2633 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2634 |
UNSPEC_VLOGEFP))] |
| 2635 |
"TARGET_ALTIVEC" |
| 2636 |
"vlogefp %0,%1" |
| 2637 |
[(set_attr "type" "vecfloat")]) |
| 2638 |
|
| 2639 |
(define_insn "altivec_vexptefp" |
| 2640 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2641 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2642 |
UNSPEC_VEXPTEFP))] |
| 2643 |
"TARGET_ALTIVEC" |
| 2644 |
"vexptefp %0,%1" |
| 2645 |
[(set_attr "type" "vecfloat")]) |
| 2646 |
|
| 2647 |
(define_insn "*altivec_vrsqrtefp" |
| 2648 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2649 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2650 |
UNSPEC_RSQRT))] |
| 2651 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2652 |
"vrsqrtefp %0,%1" |
| 2653 |
[(set_attr "type" "vecfloat")]) |
| 2654 |
|
| 2655 |
(define_insn "altivec_vrefp" |
| 2656 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2657 |
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")] |
| 2658 |
UNSPEC_FRES))] |
| 2659 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2660 |
"vrefp %0,%1" |
| 2661 |
[(set_attr "type" "vecfloat")]) |
| 2662 |
|
| 2663 |
(define_expand "altivec_copysign_v4sf3" |
| 2664 |
[(use (match_operand:V4SF 0 "register_operand")) |
| 2665 |
(use (match_operand:V4SF 1 "register_operand")) |
| 2666 |
(use (match_operand:V4SF 2 "register_operand"))] |
| 2667 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2668 |
{ |
| 2669 |
rtx mask = gen_reg_rtx (V4SImode); |
| 2670 |
rtx mask_val = gen_int_mode (HOST_WIDE_INT_1U << 31, SImode); |
| 2671 |
rtvec v = gen_rtvec (4, mask_val, mask_val, mask_val, mask_val); |
| 2672 |
|
| 2673 |
emit_insn (gen_vec_initv4sisi (mask, gen_rtx_PARALLEL (V4SImode, v))); |
| 2674 |
emit_insn (gen_vector_select_v4sf (operands[0], operands[1], operands[2], |
| 2675 |
gen_lowpart (V4SFmode, mask))); |
| 2676 |
DONE; |
| 2677 |
}) |
| 2678 |
|
| 2679 |
(define_insn "altivec_vsldoi_<mode>" |
| 2680 |
[(set (match_operand:VM 0 "register_operand" "=v") |
| 2681 |
(unspec:VM [(match_operand:VM 1 "register_operand" "v") |
| 2682 |
(match_operand:VM 2 "register_operand" "v") |
| 2683 |
(match_operand:QI 3 "immediate_operand" "i")] |
| 2684 |
UNSPEC_VSLDOI))] |
| 2685 |
"TARGET_ALTIVEC" |
| 2686 |
"vsldoi %0,%1,%2,%3" |
| 2687 |
[(set_attr "type" "vecperm")]) |
| 2688 |
|
| 2689 |
(define_insn "altivec_vupkhs<VU_char>" |
| 2690 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 2691 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 2692 |
UNSPEC_VUNPACK_HI_SIGN))] |
| 2693 |
"<VI_unit>" |
| 2694 |
{ |
| 2695 |
if (BYTES_BIG_ENDIAN) |
| 2696 |
return "vupkhs<VU_char> %0,%1"; |
| 2697 |
else |
| 2698 |
return "vupkls<VU_char> %0,%1"; |
| 2699 |
} |
| 2700 |
[(set_attr "type" "vecperm")]) |
| 2701 |
|
| 2702 |
(define_insn "altivec_vupkhs<VU_char>_direct" |
| 2703 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 2704 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 2705 |
UNSPEC_VUNPACK_HI_SIGN_DIRECT))] |
| 2706 |
"<VI_unit>" |
| 2707 |
"vupkhs<VU_char> %0,%1" |
| 2708 |
[(set_attr "type" "vecperm")]) |
| 2709 |
|
| 2710 |
(define_insn "altivec_vupkls<VU_char>" |
| 2711 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 2712 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 2713 |
UNSPEC_VUNPACK_LO_SIGN))] |
| 2714 |
"<VI_unit>" |
| 2715 |
{ |
| 2716 |
if (BYTES_BIG_ENDIAN) |
| 2717 |
return "vupkls<VU_char> %0,%1"; |
| 2718 |
else |
| 2719 |
return "vupkhs<VU_char> %0,%1"; |
| 2720 |
} |
| 2721 |
[(set_attr "type" "vecperm")]) |
| 2722 |
|
| 2723 |
(define_insn "*altivec_vupkls<VU_char>_direct" |
| 2724 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 2725 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 2726 |
UNSPEC_VUNPACK_LO_SIGN_DIRECT))] |
| 2727 |
"<VI_unit>" |
| 2728 |
"vupkls<VU_char> %0,%1" |
| 2729 |
[(set_attr "type" "vecperm")]) |
| 2730 |
|
| 2731 |
(define_insn "altivec_vupkhpx" |
| 2732 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2733 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] |
| 2734 |
UNSPEC_VUPKHPX))] |
| 2735 |
"TARGET_ALTIVEC" |
| 2736 |
{ |
| 2737 |
if (BYTES_BIG_ENDIAN) |
| 2738 |
return "vupkhpx %0,%1"; |
| 2739 |
else |
| 2740 |
return "vupklpx %0,%1"; |
| 2741 |
} |
| 2742 |
[(set_attr "type" "vecperm")]) |
| 2743 |
|
| 2744 |
(define_insn "altivec_vupklpx" |
| 2745 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 2746 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] |
| 2747 |
UNSPEC_VUPKLPX))] |
| 2748 |
"TARGET_ALTIVEC" |
| 2749 |
{ |
| 2750 |
if (BYTES_BIG_ENDIAN) |
| 2751 |
return "vupklpx %0,%1"; |
| 2752 |
else |
| 2753 |
return "vupkhpx %0,%1"; |
| 2754 |
} |
| 2755 |
[(set_attr "type" "vecperm")]) |
| 2756 |
|
| 2757 |
/* The cbranch_optab doesn't allow FAIL, so old cpus which are |
| 2758 |
inefficient on unaligned vsx are disabled as the cost is high |
| 2759 |
for unaligned load/store. */ |
| 2760 |
(define_expand "cbranchv16qi4" |
| 2761 |
[(use (match_operator 0 "equality_operator" |
| 2762 |
[(match_operand:V16QI 1 "reg_or_mem_operand") |
| 2763 |
(match_operand:V16QI 2 "reg_or_mem_operand")])) |
| 2764 |
(use (match_operand 3))] |
| 2765 |
"VECTOR_MEM_VSX_P (V16QImode) |
| 2766 |
&& TARGET_EFFICIENT_UNALIGNED_VSX" |
| 2767 |
{ |
| 2768 |
/* Use direct move for P8 LE to skip doubleword swap, as the byte |
| 2769 |
order doesn't matter for equality compare. If any operands are |
| 2770 |
altivec indexed or indirect operands, the load can be implemented |
| 2771 |
directly by altivec aligned load instruction and swap is no |
| 2772 |
need. */ |
| 2773 |
if (!TARGET_P9_VECTOR |
| 2774 |
&& !BYTES_BIG_ENDIAN |
| 2775 |
&& MEM_P (operands[1]) |
| 2776 |
&& !altivec_indexed_or_indirect_operand (operands[1], V16QImode) |
| 2777 |
&& MEM_P (operands[2]) |
| 2778 |
&& !altivec_indexed_or_indirect_operand (operands[2], V16QImode)) |
| 2779 |
{ |
| 2780 |
rtx reg_op1 = gen_reg_rtx (V16QImode); |
| 2781 |
rtx reg_op2 = gen_reg_rtx (V16QImode); |
| 2782 |
rs6000_emit_le_vsx_permute (reg_op1, operands[1], V16QImode); |
| 2783 |
rs6000_emit_le_vsx_permute (reg_op2, operands[2], V16QImode); |
| 2784 |
operands[1] = reg_op1; |
| 2785 |
operands[2] = reg_op2; |
| 2786 |
} |
| 2787 |
else |
| 2788 |
{ |
| 2789 |
operands[1] = force_reg (V16QImode, operands[1]); |
| 2790 |
operands[2] = force_reg (V16QImode, operands[2]); |
| 2791 |
} |
| 2792 |
|
| 2793 |
rtx_code code = GET_CODE (operands[0]); |
| 2794 |
operands[0] = gen_rtx_fmt_ee (code, V16QImode, operands[1], operands[2]); |
| 2795 |
rs6000_emit_cbranch (V16QImode, operands); |
| 2796 |
DONE; |
| 2797 |
}) |
| 2798 |
|
| 2799 |
;; Compare vectors producing a vector result and a predicate, setting CR6 to |
| 2800 |
;; indicate a combined status |
| 2801 |
(define_insn "altivec_vcmpequ<VI_char>_p" |
| 2802 |
[(set (reg:CC CR6_REGNO) |
| 2803 |
(unspec:CC [(eq:CC (match_operand:VI2 1 "register_operand" "v") |
| 2804 |
(match_operand:VI2 2 "register_operand" "v"))] |
| 2805 |
UNSPEC_PREDICATE)) |
| 2806 |
(set (match_operand:VI2 0 "register_operand" "=v") |
| 2807 |
(eq:VI2 (match_dup 1) |
| 2808 |
(match_dup 2)))] |
| 2809 |
"<VI_unit>" |
| 2810 |
"vcmpequ<VI_char>. %0,%1,%2" |
| 2811 |
[(set_attr "type" "veccmpfx")]) |
| 2812 |
|
| 2813 |
(define_insn "altivec_vcmpequt_p" |
| 2814 |
[(set (reg:CC CR6_REGNO) |
| 2815 |
(unspec:CC [(eq:CC (match_operand:V1TI 1 "altivec_register_operand" "v") |
| 2816 |
(match_operand:V1TI 2 "altivec_register_operand" "v"))] |
| 2817 |
UNSPEC_PREDICATE)) |
| 2818 |
(set (match_operand:V1TI 0 "altivec_register_operand" "=v") |
| 2819 |
(eq:V1TI (match_dup 1) |
| 2820 |
(match_dup 2)))] |
| 2821 |
"TARGET_POWER10" |
| 2822 |
"vcmpequq. %0,%1,%2" |
| 2823 |
[(set_attr "type" "veccmpfx")]) |
| 2824 |
|
| 2825 |
;; Expand for builtin vcmpne{b,h,w} |
| 2826 |
(define_expand "altivec_vcmpne_<mode>" |
| 2827 |
[(set (match_operand:VSX_EXTRACT_I 3 "altivec_register_operand" "=v") |
| 2828 |
(eq:VSX_EXTRACT_I (match_operand:VSX_EXTRACT_I 1 "altivec_register_operand" "v") |
| 2829 |
(match_operand:VSX_EXTRACT_I 2 "altivec_register_operand" "v"))) |
| 2830 |
(set (match_operand:VSX_EXTRACT_I 0 "altivec_register_operand" "=v") |
| 2831 |
(not:VSX_EXTRACT_I (match_dup 3)))] |
| 2832 |
"TARGET_ALTIVEC" |
| 2833 |
{ |
| 2834 |
operands[3] = gen_reg_rtx (GET_MODE (operands[0])); |
| 2835 |
}) |
| 2836 |
|
| 2837 |
(define_insn "*altivec_vcmpgts<VI_char>_p" |
| 2838 |
[(set (reg:CC CR6_REGNO) |
| 2839 |
(unspec:CC [(gt:CC (match_operand:VI2 1 "register_operand" "v") |
| 2840 |
(match_operand:VI2 2 "register_operand" "v"))] |
| 2841 |
UNSPEC_PREDICATE)) |
| 2842 |
(set (match_operand:VI2 0 "register_operand" "=v") |
| 2843 |
(gt:VI2 (match_dup 1) |
| 2844 |
(match_dup 2)))] |
| 2845 |
"<VI_unit>" |
| 2846 |
"vcmpgts<VI_char>. %0,%1,%2" |
| 2847 |
[(set_attr "type" "veccmpfx")]) |
| 2848 |
|
| 2849 |
(define_insn "*altivec_vcmpgtst_p" |
| 2850 |
[(set (reg:CC CR6_REGNO) |
| 2851 |
(unspec:CC [(gt:CC (match_operand:V1TI 1 "register_operand" "v") |
| 2852 |
(match_operand:V1TI 2 "register_operand" "v"))] |
| 2853 |
UNSPEC_PREDICATE)) |
| 2854 |
(set (match_operand:V1TI 0 "register_operand" "=v") |
| 2855 |
(gt:V1TI (match_dup 1) |
| 2856 |
(match_dup 2)))] |
| 2857 |
"TARGET_POWER10" |
| 2858 |
"vcmpgtsq. %0,%1,%2" |
| 2859 |
[(set_attr "type" "veccmpfx")]) |
| 2860 |
|
| 2861 |
(define_insn "*altivec_vcmpgtu<VI_char>_p" |
| 2862 |
[(set (reg:CC CR6_REGNO) |
| 2863 |
(unspec:CC [(gtu:CC (match_operand:VI2 1 "register_operand" "v") |
| 2864 |
(match_operand:VI2 2 "register_operand" "v"))] |
| 2865 |
UNSPEC_PREDICATE)) |
| 2866 |
(set (match_operand:VI2 0 "register_operand" "=v") |
| 2867 |
(gtu:VI2 (match_dup 1) |
| 2868 |
(match_dup 2)))] |
| 2869 |
"<VI_unit>" |
| 2870 |
"vcmpgtu<VI_char>. %0,%1,%2" |
| 2871 |
[(set_attr "type" "veccmpfx")]) |
| 2872 |
|
| 2873 |
(define_insn "*altivec_vcmpgtut_p" |
| 2874 |
[(set (reg:CC CR6_REGNO) |
| 2875 |
(unspec:CC [(gtu:CC (match_operand:V1TI 1 "register_operand" "v") |
| 2876 |
(match_operand:V1TI 2 "register_operand" "v"))] |
| 2877 |
UNSPEC_PREDICATE)) |
| 2878 |
(set (match_operand:V1TI 0 "register_operand" "=v") |
| 2879 |
(gtu:V1TI (match_dup 1) |
| 2880 |
(match_dup 2)))] |
| 2881 |
"TARGET_POWER10" |
| 2882 |
"vcmpgtuq. %0,%1,%2" |
| 2883 |
[(set_attr "type" "veccmpfx")]) |
| 2884 |
|
| 2885 |
(define_insn "*altivec_vcmpeqfp_p" |
| 2886 |
[(set (reg:CC CR6_REGNO) |
| 2887 |
(unspec:CC [(eq:CC (match_operand:V4SF 1 "register_operand" "v") |
| 2888 |
(match_operand:V4SF 2 "register_operand" "v"))] |
| 2889 |
UNSPEC_PREDICATE)) |
| 2890 |
(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2891 |
(eq:V4SF (match_dup 1) |
| 2892 |
(match_dup 2)))] |
| 2893 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2894 |
"vcmpeqfp. %0,%1,%2" |
| 2895 |
[(set_attr "type" "veccmp")]) |
| 2896 |
|
| 2897 |
(define_insn "*altivec_vcmpgtfp_p" |
| 2898 |
[(set (reg:CC CR6_REGNO) |
| 2899 |
(unspec:CC [(gt:CC (match_operand:V4SF 1 "register_operand" "v") |
| 2900 |
(match_operand:V4SF 2 "register_operand" "v"))] |
| 2901 |
UNSPEC_PREDICATE)) |
| 2902 |
(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2903 |
(gt:V4SF (match_dup 1) |
| 2904 |
(match_dup 2)))] |
| 2905 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2906 |
"vcmpgtfp. %0,%1,%2" |
| 2907 |
[(set_attr "type" "veccmp")]) |
| 2908 |
|
| 2909 |
(define_insn "*altivec_vcmpgefp_p" |
| 2910 |
[(set (reg:CC CR6_REGNO) |
| 2911 |
(unspec:CC [(ge:CC (match_operand:V4SF 1 "register_operand" "v") |
| 2912 |
(match_operand:V4SF 2 "register_operand" "v"))] |
| 2913 |
UNSPEC_PREDICATE)) |
| 2914 |
(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2915 |
(ge:V4SF (match_dup 1) |
| 2916 |
(match_dup 2)))] |
| 2917 |
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)" |
| 2918 |
"vcmpgefp. %0,%1,%2" |
| 2919 |
[(set_attr "type" "veccmp")]) |
| 2920 |
|
| 2921 |
(define_insn "altivec_vcmpbfp_p" |
| 2922 |
[(set (reg:CC CR6_REGNO) |
| 2923 |
(unspec:CC [(match_operand:V4SF 1 "register_operand" "v") |
| 2924 |
(match_operand:V4SF 2 "register_operand" "v")] |
| 2925 |
UNSPEC_VCMPBFP)) |
| 2926 |
(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2927 |
(unspec:V4SF [(match_dup 1) |
| 2928 |
(match_dup 2)] |
| 2929 |
UNSPEC_VCMPBFP))] |
| 2930 |
"VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)" |
| 2931 |
"vcmpbfp. %0,%1,%2" |
| 2932 |
[(set_attr "type" "veccmp")]) |
| 2933 |
|
| 2934 |
(define_insn "altivec_mtvscr" |
| 2935 |
[(set (reg:SI VSCR_REGNO) |
| 2936 |
(unspec_volatile:SI |
| 2937 |
[(match_operand:V4SI 0 "register_operand" "v")] UNSPECV_MTVSCR))] |
| 2938 |
"TARGET_ALTIVEC" |
| 2939 |
"mtvscr %0" |
| 2940 |
[(set_attr "type" "vecsimple")]) |
| 2941 |
|
| 2942 |
(define_insn "altivec_mfvscr" |
| 2943 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2944 |
(unspec_volatile:V8HI [(reg:SI VSCR_REGNO)] UNSPECV_MFVSCR))] |
| 2945 |
"TARGET_ALTIVEC" |
| 2946 |
"mfvscr %0" |
| 2947 |
[(set_attr "type" "vecsimple")]) |
| 2948 |
|
| 2949 |
(define_insn "altivec_dssall" |
| 2950 |
[(unspec_volatile [(const_int 0)] UNSPECV_DSSALL)] |
| 2951 |
"TARGET_ALTIVEC" |
| 2952 |
"dssall" |
| 2953 |
[(set_attr "type" "vecsimple")]) |
| 2954 |
|
| 2955 |
(define_insn "altivec_dss" |
| 2956 |
[(unspec_volatile [(match_operand:QI 0 "immediate_operand" "i")] |
| 2957 |
UNSPECV_DSS)] |
| 2958 |
"TARGET_ALTIVEC" |
| 2959 |
"dss %0" |
| 2960 |
[(set_attr "type" "vecsimple")]) |
| 2961 |
|
| 2962 |
(define_insn "altivec_dst" |
| 2963 |
[(unspec [(match_operand 0 "register_operand" "b") |
| 2964 |
(match_operand:SI 1 "register_operand" "r") |
| 2965 |
(match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DST)] |
| 2966 |
"TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode" |
| 2967 |
"dst %0,%1,%2" |
| 2968 |
[(set_attr "type" "vecsimple")]) |
| 2969 |
|
| 2970 |
(define_insn "altivec_dstt" |
| 2971 |
[(unspec [(match_operand 0 "register_operand" "b") |
| 2972 |
(match_operand:SI 1 "register_operand" "r") |
| 2973 |
(match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTT)] |
| 2974 |
"TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode" |
| 2975 |
"dstt %0,%1,%2" |
| 2976 |
[(set_attr "type" "vecsimple")]) |
| 2977 |
|
| 2978 |
(define_insn "altivec_dstst" |
| 2979 |
[(unspec [(match_operand 0 "register_operand" "b") |
| 2980 |
(match_operand:SI 1 "register_operand" "r") |
| 2981 |
(match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTST)] |
| 2982 |
"TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode" |
| 2983 |
"dstst %0,%1,%2" |
| 2984 |
[(set_attr "type" "vecsimple")]) |
| 2985 |
|
| 2986 |
(define_insn "altivec_dststt" |
| 2987 |
[(unspec [(match_operand 0 "register_operand" "b") |
| 2988 |
(match_operand:SI 1 "register_operand" "r") |
| 2989 |
(match_operand:QI 2 "immediate_operand" "i")] UNSPEC_DSTSTT)] |
| 2990 |
"TARGET_ALTIVEC && GET_MODE (operands[0]) == Pmode" |
| 2991 |
"dststt %0,%1,%2" |
| 2992 |
[(set_attr "type" "vecsimple")]) |
| 2993 |
|
| 2994 |
(define_expand "altivec_lvsl" |
| 2995 |
[(use (match_operand:V16QI 0 "register_operand")) |
| 2996 |
(use (match_operand:V16QI 1 "memory_operand"))] |
| 2997 |
"TARGET_ALTIVEC" |
| 2998 |
{ |
| 2999 |
if (BYTES_BIG_ENDIAN) |
| 3000 |
emit_insn (gen_altivec_lvsl_direct (operands[0], operands[1])); |
| 3001 |
else |
| 3002 |
{ |
| 3003 |
rtx mask, constv, vperm; |
| 3004 |
mask = gen_reg_rtx (V16QImode); |
| 3005 |
emit_insn (gen_altivec_lvsl_direct (mask, operands[1])); |
| 3006 |
constv = gen_const_vec_series (V16QImode, const0_rtx, const1_rtx); |
| 3007 |
constv = force_reg (V16QImode, constv); |
| 3008 |
vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv), |
| 3009 |
UNSPEC_VPERM); |
| 3010 |
emit_insn (gen_rtx_SET (operands[0], vperm)); |
| 3011 |
} |
| 3012 |
DONE; |
| 3013 |
}) |
| 3014 |
|
| 3015 |
(define_insn "altivec_lvsl_reg_<mode>" |
| 3016 |
[(set (match_operand:V16QI 0 "altivec_register_operand" "=v") |
| 3017 |
(unspec:V16QI |
| 3018 |
[(match_operand:GPR 1 "gpc_reg_operand" "b")] |
| 3019 |
UNSPEC_LVSL_REG))] |
| 3020 |
"TARGET_ALTIVEC" |
| 3021 |
"lvsl %0,0,%1" |
| 3022 |
[(set_attr "type" "vecload")]) |
| 3023 |
|
| 3024 |
(define_insn "altivec_lvsl_direct" |
| 3025 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 3026 |
(unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")] |
| 3027 |
UNSPEC_LVSL))] |
| 3028 |
"TARGET_ALTIVEC" |
| 3029 |
"lvsl %0,%y1" |
| 3030 |
[(set_attr "type" "vecload")]) |
| 3031 |
|
| 3032 |
(define_expand "altivec_lvsr" |
| 3033 |
[(use (match_operand:V16QI 0 "altivec_register_operand")) |
| 3034 |
(use (match_operand:V16QI 1 "memory_operand"))] |
| 3035 |
"TARGET_ALTIVEC" |
| 3036 |
{ |
| 3037 |
if (BYTES_BIG_ENDIAN) |
| 3038 |
emit_insn (gen_altivec_lvsr_direct (operands[0], operands[1])); |
| 3039 |
else |
| 3040 |
{ |
| 3041 |
rtx mask, constv, vperm; |
| 3042 |
mask = gen_reg_rtx (V16QImode); |
| 3043 |
emit_insn (gen_altivec_lvsr_direct (mask, operands[1])); |
| 3044 |
constv = gen_const_vec_series (V16QImode, const0_rtx, const1_rtx); |
| 3045 |
constv = force_reg (V16QImode, constv); |
| 3046 |
vperm = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, mask, mask, constv), |
| 3047 |
UNSPEC_VPERM); |
| 3048 |
emit_insn (gen_rtx_SET (operands[0], vperm)); |
| 3049 |
} |
| 3050 |
DONE; |
| 3051 |
}) |
| 3052 |
|
| 3053 |
(define_insn "altivec_lvsr_reg_<mode>" |
| 3054 |
[(set (match_operand:V16QI 0 "altivec_register_operand" "=v") |
| 3055 |
(unspec:V16QI |
| 3056 |
[(match_operand:GPR 1 "gpc_reg_operand" "b")] |
| 3057 |
UNSPEC_LVSR_REG))] |
| 3058 |
"TARGET_ALTIVEC" |
| 3059 |
"lvsr %0,0,%1" |
| 3060 |
[(set_attr "type" "vecload")]) |
| 3061 |
|
| 3062 |
(define_insn "altivec_lvsr_direct" |
| 3063 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 3064 |
(unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "Z")] |
| 3065 |
UNSPEC_LVSR))] |
| 3066 |
"TARGET_ALTIVEC" |
| 3067 |
"lvsr %0,%y1" |
| 3068 |
[(set_attr "type" "vecload")]) |
| 3069 |
|
| 3070 |
(define_expand "build_vector_mask_for_load" |
| 3071 |
[(set (match_operand:V16QI 0 "register_operand") |
| 3072 |
(unspec:V16QI [(match_operand 1 "memory_operand")] UNSPEC_LVSR))] |
| 3073 |
"TARGET_ALTIVEC" |
| 3074 |
{ |
| 3075 |
rtx addr; |
| 3076 |
rtx temp; |
| 3077 |
|
| 3078 |
gcc_assert (MEM_P (operands[1])); |
| 3079 |
|
| 3080 |
addr = XEXP (operands[1], 0); |
| 3081 |
temp = gen_reg_rtx (GET_MODE (addr)); |
| 3082 |
emit_insn (gen_rtx_SET (temp, gen_rtx_NEG (GET_MODE (addr), addr))); |
| 3083 |
emit_insn (gen_altivec_lvsr (operands[0], |
| 3084 |
replace_equiv_address (operands[1], temp))); |
| 3085 |
DONE; |
| 3086 |
}) |
| 3087 |
|
| 3088 |
;; Parallel some of the LVE* and STV*'s with unspecs because some have |
| 3089 |
;; identical rtl but different instructions-- and gcc gets confused. |
| 3090 |
|
| 3091 |
(define_insn "altivec_lve<VI_char>x" |
| 3092 |
[(parallel |
| 3093 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 3094 |
(match_operand:VI 1 "memory_operand" "Z")) |
| 3095 |
(unspec [(const_int 0)] UNSPEC_LVE)])] |
| 3096 |
"TARGET_ALTIVEC" |
| 3097 |
"lve<VI_char>x %0,%y1" |
| 3098 |
[(set_attr "type" "vecload")]) |
| 3099 |
|
| 3100 |
(define_insn "*altivec_lvesfx" |
| 3101 |
[(parallel |
| 3102 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 3103 |
(match_operand:V4SF 1 "memory_operand" "Z")) |
| 3104 |
(unspec [(const_int 0)] UNSPEC_LVE)])] |
| 3105 |
"TARGET_ALTIVEC" |
| 3106 |
"lvewx %0,%y1" |
| 3107 |
[(set_attr "type" "vecload")]) |
| 3108 |
|
| 3109 |
(define_insn "altivec_lvxl_<mode>" |
| 3110 |
[(parallel |
| 3111 |
[(set (match_operand:VM2 0 "register_operand" "=v") |
| 3112 |
(match_operand:VM2 1 "memory_operand" "Z")) |
| 3113 |
(unspec [(const_int 0)] UNSPEC_SET_VSCR)])] |
| 3114 |
"TARGET_ALTIVEC" |
| 3115 |
"lvxl %0,%y1" |
| 3116 |
[(set_attr "type" "vecload")]) |
| 3117 |
|
| 3118 |
; This version of lvx is used only in cases where we need to force an lvx |
| 3119 |
; over any other load, and we don't care about losing CSE opportunities. |
| 3120 |
; Its primary use is for prologue register saves. |
| 3121 |
(define_insn "altivec_lvx_<mode>_internal" |
| 3122 |
[(parallel |
| 3123 |
[(set (match_operand:VM2 0 "register_operand" "=v") |
| 3124 |
(match_operand:VM2 1 "memory_operand" "Z")) |
| 3125 |
(unspec [(const_int 0)] UNSPEC_LVX)])] |
| 3126 |
"TARGET_ALTIVEC" |
| 3127 |
"lvx %0,%y1" |
| 3128 |
[(set_attr "type" "vecload")]) |
| 3129 |
|
| 3130 |
; The following patterns embody what lvx should usually look like. |
| 3131 |
(define_expand "altivec_lvx_<VM2:mode>" |
| 3132 |
[(set (match_operand:VM2 0 "register_operand") |
| 3133 |
(match_operand:VM2 1 "altivec_indexed_or_indirect_operand"))] |
| 3134 |
"TARGET_ALTIVEC" |
| 3135 |
{ |
| 3136 |
rtx addr = XEXP (operand1, 0); |
| 3137 |
if (rs6000_sum_of_two_registers_p (addr)) |
| 3138 |
{ |
| 3139 |
rtx op1 = XEXP (addr, 0); |
| 3140 |
rtx op2 = XEXP (addr, 1); |
| 3141 |
if (TARGET_64BIT) |
| 3142 |
emit_insn (gen_altivec_lvx_<VM2:mode>_2op_di (operand0, op1, op2)); |
| 3143 |
else |
| 3144 |
emit_insn (gen_altivec_lvx_<VM2:mode>_2op_si (operand0, op1, op2)); |
| 3145 |
} |
| 3146 |
else |
| 3147 |
{ |
| 3148 |
if (TARGET_64BIT) |
| 3149 |
emit_insn (gen_altivec_lvx_<VM2:mode>_1op_di (operand0, addr)); |
| 3150 |
else |
| 3151 |
emit_insn (gen_altivec_lvx_<VM2:mode>_1op_si (operand0, addr)); |
| 3152 |
} |
| 3153 |
DONE; |
| 3154 |
}) |
| 3155 |
|
| 3156 |
; The next two patterns embody what lvx should usually look like. |
| 3157 |
(define_insn "altivec_lvx_<VM2:mode>_2op_<P:mptrsize>" |
| 3158 |
[(set (match_operand:VM2 0 "register_operand" "=v") |
| 3159 |
(mem:VM2 (and:P (plus:P (match_operand:P 1 "register_operand" "b") |
| 3160 |
(match_operand:P 2 "register_operand" "r")) |
| 3161 |
(const_int -16))))] |
| 3162 |
"TARGET_ALTIVEC" |
| 3163 |
"lvx %0,%1,%2" |
| 3164 |
[(set_attr "type" "vecload")]) |
| 3165 |
|
| 3166 |
(define_insn "altivec_lvx_<VM2:mode>_1op_<P:mptrsize>" |
| 3167 |
[(set (match_operand:VM2 0 "register_operand" "=v") |
| 3168 |
(mem:VM2 (and:P (match_operand:P 1 "register_operand" "r") |
| 3169 |
(const_int -16))))] |
| 3170 |
"TARGET_ALTIVEC" |
| 3171 |
"lvx %0,0,%1" |
| 3172 |
[(set_attr "type" "vecload")]) |
| 3173 |
|
| 3174 |
; This version of stvx is used only in cases where we need to force an stvx |
| 3175 |
; over any other store, and we don't care about losing CSE opportunities. |
| 3176 |
; Its primary use is for epilogue register restores. |
| 3177 |
(define_insn "altivec_stvx_<mode>_internal" |
| 3178 |
[(parallel |
| 3179 |
[(set (match_operand:VM2 0 "memory_operand" "=Z") |
| 3180 |
(match_operand:VM2 1 "register_operand" "v")) |
| 3181 |
(unspec [(const_int 0)] UNSPEC_STVX)])] |
| 3182 |
"TARGET_ALTIVEC" |
| 3183 |
"stvx %1,%y0" |
| 3184 |
[(set_attr "type" "vecstore")]) |
| 3185 |
|
| 3186 |
; The following patterns embody what stvx should usually look like. |
| 3187 |
(define_expand "altivec_stvx_<VM2:mode>" |
| 3188 |
[(set (match_operand:VM2 1 "altivec_indexed_or_indirect_operand") |
| 3189 |
(match_operand:VM2 0 "register_operand"))] |
| 3190 |
"TARGET_ALTIVEC" |
| 3191 |
{ |
| 3192 |
rtx addr = XEXP (operand1, 0); |
| 3193 |
if (rs6000_sum_of_two_registers_p (addr)) |
| 3194 |
{ |
| 3195 |
rtx op1 = XEXP (addr, 0); |
| 3196 |
rtx op2 = XEXP (addr, 1); |
| 3197 |
if (TARGET_64BIT) |
| 3198 |
emit_insn (gen_altivec_stvx_<VM2:mode>_2op_di (operand0, op1, op2)); |
| 3199 |
else |
| 3200 |
emit_insn (gen_altivec_stvx_<VM2:mode>_2op_si (operand0, op1, op2)); |
| 3201 |
} |
| 3202 |
else |
| 3203 |
{ |
| 3204 |
if (TARGET_64BIT) |
| 3205 |
emit_insn (gen_altivec_stvx_<VM2:mode>_1op_di (operand0, addr)); |
| 3206 |
else |
| 3207 |
emit_insn (gen_altivec_stvx_<VM2:mode>_1op_si (operand0, addr)); |
| 3208 |
} |
| 3209 |
DONE; |
| 3210 |
}) |
| 3211 |
|
| 3212 |
; The next two patterns embody what stvx should usually look like. |
| 3213 |
(define_insn "altivec_stvx_<VM2:mode>_2op_<P:mptrsize>" |
| 3214 |
[(set (mem:VM2 (and:P (plus:P (match_operand:P 1 "register_operand" "b") |
| 3215 |
(match_operand:P 2 "register_operand" "r")) |
| 3216 |
(const_int -16))) |
| 3217 |
(match_operand:VM2 0 "register_operand" "v"))] |
| 3218 |
"TARGET_ALTIVEC" |
| 3219 |
"stvx %0,%1,%2" |
| 3220 |
[(set_attr "type" "vecstore")]) |
| 3221 |
|
| 3222 |
(define_insn "altivec_stvx_<VM2:mode>_1op_<P:mptrsize>" |
| 3223 |
[(set (mem:VM2 (and:P (match_operand:P 1 "register_operand" "r") |
| 3224 |
(const_int -16))) |
| 3225 |
(match_operand:VM2 0 "register_operand" "v"))] |
| 3226 |
"TARGET_ALTIVEC" |
| 3227 |
"stvx %0,0,%1" |
| 3228 |
[(set_attr "type" "vecstore")]) |
| 3229 |
|
| 3230 |
(define_insn "altivec_stvxl_<mode>" |
| 3231 |
[(parallel |
| 3232 |
[(set (match_operand:VM2 0 "memory_operand" "=Z") |
| 3233 |
(match_operand:VM2 1 "register_operand" "v")) |
| 3234 |
(unspec [(const_int 0)] UNSPEC_STVXL)])] |
| 3235 |
"TARGET_ALTIVEC" |
| 3236 |
"stvxl %1,%y0" |
| 3237 |
[(set_attr "type" "vecstore")]) |
| 3238 |
|
| 3239 |
(define_insn "altivec_stve<VI_char>x" |
| 3240 |
[(set (match_operand:<VI_scalar> 0 "memory_operand" "=Z") |
| 3241 |
(unspec:<VI_scalar> [(match_operand:VI 1 "register_operand" "v")] UNSPEC_STVE))] |
| 3242 |
"TARGET_ALTIVEC" |
| 3243 |
"stve<VI_char>x %1,%y0" |
| 3244 |
[(set_attr "type" "vecstore")]) |
| 3245 |
|
| 3246 |
(define_insn "*altivec_stvesfx" |
| 3247 |
[(set (match_operand:SF 0 "memory_operand" "=Z") |
| 3248 |
(unspec:SF [(match_operand:V4SF 1 "register_operand" "v")] UNSPEC_STVE))] |
| 3249 |
"TARGET_ALTIVEC" |
| 3250 |
"stvewx %1,%y0" |
| 3251 |
[(set_attr "type" "vecstore")]) |
| 3252 |
|
| 3253 |
;; Generate doublee |
| 3254 |
;; signed int/float to double convert words 0 and 2 |
| 3255 |
(define_expand "doublee<mode>2" |
| 3256 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3257 |
(match_operand:VSX_W 1 "register_operand" "v"))] |
| 3258 |
"TARGET_VSX" |
| 3259 |
{ |
| 3260 |
machine_mode op_mode = GET_MODE (operands[1]); |
| 3261 |
|
| 3262 |
if (BYTES_BIG_ENDIAN) |
| 3263 |
{ |
| 3264 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3265 |
Input words 0 and 2 are where they need to be. */ |
| 3266 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], operands[1])); |
| 3267 |
} |
| 3268 |
else |
| 3269 |
{ |
| 3270 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3271 |
take (operand[1] operand[1]) and shift left one word |
| 3272 |
3 2 1 0 3 2 1 0 => 2 1 0 3 |
| 3273 |
Input words 2 and 0 are now where they need to be for the |
| 3274 |
conversion. */ |
| 3275 |
rtx rtx_tmp; |
| 3276 |
rtx rtx_val = GEN_INT (1); |
| 3277 |
|
| 3278 |
rtx_tmp = gen_reg_rtx (op_mode); |
| 3279 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3280 |
operands[1], rtx_val)); |
| 3281 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3282 |
} |
| 3283 |
DONE; |
| 3284 |
} |
| 3285 |
[(set_attr "type" "veccomplex")]) |
| 3286 |
|
| 3287 |
;; Generate unsdoublee |
| 3288 |
;; unsigned int to double convert words 0 and 2 |
| 3289 |
(define_expand "unsdoubleev4si2" |
| 3290 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3291 |
(match_operand:V4SI 1 "register_operand" "v"))] |
| 3292 |
"TARGET_VSX" |
| 3293 |
{ |
| 3294 |
if (BYTES_BIG_ENDIAN) |
| 3295 |
{ |
| 3296 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3297 |
Input words 0 and 2 are where they need to be. */ |
| 3298 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], operands[1])); |
| 3299 |
} |
| 3300 |
else |
| 3301 |
{ |
| 3302 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3303 |
take (operand[1] operand[1]) and shift left one word |
| 3304 |
3 2 1 0 3 2 1 0 => 2 1 0 3 |
| 3305 |
Input words 2 and 0 are now where they need to be for the |
| 3306 |
conversion. */ |
| 3307 |
rtx rtx_tmp; |
| 3308 |
rtx rtx_val = GEN_INT (1); |
| 3309 |
|
| 3310 |
rtx_tmp = gen_reg_rtx (V4SImode); |
| 3311 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3312 |
operands[1], rtx_val)); |
| 3313 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3314 |
} |
| 3315 |
DONE; |
| 3316 |
} |
| 3317 |
[(set_attr "type" "veccomplex")]) |
| 3318 |
|
| 3319 |
;; Generate doubleov |
| 3320 |
;; signed int/float to double convert words 1 and 3 |
| 3321 |
(define_expand "doubleo<mode>2" |
| 3322 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3323 |
(match_operand:VSX_W 1 "register_operand" "v"))] |
| 3324 |
"TARGET_VSX" |
| 3325 |
{ |
| 3326 |
machine_mode op_mode = GET_MODE (operands[1]); |
| 3327 |
|
| 3328 |
if (BYTES_BIG_ENDIAN) |
| 3329 |
{ |
| 3330 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3331 |
take (operand[1] operand[1]) and shift left one word |
| 3332 |
0 1 2 3 0 1 2 3 => 1 2 3 0 |
| 3333 |
Input words 1 and 3 are now where they need to be for the |
| 3334 |
conversion. */ |
| 3335 |
rtx rtx_tmp; |
| 3336 |
rtx rtx_val = GEN_INT (1); |
| 3337 |
|
| 3338 |
rtx_tmp = gen_reg_rtx (op_mode); |
| 3339 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3340 |
operands[1], rtx_val)); |
| 3341 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3342 |
} |
| 3343 |
else |
| 3344 |
{ |
| 3345 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3346 |
Input words 3 and 1 are where they need to be. */ |
| 3347 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], operands[1])); |
| 3348 |
} |
| 3349 |
DONE; |
| 3350 |
} |
| 3351 |
[(set_attr "type" "veccomplex")]) |
| 3352 |
|
| 3353 |
;; Generate unsdoubleov |
| 3354 |
;; unsigned int to double convert words 1 and 3 |
| 3355 |
(define_expand "unsdoubleov4si2" |
| 3356 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3357 |
(match_operand:V4SI 1 "register_operand" "v"))] |
| 3358 |
"TARGET_VSX" |
| 3359 |
{ |
| 3360 |
if (BYTES_BIG_ENDIAN) |
| 3361 |
{ |
| 3362 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3363 |
take (operand[1] operand[1]) and shift left one word |
| 3364 |
0 1 2 3 0 1 2 3 => 1 2 3 0 |
| 3365 |
Input words 1 and 3 are now where they need to be for the |
| 3366 |
conversion. */ |
| 3367 |
rtx rtx_tmp; |
| 3368 |
rtx rtx_val = GEN_INT (1); |
| 3369 |
|
| 3370 |
rtx_tmp = gen_reg_rtx (V4SImode); |
| 3371 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3372 |
operands[1], rtx_val)); |
| 3373 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3374 |
} |
| 3375 |
else |
| 3376 |
{ |
| 3377 |
/* Want to convert the words 1 and 3. |
| 3378 |
Little endian word numbering for operand is 3 2 1 0. |
| 3379 |
Input words 3 and 1 are where they need to be. */ |
| 3380 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], operands[1])); |
| 3381 |
} |
| 3382 |
DONE; |
| 3383 |
} |
| 3384 |
[(set_attr "type" "veccomplex")]) |
| 3385 |
|
| 3386 |
;; Generate doublehv |
| 3387 |
;; signed int/float to double convert words 0 and 1 |
| 3388 |
(define_expand "doubleh<mode>2" |
| 3389 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3390 |
(match_operand:VSX_W 1 "register_operand" "v"))] |
| 3391 |
"TARGET_VSX" |
| 3392 |
{ |
| 3393 |
rtx rtx_tmp; |
| 3394 |
rtx rtx_val; |
| 3395 |
|
| 3396 |
machine_mode op_mode = GET_MODE (operands[1]); |
| 3397 |
rtx_tmp = gen_reg_rtx (op_mode); |
| 3398 |
|
| 3399 |
if (BYTES_BIG_ENDIAN) |
| 3400 |
{ |
| 3401 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3402 |
Shift operand left one word, rtx_tmp word order is now 1 2 3 0. |
| 3403 |
take (rts_tmp operand[1]) and shift left three words |
| 3404 |
1 2 3 0 0 1 2 3 => 0 0 1 2 |
| 3405 |
Input words 0 and 1 are now where they need to be for the |
| 3406 |
conversion. */ |
| 3407 |
rtx_val = GEN_INT (1); |
| 3408 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3409 |
operands[1], rtx_val)); |
| 3410 |
|
| 3411 |
rtx_val = GEN_INT (3); |
| 3412 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, rtx_tmp, |
| 3413 |
operands[1], rtx_val)); |
| 3414 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3415 |
} |
| 3416 |
else |
| 3417 |
{ |
| 3418 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3419 |
Shift operand left three words, rtx_tmp word order is now 0 3 2 1. |
| 3420 |
take (operand[1] rts_tmp) and shift left two words |
| 3421 |
3 2 1 0 0 3 2 1 => 1 0 0 3 |
| 3422 |
Input words 0 and 1 are now where they need to be for the |
| 3423 |
conversion. */ |
| 3424 |
rtx_val = GEN_INT (3); |
| 3425 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3426 |
operands[1], rtx_val)); |
| 3427 |
|
| 3428 |
rtx_val = GEN_INT (2); |
| 3429 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3430 |
rtx_tmp, rtx_val)); |
| 3431 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3432 |
} |
| 3433 |
DONE; |
| 3434 |
} |
| 3435 |
[(set_attr "type" "veccomplex")]) |
| 3436 |
|
| 3437 |
;; Generate unsdoublehv |
| 3438 |
;; unsigned int to double convert words 0 and 1 |
| 3439 |
(define_expand "unsdoublehv4si2" |
| 3440 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3441 |
(match_operand:V4SI 1 "register_operand" "v"))] |
| 3442 |
"TARGET_VSX" |
| 3443 |
{ |
| 3444 |
rtx rtx_tmp = gen_reg_rtx (V4SImode); |
| 3445 |
rtx rtx_val = GEN_INT (12); |
| 3446 |
|
| 3447 |
if (BYTES_BIG_ENDIAN) |
| 3448 |
{ |
| 3449 |
/* Big endian word numbering for words in operand is 0 1 2 3. |
| 3450 |
Shift operand left one word, rtx_tmp word order is now 1 2 3 0. |
| 3451 |
take (rts_tmp operand[1]) and shift left three words |
| 3452 |
1 2 3 0 0 1 2 3 => 0 0 1 2 |
| 3453 |
Input words 0 and 1 are now where they need to be for the |
| 3454 |
conversion. */ |
| 3455 |
rtx_val = GEN_INT (1); |
| 3456 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3457 |
operands[1], rtx_val)); |
| 3458 |
|
| 3459 |
rtx_val = GEN_INT (3); |
| 3460 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, rtx_tmp, |
| 3461 |
operands[1], rtx_val)); |
| 3462 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3463 |
} |
| 3464 |
else |
| 3465 |
{ |
| 3466 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3467 |
Shift operand left three words, rtx_tmp word order is now 0 3 2 1. |
| 3468 |
take (operand[1] rts_tmp) and shift left two words |
| 3469 |
3 2 1 0 0 3 2 1 => 1 0 0 3 |
| 3470 |
Input words 1 and 0 are now where they need to be for the |
| 3471 |
conversion. */ |
| 3472 |
rtx_val = GEN_INT (3); |
| 3473 |
|
| 3474 |
rtx_tmp = gen_reg_rtx (V4SImode); |
| 3475 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3476 |
operands[1], rtx_val)); |
| 3477 |
|
| 3478 |
rtx_val = GEN_INT (2); |
| 3479 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3480 |
rtx_tmp, rtx_val)); |
| 3481 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3482 |
} |
| 3483 |
DONE; |
| 3484 |
} |
| 3485 |
[(set_attr "type" "veccomplex")]) |
| 3486 |
|
| 3487 |
;; Generate doublelv |
| 3488 |
;; signed int/float to double convert words 2 and 3 |
| 3489 |
(define_expand "doublel<mode>2" |
| 3490 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3491 |
(match_operand:VSX_W 1 "register_operand" "v"))] |
| 3492 |
"TARGET_VSX" |
| 3493 |
{ |
| 3494 |
rtx rtx_tmp; |
| 3495 |
rtx rtx_val = GEN_INT (3); |
| 3496 |
|
| 3497 |
machine_mode op_mode = GET_MODE (operands[1]); |
| 3498 |
rtx_tmp = gen_reg_rtx (op_mode); |
| 3499 |
|
| 3500 |
if (BYTES_BIG_ENDIAN) |
| 3501 |
{ |
| 3502 |
/* Big endian word numbering for operand is 0 1 2 3. |
| 3503 |
Shift operand left three words, rtx_tmp word order is now 3 0 1 2. |
| 3504 |
take (operand[1] rtx_tmp) and shift left two words |
| 3505 |
0 1 2 3 3 0 1 2 => 2 3 3 0 |
| 3506 |
now use convert instruction to convert word 2 and 3 in the |
| 3507 |
input vector. */ |
| 3508 |
rtx_val = GEN_INT (3); |
| 3509 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3510 |
operands[1], rtx_val)); |
| 3511 |
|
| 3512 |
rtx_val = GEN_INT (2); |
| 3513 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3514 |
rtx_tmp, rtx_val)); |
| 3515 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3516 |
} |
| 3517 |
else |
| 3518 |
{ |
| 3519 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3520 |
Shift operand left one word, rtx_tmp word order is now 2 1 0 3. |
| 3521 |
take (rtx_tmp operand[1]) and shift left three words |
| 3522 |
2 1 0 3 3 2 1 0 => 3 3 2 1 |
| 3523 |
now use convert instruction to convert word 3 and 2 in the |
| 3524 |
input vector. */ |
| 3525 |
rtx_val = GEN_INT (1); |
| 3526 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, operands[1], |
| 3527 |
operands[1], rtx_val)); |
| 3528 |
|
| 3529 |
rtx_val = GEN_INT (3); |
| 3530 |
emit_insn (gen_vsx_xxsldwi_<mode> (rtx_tmp, rtx_tmp, |
| 3531 |
operands[1], rtx_val)); |
| 3532 |
emit_insn (gen_vsx_xvcv<VS_sxwsp>dp (operands[0], rtx_tmp)); |
| 3533 |
} |
| 3534 |
DONE; |
| 3535 |
} |
| 3536 |
[(set_attr "type" "veccomplex")]) |
| 3537 |
|
| 3538 |
;; Generate unsdoublelv |
| 3539 |
;; unsigned int to double convert convert 2 and 3 |
| 3540 |
(define_expand "unsdoublelv4si2" |
| 3541 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 3542 |
(match_operand:V4SI 1 "register_operand" "v"))] |
| 3543 |
"TARGET_VSX" |
| 3544 |
{ |
| 3545 |
rtx rtx_tmp = gen_reg_rtx (V4SImode); |
| 3546 |
rtx rtx_val = GEN_INT (12); |
| 3547 |
|
| 3548 |
if (BYTES_BIG_ENDIAN) |
| 3549 |
{ |
| 3550 |
/* Big endian word numbering for operand is 0 1 2 3. |
| 3551 |
Shift operand left three words, rtx_tmp word order is now 3 0 1 2. |
| 3552 |
take (operand[1] rtx_tmp) and shift left two words |
| 3553 |
0 1 2 3 3 0 1 2 => 2 3 3 0 |
| 3554 |
now use convert instruction to convert word 2 and 3 in the |
| 3555 |
input vector. */ |
| 3556 |
rtx_val = GEN_INT (3); |
| 3557 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3558 |
operands[1], rtx_val)); |
| 3559 |
|
| 3560 |
rtx_val = GEN_INT (2); |
| 3561 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, operands[1], |
| 3562 |
rtx_tmp, rtx_val)); |
| 3563 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3564 |
} |
| 3565 |
else |
| 3566 |
{ |
| 3567 |
/* Little endian word numbering for operand is 3 2 1 0. |
| 3568 |
Shift operand left one word, rtx_tmp word order is now 2 1 0 3. |
| 3569 |
take (rtx_tmp operand[1]) and shift left three words |
| 3570 |
2 1 0 3 3 2 1 0 => 3 3 2 1 |
| 3571 |
now use convert instruction to convert word 3 and 2 in the |
| 3572 |
input vector. */ |
| 3573 |
rtx_val = GEN_INT (1); |
| 3574 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, |
| 3575 |
operands[1], operands[1], rtx_val)); |
| 3576 |
|
| 3577 |
rtx_val = GEN_INT (3); |
| 3578 |
emit_insn (gen_vsx_xxsldwi_v4si (rtx_tmp, rtx_tmp, |
| 3579 |
operands[1], rtx_val)); |
| 3580 |
emit_insn (gen_vsx_xvcvuxwdp (operands[0], rtx_tmp)); |
| 3581 |
} |
| 3582 |
DONE; |
| 3583 |
} |
| 3584 |
[(set_attr "type" "veccomplex")]) |
| 3585 |
|
| 3586 |
;; Generate two vector F32 converted to packed vector I16 vector |
| 3587 |
(define_expand "convert_4f32_8i16" |
| 3588 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3589 |
(unspec:V8HI [(match_operand:V4SF 1 "register_operand" "v") |
| 3590 |
(match_operand:V4SF 2 "register_operand" "v")] |
| 3591 |
UNSPEC_CONVERT_4F32_8I16))] |
| 3592 |
"TARGET_P9_VECTOR" |
| 3593 |
{ |
| 3594 |
rtx rtx_tmp_hi = gen_reg_rtx (V4SImode); |
| 3595 |
rtx rtx_tmp_lo = gen_reg_rtx (V4SImode); |
| 3596 |
|
| 3597 |
emit_insn (gen_altivec_vctuxs (rtx_tmp_hi, operands[1], const0_rtx)); |
| 3598 |
emit_insn (gen_altivec_vctuxs (rtx_tmp_lo, operands[2], const0_rtx)); |
| 3599 |
emit_insn (gen_altivec_vpkswss (operands[0], rtx_tmp_hi, rtx_tmp_lo)); |
| 3600 |
DONE; |
| 3601 |
}) |
| 3602 |
|
| 3603 |
|
| 3604 |
;; Convert two vector F32 to packed vector F16. |
| 3605 |
;; This builtin packs 32-bit floating-point values into a packed |
| 3606 |
;; 16-bit floating point values (stored in 16bit integer type). |
| 3607 |
;; (vector unsigned short r = vec_pack_to_short_fp32 (a, b); |
| 3608 |
;; The expected codegen for this builtin is |
| 3609 |
;; xvcvsphp t, a |
| 3610 |
;; xvcvsphp u, b |
| 3611 |
;; if (little endian) |
| 3612 |
;; vpkuwum r, t, u |
| 3613 |
;; else |
| 3614 |
;; vpkuwum r, u, t |
| 3615 |
|
| 3616 |
(define_expand "convert_4f32_8f16" |
| 3617 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3618 |
(unspec:V8HI [(match_operand:V4SF 1 "register_operand" "v") |
| 3619 |
(match_operand:V4SF 2 "register_operand" "v")] |
| 3620 |
UNSPEC_CONVERT_4F32_8F16))] |
| 3621 |
"TARGET_P9_VECTOR" |
| 3622 |
{ |
| 3623 |
rtx rtx_tmp_hi = gen_reg_rtx (V4SImode); |
| 3624 |
rtx rtx_tmp_lo = gen_reg_rtx (V4SImode); |
| 3625 |
|
| 3626 |
emit_insn (gen_vsx_xvcvsphp (rtx_tmp_hi, operands[1])); |
| 3627 |
emit_insn (gen_vsx_xvcvsphp (rtx_tmp_lo, operands[2])); |
| 3628 |
emit_insn (gen_altivec_vpkuwum (operands[0], rtx_tmp_hi, rtx_tmp_lo)); |
| 3629 |
DONE; |
| 3630 |
}) |
| 3631 |
|
| 3632 |
|
| 3633 |
;; Generate |
| 3634 |
;; xxlxor/vxor SCRATCH0,SCRATCH0,SCRATCH0 |
| 3635 |
;; vsubu?m SCRATCH2,SCRATCH1,%1 |
| 3636 |
;; vmaxs? %0,%1,SCRATCH2" |
| 3637 |
(define_expand "abs<mode>2" |
| 3638 |
[(set (match_dup 2) (match_dup 3)) |
| 3639 |
(set (match_dup 4) |
| 3640 |
(minus:VI2 (match_dup 2) |
| 3641 |
(match_operand:VI2 1 "register_operand" "v"))) |
| 3642 |
(set (match_operand:VI2 0 "register_operand" "=v") |
| 3643 |
(smax:VI2 (match_dup 1) (match_dup 4)))] |
| 3644 |
"<VI_unit>" |
| 3645 |
{ |
| 3646 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 3647 |
operands[3] = CONST0_RTX (<MODE>mode); |
| 3648 |
operands[4] = gen_reg_rtx (<MODE>mode); |
| 3649 |
}) |
| 3650 |
|
| 3651 |
;; Generate |
| 3652 |
;; vspltisw SCRATCH1,0 |
| 3653 |
;; vsubu?m SCRATCH2,SCRATCH1,%1 |
| 3654 |
;; vmins? %0,%1,SCRATCH2" |
| 3655 |
(define_expand "nabs<mode>2" |
| 3656 |
[(set (match_dup 2) (match_dup 3)) |
| 3657 |
(set (match_dup 4) |
| 3658 |
(minus:VI2 (match_dup 2) |
| 3659 |
(match_operand:VI2 1 "register_operand" "v"))) |
| 3660 |
(set (match_operand:VI2 0 "register_operand" "=v") |
| 3661 |
(smin:VI2 (match_dup 1) (match_dup 4)))] |
| 3662 |
"<VI_unit>" |
| 3663 |
{ |
| 3664 |
operands[2] = gen_reg_rtx (<MODE>mode); |
| 3665 |
operands[3] = CONST0_RTX (<MODE>mode); |
| 3666 |
operands[4] = gen_reg_rtx (<MODE>mode); |
| 3667 |
}) |
| 3668 |
|
| 3669 |
;; Generate |
| 3670 |
;; vspltisw SCRATCH1,-1 |
| 3671 |
;; vslw SCRATCH2,SCRATCH1,SCRATCH1 |
| 3672 |
;; vandc %0,%1,SCRATCH2 |
| 3673 |
(define_expand "altivec_absv4sf2" |
| 3674 |
[(set (match_dup 2) |
| 3675 |
(vec_duplicate:V4SI (const_int -1))) |
| 3676 |
(set (match_dup 3) |
| 3677 |
(ashift:V4SI (match_dup 2) (match_dup 2))) |
| 3678 |
(set (match_operand:V4SF 0 "register_operand" "=v") |
| 3679 |
(and:V4SF (not:V4SF (subreg:V4SF (match_dup 3) 0)) |
| 3680 |
(match_operand:V4SF 1 "register_operand" "v")))] |
| 3681 |
"TARGET_ALTIVEC" |
| 3682 |
{ |
| 3683 |
operands[2] = gen_reg_rtx (V4SImode); |
| 3684 |
operands[3] = gen_reg_rtx (V4SImode); |
| 3685 |
}) |
| 3686 |
|
| 3687 |
;; Generate |
| 3688 |
;; vspltis? SCRATCH0,0 |
| 3689 |
;; vsubs?s SCRATCH2,SCRATCH1,%1 |
| 3690 |
;; vmaxs? %0,%1,SCRATCH2" |
| 3691 |
(define_expand "altivec_abss_<mode>" |
| 3692 |
[(set (match_dup 2) (vec_duplicate:VI (const_int 0))) |
| 3693 |
(parallel [(set (match_dup 3) |
| 3694 |
(ss_minus:VI (match_dup 2) |
| 3695 |
(match_operand:VI 1 "register_operand" "v"))) |
| 3696 |
(set (reg:SI VSCR_REGNO) |
| 3697 |
(unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]) |
| 3698 |
(set (match_operand:VI 0 "register_operand" "=v") |
| 3699 |
(smax:VI (match_dup 1) (match_dup 3)))] |
| 3700 |
"TARGET_ALTIVEC" |
| 3701 |
{ |
| 3702 |
operands[2] = gen_reg_rtx (GET_MODE (operands[0])); |
| 3703 |
operands[3] = gen_reg_rtx (GET_MODE (operands[0])); |
| 3704 |
}) |
| 3705 |
|
| 3706 |
(define_expand "reduc_plus_scal_<mode>" |
| 3707 |
[(set (match_operand:<VI_scalar> 0 "register_operand" "=v") |
| 3708 |
(unspec:VIshort [(match_operand:VIshort 1 "register_operand" "v")] |
| 3709 |
UNSPEC_REDUC_PLUS))] |
| 3710 |
"TARGET_ALTIVEC" |
| 3711 |
{ |
| 3712 |
rtx vzero = gen_reg_rtx (V4SImode); |
| 3713 |
rtx vtmp1 = gen_reg_rtx (V4SImode); |
| 3714 |
rtx vtmp2 = gen_reg_rtx (<MODE>mode); |
| 3715 |
rtx dest = gen_lowpart (V4SImode, vtmp2); |
| 3716 |
int elt = BYTES_BIG_ENDIAN ? GET_MODE_NUNITS (<MODE>mode) - 1 : 0; |
| 3717 |
|
| 3718 |
emit_insn (gen_altivec_vspltisw (vzero, const0_rtx)); |
| 3719 |
emit_insn (gen_altivec_vsum4s<VI_char>s (vtmp1, operands[1], vzero)); |
| 3720 |
emit_insn (gen_altivec_vsumsws_direct (dest, vtmp1, vzero)); |
| 3721 |
rs6000_expand_vector_extract (operands[0], vtmp2, GEN_INT (elt)); |
| 3722 |
DONE; |
| 3723 |
}) |
| 3724 |
|
| 3725 |
(define_insn "*p9_neg<mode>2" |
| 3726 |
[(set (match_operand:VNEG 0 "altivec_register_operand" "=v") |
| 3727 |
(neg:VNEG (match_operand:VNEG 1 "altivec_register_operand" "v")))] |
| 3728 |
"TARGET_P9_VECTOR" |
| 3729 |
"vneg<VI_char> %0,%1" |
| 3730 |
[(set_attr "type" "vecsimple")]) |
| 3731 |
|
| 3732 |
(define_expand "neg<mode>2" |
| 3733 |
[(set (match_operand:VI2 0 "register_operand") |
| 3734 |
(neg:VI2 (match_operand:VI2 1 "register_operand")))] |
| 3735 |
"<VI_unit>" |
| 3736 |
{ |
| 3737 |
if (!TARGET_P9_VECTOR || (<MODE>mode != V4SImode && <MODE>mode != V2DImode)) |
| 3738 |
{ |
| 3739 |
rtx vzero; |
| 3740 |
|
| 3741 |
vzero = gen_reg_rtx (GET_MODE (operands[0])); |
| 3742 |
emit_move_insn (vzero, CONST0_RTX (<MODE>mode)); |
| 3743 |
emit_insn (gen_sub<mode>3 (operands[0], vzero, operands[1])); |
| 3744 |
DONE; |
| 3745 |
} |
| 3746 |
}) |
| 3747 |
|
| 3748 |
(define_expand "udot_prodv4si<mode>" |
| 3749 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3750 |
(plus:V4SI (match_operand:V4SI 3 "register_operand" "v") |
| 3751 |
(unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v") |
| 3752 |
(match_operand:VIshort 2 "register_operand" "v")] |
| 3753 |
UNSPEC_VMSUMU)))] |
| 3754 |
"TARGET_ALTIVEC" |
| 3755 |
{ |
| 3756 |
emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], operands[2], operands[3])); |
| 3757 |
DONE; |
| 3758 |
}) |
| 3759 |
|
| 3760 |
(define_expand "sdot_prodv4siv8hi" |
| 3761 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3762 |
(plus:V4SI (match_operand:V4SI 3 "register_operand" "v") |
| 3763 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 3764 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 3765 |
UNSPEC_VMSUMSHM)))] |
| 3766 |
"TARGET_ALTIVEC" |
| 3767 |
{ |
| 3768 |
emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], operands[2], operands[3])); |
| 3769 |
DONE; |
| 3770 |
}) |
| 3771 |
|
| 3772 |
(define_expand "widen_usum<mode>3" |
| 3773 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3774 |
(plus:V4SI (match_operand:V4SI 2 "register_operand" "v") |
| 3775 |
(unspec:V4SI [(match_operand:VIshort 1 "register_operand" "v")] |
| 3776 |
UNSPEC_VMSUMU)))] |
| 3777 |
"TARGET_ALTIVEC" |
| 3778 |
{ |
| 3779 |
rtx vones = gen_reg_rtx (GET_MODE (operands[1])); |
| 3780 |
|
| 3781 |
emit_insn (gen_altivec_vspltis<VI_char> (vones, const1_rtx)); |
| 3782 |
emit_insn (gen_altivec_vmsumu<VI_char>m (operands[0], operands[1], vones, operands[2])); |
| 3783 |
DONE; |
| 3784 |
}) |
| 3785 |
|
| 3786 |
(define_expand "widen_ssumv16qi3" |
| 3787 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3788 |
(plus:V4SI (match_operand:V4SI 2 "register_operand" "v") |
| 3789 |
(unspec:V4SI [(match_operand:V16QI 1 "register_operand" "v")] |
| 3790 |
UNSPEC_VMSUMM)))] |
| 3791 |
"TARGET_ALTIVEC" |
| 3792 |
{ |
| 3793 |
rtx vones = gen_reg_rtx (V16QImode); |
| 3794 |
|
| 3795 |
emit_insn (gen_altivec_vspltisb (vones, const1_rtx)); |
| 3796 |
emit_insn (gen_altivec_vmsummbm (operands[0], operands[1], vones, operands[2])); |
| 3797 |
DONE; |
| 3798 |
}) |
| 3799 |
|
| 3800 |
(define_expand "widen_ssumv8hi3" |
| 3801 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3802 |
(plus:V4SI (match_operand:V4SI 2 "register_operand" "v") |
| 3803 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")] |
| 3804 |
UNSPEC_VMSUMSHM)))] |
| 3805 |
"TARGET_ALTIVEC" |
| 3806 |
{ |
| 3807 |
rtx vones = gen_reg_rtx (V8HImode); |
| 3808 |
|
| 3809 |
emit_insn (gen_altivec_vspltish (vones, const1_rtx)); |
| 3810 |
emit_insn (gen_altivec_vmsumshm (operands[0], operands[1], vones, operands[2])); |
| 3811 |
DONE; |
| 3812 |
}) |
| 3813 |
|
| 3814 |
(define_expand "vec_unpacks_hi_<VP_small_lc>" |
| 3815 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 3816 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 3817 |
UNSPEC_VUNPACK_HI_SIGN_DIRECT))] |
| 3818 |
"<VI_unit>" |
| 3819 |
"") |
| 3820 |
|
| 3821 |
(define_expand "vec_unpacks_lo_<VP_small_lc>" |
| 3822 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 3823 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 3824 |
UNSPEC_VUNPACK_LO_SIGN_DIRECT))] |
| 3825 |
"<VI_unit>" |
| 3826 |
"") |
| 3827 |
|
| 3828 |
(define_insn "vperm_v8hiv4si" |
| 3829 |
[(set (match_operand:V4SI 0 "register_operand" "=?wa,v") |
| 3830 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "wa,v") |
| 3831 |
(match_operand:V4SI 2 "register_operand" "0,v") |
| 3832 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 3833 |
UNSPEC_VPERMSI))] |
| 3834 |
"TARGET_ALTIVEC" |
| 3835 |
"@ |
| 3836 |
xxperm %x0,%x1,%x3 |
| 3837 |
vperm %0,%1,%2,%3" |
| 3838 |
[(set_attr "type" "vecperm") |
| 3839 |
(set_attr "isa" "p9v,*")]) |
| 3840 |
|
| 3841 |
(define_insn "vperm_v16qiv8hi" |
| 3842 |
[(set (match_operand:V8HI 0 "register_operand" "=?wa,v") |
| 3843 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "wa,v") |
| 3844 |
(match_operand:V8HI 2 "register_operand" "0,v") |
| 3845 |
(match_operand:V16QI 3 "register_operand" "wa,v")] |
| 3846 |
UNSPEC_VPERMHI))] |
| 3847 |
"TARGET_ALTIVEC" |
| 3848 |
"@ |
| 3849 |
xxperm %x0,%x1,%x3 |
| 3850 |
vperm %0,%1,%2,%3" |
| 3851 |
[(set_attr "type" "vecperm") |
| 3852 |
(set_attr "isa" "p9v,*")]) |
| 3853 |
|
| 3854 |
(define_expand "vec_unpacku_hi_<VP_small_lc>" |
| 3855 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 3856 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 3857 |
UNSPEC_VUPKHU))] |
| 3858 |
"TARGET_ALTIVEC" |
| 3859 |
{ |
| 3860 |
rtx vzero = gen_reg_rtx (<VP_small>mode); |
| 3861 |
emit_insn (gen_altivec_vspltis<VU_char> (vzero, const0_rtx)); |
| 3862 |
|
| 3863 |
rtx res = gen_reg_rtx (<VP_small>mode); |
| 3864 |
rtx op1 = operands[1]; |
| 3865 |
|
| 3866 |
if (BYTES_BIG_ENDIAN) |
| 3867 |
emit_insn (gen_altivec_vmrgh<VU_char> (res, vzero, op1)); |
| 3868 |
else |
| 3869 |
emit_insn (gen_altivec_vmrgl<VU_char> (res, op1, vzero)); |
| 3870 |
|
| 3871 |
emit_insn (gen_move_insn (operands[0], gen_lowpart (<MODE>mode, res))); |
| 3872 |
DONE; |
| 3873 |
}) |
| 3874 |
|
| 3875 |
(define_expand "vec_unpacku_lo_<VP_small_lc>" |
| 3876 |
[(set (match_operand:VP 0 "register_operand" "=v") |
| 3877 |
(unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")] |
| 3878 |
UNSPEC_VUPKLU))] |
| 3879 |
"TARGET_ALTIVEC" |
| 3880 |
{ |
| 3881 |
rtx vzero = gen_reg_rtx (<VP_small>mode); |
| 3882 |
emit_insn (gen_altivec_vspltis<VU_char> (vzero, const0_rtx)); |
| 3883 |
|
| 3884 |
rtx res = gen_reg_rtx (<VP_small>mode); |
| 3885 |
rtx op1 = operands[1]; |
| 3886 |
|
| 3887 |
if (BYTES_BIG_ENDIAN) |
| 3888 |
emit_insn (gen_altivec_vmrgl<VU_char> (res, vzero, op1)); |
| 3889 |
else |
| 3890 |
emit_insn (gen_altivec_vmrgh<VU_char> (res, op1, vzero)); |
| 3891 |
|
| 3892 |
emit_insn (gen_move_insn (operands[0], gen_lowpart (<MODE>mode, res))); |
| 3893 |
DONE; |
| 3894 |
}) |
| 3895 |
|
| 3896 |
(define_expand "vec_widen_umult_hi_v16qi" |
| 3897 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3898 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 3899 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 3900 |
UNSPEC_VMULWHUB))] |
| 3901 |
"TARGET_ALTIVEC" |
| 3902 |
{ |
| 3903 |
rtx ve = gen_reg_rtx (V8HImode); |
| 3904 |
rtx vo = gen_reg_rtx (V8HImode); |
| 3905 |
|
| 3906 |
if (BYTES_BIG_ENDIAN) |
| 3907 |
{ |
| 3908 |
emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2])); |
| 3909 |
emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2])); |
| 3910 |
emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); |
| 3911 |
} |
| 3912 |
else |
| 3913 |
{ |
| 3914 |
emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2])); |
| 3915 |
emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2])); |
| 3916 |
emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); |
| 3917 |
} |
| 3918 |
DONE; |
| 3919 |
}) |
| 3920 |
|
| 3921 |
(define_expand "vec_widen_umult_lo_v16qi" |
| 3922 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3923 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 3924 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 3925 |
UNSPEC_VMULWLUB))] |
| 3926 |
"TARGET_ALTIVEC" |
| 3927 |
{ |
| 3928 |
rtx ve = gen_reg_rtx (V8HImode); |
| 3929 |
rtx vo = gen_reg_rtx (V8HImode); |
| 3930 |
|
| 3931 |
if (BYTES_BIG_ENDIAN) |
| 3932 |
{ |
| 3933 |
emit_insn (gen_altivec_vmuleub (ve, operands[1], operands[2])); |
| 3934 |
emit_insn (gen_altivec_vmuloub (vo, operands[1], operands[2])); |
| 3935 |
emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); |
| 3936 |
} |
| 3937 |
else |
| 3938 |
{ |
| 3939 |
emit_insn (gen_altivec_vmuloub (ve, operands[1], operands[2])); |
| 3940 |
emit_insn (gen_altivec_vmuleub (vo, operands[1], operands[2])); |
| 3941 |
emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); |
| 3942 |
} |
| 3943 |
DONE; |
| 3944 |
}) |
| 3945 |
|
| 3946 |
(define_expand "vec_widen_smult_hi_v16qi" |
| 3947 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3948 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 3949 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 3950 |
UNSPEC_VMULWHSB))] |
| 3951 |
"TARGET_ALTIVEC" |
| 3952 |
{ |
| 3953 |
rtx ve = gen_reg_rtx (V8HImode); |
| 3954 |
rtx vo = gen_reg_rtx (V8HImode); |
| 3955 |
|
| 3956 |
if (BYTES_BIG_ENDIAN) |
| 3957 |
{ |
| 3958 |
emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2])); |
| 3959 |
emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2])); |
| 3960 |
emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); |
| 3961 |
} |
| 3962 |
else |
| 3963 |
{ |
| 3964 |
emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2])); |
| 3965 |
emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2])); |
| 3966 |
emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); |
| 3967 |
} |
| 3968 |
DONE; |
| 3969 |
}) |
| 3970 |
|
| 3971 |
(define_expand "vec_widen_smult_lo_v16qi" |
| 3972 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 3973 |
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v") |
| 3974 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 3975 |
UNSPEC_VMULWLSB))] |
| 3976 |
"TARGET_ALTIVEC" |
| 3977 |
{ |
| 3978 |
rtx ve = gen_reg_rtx (V8HImode); |
| 3979 |
rtx vo = gen_reg_rtx (V8HImode); |
| 3980 |
|
| 3981 |
if (BYTES_BIG_ENDIAN) |
| 3982 |
{ |
| 3983 |
emit_insn (gen_altivec_vmulesb (ve, operands[1], operands[2])); |
| 3984 |
emit_insn (gen_altivec_vmulosb (vo, operands[1], operands[2])); |
| 3985 |
emit_insn (gen_altivec_vmrglh (operands[0], ve, vo)); |
| 3986 |
} |
| 3987 |
else |
| 3988 |
{ |
| 3989 |
emit_insn (gen_altivec_vmulosb (ve, operands[1], operands[2])); |
| 3990 |
emit_insn (gen_altivec_vmulesb (vo, operands[1], operands[2])); |
| 3991 |
emit_insn (gen_altivec_vmrghh (operands[0], ve, vo)); |
| 3992 |
} |
| 3993 |
DONE; |
| 3994 |
}) |
| 3995 |
|
| 3996 |
(define_expand "vec_widen_umult_hi_v8hi" |
| 3997 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 3998 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 3999 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 4000 |
UNSPEC_VMULWHUH))] |
| 4001 |
"TARGET_ALTIVEC" |
| 4002 |
{ |
| 4003 |
rtx ve = gen_reg_rtx (V4SImode); |
| 4004 |
rtx vo = gen_reg_rtx (V4SImode); |
| 4005 |
|
| 4006 |
if (BYTES_BIG_ENDIAN) |
| 4007 |
{ |
| 4008 |
emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2])); |
| 4009 |
emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2])); |
| 4010 |
emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); |
| 4011 |
} |
| 4012 |
else |
| 4013 |
{ |
| 4014 |
emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2])); |
| 4015 |
emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2])); |
| 4016 |
emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); |
| 4017 |
} |
| 4018 |
DONE; |
| 4019 |
}) |
| 4020 |
|
| 4021 |
(define_expand "vec_widen_umult_lo_v8hi" |
| 4022 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 4023 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 4024 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 4025 |
UNSPEC_VMULWLUH))] |
| 4026 |
"TARGET_ALTIVEC" |
| 4027 |
{ |
| 4028 |
rtx ve = gen_reg_rtx (V4SImode); |
| 4029 |
rtx vo = gen_reg_rtx (V4SImode); |
| 4030 |
|
| 4031 |
if (BYTES_BIG_ENDIAN) |
| 4032 |
{ |
| 4033 |
emit_insn (gen_altivec_vmuleuh (ve, operands[1], operands[2])); |
| 4034 |
emit_insn (gen_altivec_vmulouh (vo, operands[1], operands[2])); |
| 4035 |
emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); |
| 4036 |
} |
| 4037 |
else |
| 4038 |
{ |
| 4039 |
emit_insn (gen_altivec_vmulouh (ve, operands[1], operands[2])); |
| 4040 |
emit_insn (gen_altivec_vmuleuh (vo, operands[1], operands[2])); |
| 4041 |
emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); |
| 4042 |
} |
| 4043 |
DONE; |
| 4044 |
}) |
| 4045 |
|
| 4046 |
(define_expand "vec_widen_smult_hi_v8hi" |
| 4047 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 4048 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 4049 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 4050 |
UNSPEC_VMULWHSH))] |
| 4051 |
"TARGET_ALTIVEC" |
| 4052 |
{ |
| 4053 |
rtx ve = gen_reg_rtx (V4SImode); |
| 4054 |
rtx vo = gen_reg_rtx (V4SImode); |
| 4055 |
|
| 4056 |
if (BYTES_BIG_ENDIAN) |
| 4057 |
{ |
| 4058 |
emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2])); |
| 4059 |
emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2])); |
| 4060 |
emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); |
| 4061 |
} |
| 4062 |
else |
| 4063 |
{ |
| 4064 |
emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2])); |
| 4065 |
emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2])); |
| 4066 |
emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); |
| 4067 |
} |
| 4068 |
DONE; |
| 4069 |
}) |
| 4070 |
|
| 4071 |
(define_expand "vec_widen_smult_lo_v8hi" |
| 4072 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 4073 |
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v") |
| 4074 |
(match_operand:V8HI 2 "register_operand" "v")] |
| 4075 |
UNSPEC_VMULWLSH))] |
| 4076 |
"TARGET_ALTIVEC" |
| 4077 |
{ |
| 4078 |
rtx ve = gen_reg_rtx (V4SImode); |
| 4079 |
rtx vo = gen_reg_rtx (V4SImode); |
| 4080 |
|
| 4081 |
if (BYTES_BIG_ENDIAN) |
| 4082 |
{ |
| 4083 |
emit_insn (gen_altivec_vmulesh (ve, operands[1], operands[2])); |
| 4084 |
emit_insn (gen_altivec_vmulosh (vo, operands[1], operands[2])); |
| 4085 |
emit_insn (gen_altivec_vmrglw (operands[0], ve, vo)); |
| 4086 |
} |
| 4087 |
else |
| 4088 |
{ |
| 4089 |
emit_insn (gen_altivec_vmulosh (ve, operands[1], operands[2])); |
| 4090 |
emit_insn (gen_altivec_vmulesh (vo, operands[1], operands[2])); |
| 4091 |
emit_insn (gen_altivec_vmrghw (operands[0], ve, vo)); |
| 4092 |
} |
| 4093 |
DONE; |
| 4094 |
}) |
| 4095 |
|
| 4096 |
(define_expand "vec_pack_trunc_<mode>" |
| 4097 |
[(set (match_operand:<VP_small> 0 "register_operand" "=v") |
| 4098 |
(unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v") |
| 4099 |
(match_operand:VP 2 "register_operand" "v")] |
| 4100 |
UNSPEC_VPACK_UNS_UNS_MOD))] |
| 4101 |
"<VI_unit>" |
| 4102 |
"") |
| 4103 |
|
| 4104 |
(define_expand "mulv16qi3" |
| 4105 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4106 |
(mult:V16QI (match_operand:V16QI 1 "register_operand" "v") |
| 4107 |
(match_operand:V16QI 2 "register_operand" "v")))] |
| 4108 |
"TARGET_ALTIVEC" |
| 4109 |
{ |
| 4110 |
rtx even = gen_reg_rtx (V8HImode); |
| 4111 |
rtx odd = gen_reg_rtx (V8HImode); |
| 4112 |
rtx mask = gen_reg_rtx (V16QImode); |
| 4113 |
rtvec v = rtvec_alloc (16); |
| 4114 |
int i; |
| 4115 |
|
| 4116 |
for (i = 0; i < 8; ++i) { |
| 4117 |
RTVEC_ELT (v, 2 * i) |
| 4118 |
= gen_rtx_CONST_INT (QImode, BYTES_BIG_ENDIAN ? 2 * i + 1 : 31 - 2 * i); |
| 4119 |
RTVEC_ELT (v, 2 * i + 1) |
| 4120 |
= gen_rtx_CONST_INT (QImode, BYTES_BIG_ENDIAN ? 2 * i + 17 : 15 - 2 * i); |
| 4121 |
} |
| 4122 |
|
| 4123 |
emit_insn (gen_vec_initv16qiqi (mask, gen_rtx_PARALLEL (V16QImode, v))); |
| 4124 |
emit_insn (gen_altivec_vmulesb (even, operands[1], operands[2])); |
| 4125 |
emit_insn (gen_altivec_vmulosb (odd, operands[1], operands[2])); |
| 4126 |
emit_insn (gen_altivec_vperm_v8hiv16qi (operands[0], even, odd, mask)); |
| 4127 |
DONE; |
| 4128 |
}) |
| 4129 |
|
| 4130 |
(define_expand "altivec_vpermxor" |
| 4131 |
[(use (match_operand:V16QI 0 "register_operand")) |
| 4132 |
(use (match_operand:V16QI 1 "register_operand")) |
| 4133 |
(use (match_operand:V16QI 2 "register_operand")) |
| 4134 |
(use (match_operand:V16QI 3 "register_operand"))] |
| 4135 |
"TARGET_P8_VECTOR" |
| 4136 |
{ |
| 4137 |
if (!BYTES_BIG_ENDIAN) |
| 4138 |
{ |
| 4139 |
/* vpermxor indexes the bytes using Big Endian numbering. If LE, |
| 4140 |
change indexing in operand[3] to BE index. */ |
| 4141 |
rtx be_index = gen_reg_rtx (V16QImode); |
| 4142 |
|
| 4143 |
emit_insn (gen_one_cmplv16qi2 (be_index, operands[3])); |
| 4144 |
emit_insn (gen_crypto_vpermxor_v16qi (operands[0], operands[1], |
| 4145 |
operands[2], be_index)); |
| 4146 |
} |
| 4147 |
else |
| 4148 |
emit_insn (gen_crypto_vpermxor_v16qi (operands[0], operands[1], |
| 4149 |
operands[2], operands[3])); |
| 4150 |
DONE; |
| 4151 |
}) |
| 4152 |
|
| 4153 |
(define_expand "altivec_negv4sf2" |
| 4154 |
[(use (match_operand:V4SF 0 "register_operand")) |
| 4155 |
(use (match_operand:V4SF 1 "register_operand"))] |
| 4156 |
"TARGET_ALTIVEC" |
| 4157 |
{ |
| 4158 |
rtx neg0; |
| 4159 |
|
| 4160 |
/* Generate [-0.0, -0.0, -0.0, -0.0]. */ |
| 4161 |
neg0 = gen_reg_rtx (V4SImode); |
| 4162 |
emit_insn (gen_altivec_vspltisw (neg0, constm1_rtx)); |
| 4163 |
emit_insn (gen_vashlv4si3 (neg0, neg0, neg0)); |
| 4164 |
|
| 4165 |
/* XOR */ |
| 4166 |
emit_insn (gen_xorv4sf3 (operands[0], |
| 4167 |
gen_lowpart (V4SFmode, neg0), operands[1])); |
| 4168 |
|
| 4169 |
DONE; |
| 4170 |
}) |
| 4171 |
|
| 4172 |
;; Vector reverse elements for V16QI V8HI V4SI V4SF |
| 4173 |
(define_expand "altivec_vreve<mode>2" |
| 4174 |
[(set (match_operand:VEC_K 0 "register_operand" "=v") |
| 4175 |
(unspec:VEC_K [(match_operand:VEC_K 1 "register_operand" "v")] |
| 4176 |
UNSPEC_VREVEV))] |
| 4177 |
"TARGET_ALTIVEC" |
| 4178 |
{ |
| 4179 |
if (TARGET_P9_VECTOR) |
| 4180 |
{ |
| 4181 |
if (<MODE>mode == V16QImode) |
| 4182 |
emit_insn (gen_p9_xxbrq_v16qi (operands[0], operands[1])); |
| 4183 |
else if (<MODE>mode == V8HImode) |
| 4184 |
{ |
| 4185 |
rtx subreg1 = simplify_gen_subreg (V1TImode, operands[1], |
| 4186 |
<MODE>mode, 0); |
| 4187 |
rtx temp = gen_reg_rtx (V1TImode); |
| 4188 |
emit_insn (gen_p9_xxbrq_v1ti (temp, subreg1)); |
| 4189 |
rtx subreg2 = simplify_gen_subreg (<MODE>mode, temp, |
| 4190 |
V1TImode, 0); |
| 4191 |
emit_insn (gen_p9_xxbrh_v8hi (operands[0], subreg2)); |
| 4192 |
} |
| 4193 |
else /* V4SI and V4SF. */ |
| 4194 |
{ |
| 4195 |
rtx subreg1 = simplify_gen_subreg (V1TImode, operands[1], |
| 4196 |
<MODE>mode, 0); |
| 4197 |
rtx temp = gen_reg_rtx (V1TImode); |
| 4198 |
emit_insn (gen_p9_xxbrq_v1ti (temp, subreg1)); |
| 4199 |
rtx subreg2 = simplify_gen_subreg (<MODE>mode, temp, |
| 4200 |
V1TImode, 0); |
| 4201 |
if (<MODE>mode == V4SImode) |
| 4202 |
emit_insn (gen_p9_xxbrw_v4si (operands[0], subreg2)); |
| 4203 |
else |
| 4204 |
emit_insn (gen_p9_xxbrw_v4sf (operands[0], subreg2)); |
| 4205 |
} |
| 4206 |
DONE; |
| 4207 |
} |
| 4208 |
|
| 4209 |
int i, j, size, num_elements; |
| 4210 |
rtvec v = rtvec_alloc (16); |
| 4211 |
rtx mask = gen_reg_rtx (V16QImode); |
| 4212 |
|
| 4213 |
size = GET_MODE_UNIT_SIZE (<MODE>mode); |
| 4214 |
num_elements = GET_MODE_NUNITS (<MODE>mode); |
| 4215 |
|
| 4216 |
for (j = 0; j < num_elements; j++) |
| 4217 |
for (i = 0; i < size; i++) |
| 4218 |
RTVEC_ELT (v, i + j * size) |
| 4219 |
= GEN_INT (i + (num_elements - 1 - j) * size); |
| 4220 |
|
| 4221 |
emit_insn (gen_vec_initv16qiqi (mask, gen_rtx_PARALLEL (V16QImode, v))); |
| 4222 |
emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], |
| 4223 |
operands[1], mask)); |
| 4224 |
DONE; |
| 4225 |
}) |
| 4226 |
|
| 4227 |
;; Vector reverse elements for V2DI V2DF |
| 4228 |
(define_expand "altivec_vreve<mode>2" |
| 4229 |
[(set (match_operand:VEC_64 0 "register_operand" "=v") |
| 4230 |
(unspec:VEC_64 [(match_operand:VEC_64 1 "register_operand" "v")] |
| 4231 |
UNSPEC_VREVEV))] |
| 4232 |
"TARGET_ALTIVEC" |
| 4233 |
{ |
| 4234 |
emit_insn (gen_xxswapd_<mode> (operands[0], operands[1])); |
| 4235 |
DONE; |
| 4236 |
}) |
| 4237 |
|
| 4238 |
;; Vector SIMD PEM v2.06c defines LVLX, LVLXL, LVRX, LVRXL, |
| 4239 |
;; STVLX, STVLXL, STVVRX, STVRXL are available only on Cell. |
| 4240 |
(define_insn "altivec_lvlx" |
| 4241 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4242 |
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "Z")] |
| 4243 |
UNSPEC_LVLX))] |
| 4244 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4245 |
"lvlx %0,%y1" |
| 4246 |
[(set_attr "type" "vecload")]) |
| 4247 |
|
| 4248 |
(define_insn "altivec_lvlxl" |
| 4249 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4250 |
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "Z")] |
| 4251 |
UNSPEC_LVLXL))] |
| 4252 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4253 |
"lvlxl %0,%y1" |
| 4254 |
[(set_attr "type" "vecload")]) |
| 4255 |
|
| 4256 |
(define_insn "altivec_lvrx" |
| 4257 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4258 |
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "Z")] |
| 4259 |
UNSPEC_LVRX))] |
| 4260 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4261 |
"lvrx %0,%y1" |
| 4262 |
[(set_attr "type" "vecload")]) |
| 4263 |
|
| 4264 |
(define_insn "altivec_lvrxl" |
| 4265 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4266 |
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "Z")] |
| 4267 |
UNSPEC_LVRXL))] |
| 4268 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4269 |
"lvrxl %0,%y1" |
| 4270 |
[(set_attr "type" "vecload")]) |
| 4271 |
|
| 4272 |
(define_insn "altivec_stvlx" |
| 4273 |
[(parallel |
| 4274 |
[(set (match_operand:V16QI 0 "memory_operand" "=Z") |
| 4275 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 4276 |
(unspec [(const_int 0)] UNSPEC_STVLX)])] |
| 4277 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4278 |
"stvlx %1,%y0" |
| 4279 |
[(set_attr "type" "vecstore")]) |
| 4280 |
|
| 4281 |
(define_insn "altivec_stvlxl" |
| 4282 |
[(parallel |
| 4283 |
[(set (match_operand:V16QI 0 "memory_operand" "=Z") |
| 4284 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 4285 |
(unspec [(const_int 0)] UNSPEC_STVLXL)])] |
| 4286 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4287 |
"stvlxl %1,%y0" |
| 4288 |
[(set_attr "type" "vecstore")]) |
| 4289 |
|
| 4290 |
(define_insn "altivec_stvrx" |
| 4291 |
[(parallel |
| 4292 |
[(set (match_operand:V16QI 0 "memory_operand" "=Z") |
| 4293 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 4294 |
(unspec [(const_int 0)] UNSPEC_STVRX)])] |
| 4295 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4296 |
"stvrx %1,%y0" |
| 4297 |
[(set_attr "type" "vecstore")]) |
| 4298 |
|
| 4299 |
(define_insn "altivec_stvrxl" |
| 4300 |
[(parallel |
| 4301 |
[(set (match_operand:V16QI 0 "memory_operand" "=Z") |
| 4302 |
(match_operand:V16QI 1 "register_operand" "v")) |
| 4303 |
(unspec [(const_int 0)] UNSPEC_STVRXL)])] |
| 4304 |
"TARGET_ALTIVEC && rs6000_cpu == PROCESSOR_CELL" |
| 4305 |
"stvrxl %1,%y0" |
| 4306 |
[(set_attr "type" "vecstore")]) |
| 4307 |
|
| 4308 |
(define_expand "vec_unpacks_float_hi_v8hi" |
| 4309 |
[(set (match_operand:V4SF 0 "register_operand") |
| 4310 |
(unspec:V4SF [(match_operand:V8HI 1 "register_operand")] |
| 4311 |
UNSPEC_VUPKHS_V4SF))] |
| 4312 |
"TARGET_ALTIVEC" |
| 4313 |
{ |
| 4314 |
rtx tmp = gen_reg_rtx (V4SImode); |
| 4315 |
|
| 4316 |
emit_insn (gen_vec_unpacks_hi_v8hi (tmp, operands[1])); |
| 4317 |
emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx)); |
| 4318 |
DONE; |
| 4319 |
}) |
| 4320 |
|
| 4321 |
(define_expand "vec_unpacks_float_lo_v8hi" |
| 4322 |
[(set (match_operand:V4SF 0 "register_operand") |
| 4323 |
(unspec:V4SF [(match_operand:V8HI 1 "register_operand")] |
| 4324 |
UNSPEC_VUPKLS_V4SF))] |
| 4325 |
"TARGET_ALTIVEC" |
| 4326 |
{ |
| 4327 |
rtx tmp = gen_reg_rtx (V4SImode); |
| 4328 |
|
| 4329 |
emit_insn (gen_vec_unpacks_lo_v8hi (tmp, operands[1])); |
| 4330 |
emit_insn (gen_altivec_vcfsx (operands[0], tmp, const0_rtx)); |
| 4331 |
DONE; |
| 4332 |
}) |
| 4333 |
|
| 4334 |
(define_expand "vec_unpacku_float_hi_v8hi" |
| 4335 |
[(set (match_operand:V4SF 0 "register_operand") |
| 4336 |
(unspec:V4SF [(match_operand:V8HI 1 "register_operand")] |
| 4337 |
UNSPEC_VUPKHU_V4SF))] |
| 4338 |
"TARGET_ALTIVEC" |
| 4339 |
{ |
| 4340 |
rtx tmp = gen_reg_rtx (V4SImode); |
| 4341 |
|
| 4342 |
emit_insn (gen_vec_unpacku_hi_v8hi (tmp, operands[1])); |
| 4343 |
emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx)); |
| 4344 |
DONE; |
| 4345 |
}) |
| 4346 |
|
| 4347 |
(define_expand "vec_unpacku_float_lo_v8hi" |
| 4348 |
[(set (match_operand:V4SF 0 "register_operand") |
| 4349 |
(unspec:V4SF [(match_operand:V8HI 1 "register_operand")] |
| 4350 |
UNSPEC_VUPKLU_V4SF))] |
| 4351 |
"TARGET_ALTIVEC" |
| 4352 |
{ |
| 4353 |
rtx tmp = gen_reg_rtx (V4SImode); |
| 4354 |
|
| 4355 |
emit_insn (gen_vec_unpacku_lo_v8hi (tmp, operands[1])); |
| 4356 |
emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx)); |
| 4357 |
DONE; |
| 4358 |
}) |
| 4359 |
|
| 4360 |
|
| 4361 |
;; Power8/power9 vector instructions encoded as Altivec instructions |
| 4362 |
|
| 4363 |
;; Vector count leading zeros |
| 4364 |
(define_insn "*p8v_clz<mode>2" |
| 4365 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 4366 |
(clz:VI2 (match_operand:VI2 1 "register_operand" "v")))] |
| 4367 |
"TARGET_P8_VECTOR" |
| 4368 |
"vclz<wd> %0,%1" |
| 4369 |
[(set_attr "type" "vecsimple")]) |
| 4370 |
|
| 4371 |
;; Vector absolute difference unsigned |
| 4372 |
(define_insn "uabd<mode>3" |
| 4373 |
[(set (match_operand:VI 0 "register_operand" "=v") |
| 4374 |
(minus:VI |
| 4375 |
(umax:VI |
| 4376 |
(match_operand:VI 1 "register_operand" "v") |
| 4377 |
(match_operand:VI 2 "register_operand" "v")) |
| 4378 |
(umin:VI |
| 4379 |
(match_dup 1) |
| 4380 |
(match_dup 2))))] |
| 4381 |
"TARGET_P9_VECTOR" |
| 4382 |
"vabsdu<wd> %0,%1,%2" |
| 4383 |
[(set_attr "type" "vecsimple")]) |
| 4384 |
|
| 4385 |
;; Vector count trailing zeros |
| 4386 |
(define_insn "*p9v_ctz<mode>2" |
| 4387 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 4388 |
(ctz:VI2 (match_operand:VI2 1 "register_operand" "v")))] |
| 4389 |
"TARGET_P9_VECTOR" |
| 4390 |
"vctz<wd> %0,%1" |
| 4391 |
[(set_attr "type" "vecsimple")]) |
| 4392 |
|
| 4393 |
;; Vector population count |
| 4394 |
(define_insn "*p8v_popcount<mode>2" |
| 4395 |
[(set (match_operand:VI2 0 "register_operand" "=v") |
| 4396 |
(popcount:VI2 (match_operand:VI2 1 "register_operand" "v")))] |
| 4397 |
"TARGET_P8_VECTOR" |
| 4398 |
"vpopcnt<wd> %0,%1" |
| 4399 |
[(set_attr "type" "vecsimple")]) |
| 4400 |
|
| 4401 |
;; Vector parity |
| 4402 |
(define_insn "rs6000_vprtyb<mode>2" |
| 4403 |
[(set (match_operand:VEC_IP 0 "register_operand" "=v") |
| 4404 |
(unspec:VEC_IP |
| 4405 |
[(match_operand:VEC_IP 1 "register_operand" "v")] |
| 4406 |
UNSPEC_PARITY))] |
| 4407 |
"TARGET_P9_VECTOR" |
| 4408 |
"vprtyb<wd> %0,%1" |
| 4409 |
[(set_attr "type" "vecsimple")]) |
| 4410 |
|
| 4411 |
;; Vector Gather Bits by Bytes by Doubleword |
| 4412 |
(define_insn "p8v_vgbbd" |
| 4413 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4414 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")] |
| 4415 |
UNSPEC_VGBBD))] |
| 4416 |
"TARGET_P8_VECTOR" |
| 4417 |
"vgbbd %0,%1" |
| 4418 |
[(set_attr "type" "vecsimple")]) |
| 4419 |
|
| 4420 |
|
| 4421 |
;; 128-bit binary integer arithmetic |
| 4422 |
;; We have a special container type (V1TImode) to allow operations using the |
| 4423 |
;; ISA 2.07 128-bit binary support to target the VMX/altivec registers without |
| 4424 |
;; having to worry about the register allocator deciding GPRs are better. |
| 4425 |
|
| 4426 |
(define_insn "addv1ti3" |
| 4427 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4428 |
(plus:V1TI (match_operand:V1TI 1 "register_operand" "v") |
| 4429 |
(match_operand:V1TI 2 "register_operand" "v")))] |
| 4430 |
"TARGET_VADDUQM" |
| 4431 |
"vadduqm %0,%1,%2" |
| 4432 |
[(set_attr "type" "vecsimple")]) |
| 4433 |
|
| 4434 |
(define_insn "altivec_vaddcuq" |
| 4435 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4436 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4437 |
(match_operand:V1TI 2 "register_operand" "v")] |
| 4438 |
UNSPEC_VADDCUQ))] |
| 4439 |
"TARGET_VADDUQM" |
| 4440 |
"vaddcuq %0,%1,%2" |
| 4441 |
[(set_attr "type" "vecsimple")]) |
| 4442 |
|
| 4443 |
(define_insn "subv1ti3" |
| 4444 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4445 |
(minus:V1TI (match_operand:V1TI 1 "register_operand" "v") |
| 4446 |
(match_operand:V1TI 2 "register_operand" "v")))] |
| 4447 |
"TARGET_VADDUQM" |
| 4448 |
"vsubuqm %0,%1,%2" |
| 4449 |
[(set_attr "type" "vecsimple")]) |
| 4450 |
|
| 4451 |
(define_insn "altivec_vsubcuq" |
| 4452 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4453 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4454 |
(match_operand:V1TI 2 "register_operand" "v")] |
| 4455 |
UNSPEC_VSUBCUQ))] |
| 4456 |
"TARGET_VADDUQM" |
| 4457 |
"vsubcuq %0,%1,%2" |
| 4458 |
[(set_attr "type" "vecsimple")]) |
| 4459 |
|
| 4460 |
(define_insn "altivec_vaddeuqm" |
| 4461 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4462 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4463 |
(match_operand:V1TI 2 "register_operand" "v") |
| 4464 |
(match_operand:V1TI 3 "register_operand" "v")] |
| 4465 |
UNSPEC_VADDEUQM))] |
| 4466 |
"TARGET_VADDUQM" |
| 4467 |
"vaddeuqm %0,%1,%2,%3" |
| 4468 |
[(set_attr "type" "vecsimple")]) |
| 4469 |
|
| 4470 |
(define_insn "altivec_vaddecuq" |
| 4471 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4472 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4473 |
(match_operand:V1TI 2 "register_operand" "v") |
| 4474 |
(match_operand:V1TI 3 "register_operand" "v")] |
| 4475 |
UNSPEC_VADDECUQ))] |
| 4476 |
"TARGET_VADDUQM" |
| 4477 |
"vaddecuq %0,%1,%2,%3" |
| 4478 |
[(set_attr "type" "vecsimple")]) |
| 4479 |
|
| 4480 |
(define_insn "altivec_vsubeuqm" |
| 4481 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4482 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4483 |
(match_operand:V1TI 2 "register_operand" "v") |
| 4484 |
(match_operand:V1TI 3 "register_operand" "v")] |
| 4485 |
UNSPEC_VSUBEUQM))] |
| 4486 |
"TARGET_VADDUQM" |
| 4487 |
"vsubeuqm %0,%1,%2,%3" |
| 4488 |
[(set_attr "type" "vecsimple")]) |
| 4489 |
|
| 4490 |
(define_insn "altivec_vsubecuq" |
| 4491 |
[(set (match_operand:V1TI 0 "register_operand" "=v") |
| 4492 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand" "v") |
| 4493 |
(match_operand:V1TI 2 "register_operand" "v") |
| 4494 |
(match_operand:V1TI 3 "register_operand" "v")] |
| 4495 |
UNSPEC_VSUBECUQ))] |
| 4496 |
"TARGET_VADDUQM" |
| 4497 |
"vsubecuq %0,%1,%2,%3" |
| 4498 |
[(set_attr "type" "vecsimple")]) |
| 4499 |
|
| 4500 |
;; We use V2DI as the output type to simplify converting the permute |
| 4501 |
;; bits into an integer |
| 4502 |
(define_insn "altivec_vbpermq" |
| 4503 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 4504 |
(unspec:V2DI [(match_operand:V16QI 1 "register_operand" "v") |
| 4505 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 4506 |
UNSPEC_VBPERMQ))] |
| 4507 |
"TARGET_P8_VECTOR" |
| 4508 |
"vbpermq %0,%1,%2" |
| 4509 |
[(set_attr "type" "vecperm")]) |
| 4510 |
|
| 4511 |
; One of the vector API interfaces requires returning vector unsigned char. |
| 4512 |
(define_insn "altivec_vbpermq2" |
| 4513 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4514 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") |
| 4515 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 4516 |
UNSPEC_VBPERMQ))] |
| 4517 |
"TARGET_P8_VECTOR" |
| 4518 |
"vbpermq %0,%1,%2" |
| 4519 |
[(set_attr "type" "vecperm")]) |
| 4520 |
|
| 4521 |
(define_insn "altivec_vbpermd" |
| 4522 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 4523 |
(unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v") |
| 4524 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 4525 |
UNSPEC_VBPERMD))] |
| 4526 |
"TARGET_P9_VECTOR" |
| 4527 |
"vbpermd %0,%1,%2" |
| 4528 |
[(set_attr "type" "vecsimple")]) |
| 4529 |
|
| 4530 |
;; Support for SAD (sum of absolute differences). |
| 4531 |
|
| 4532 |
;; Due to saturating semantics, we can't combine the sum-across |
| 4533 |
;; with the vector accumulate in vsum4ubs. A vadduwm is needed. |
| 4534 |
(define_expand "usadv16qi" |
| 4535 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 4536 |
(use (match_operand:V16QI 1 "register_operand")) |
| 4537 |
(use (match_operand:V16QI 2 "register_operand")) |
| 4538 |
(use (match_operand:V4SI 3 "register_operand"))] |
| 4539 |
"TARGET_P9_VECTOR" |
| 4540 |
{ |
| 4541 |
rtx absd = gen_reg_rtx (V16QImode); |
| 4542 |
rtx zero = gen_reg_rtx (V4SImode); |
| 4543 |
rtx psum = gen_reg_rtx (V4SImode); |
| 4544 |
|
| 4545 |
emit_insn (gen_uabdv16qi3 (absd, operands[1], operands[2])); |
| 4546 |
emit_insn (gen_altivec_vspltisw (zero, const0_rtx)); |
| 4547 |
emit_insn (gen_altivec_vsum4ubs (psum, absd, zero)); |
| 4548 |
emit_insn (gen_addv4si3 (operands[0], psum, operands[3])); |
| 4549 |
DONE; |
| 4550 |
}) |
| 4551 |
|
| 4552 |
;; Since vsum4shs is saturating and further performs signed |
| 4553 |
;; arithmetic, we can't combine the sum-across with the vector |
| 4554 |
;; accumulate in vsum4shs. A vadduwm is needed. |
| 4555 |
(define_expand "usadv8hi" |
| 4556 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 4557 |
(use (match_operand:V8HI 1 "register_operand")) |
| 4558 |
(use (match_operand:V8HI 2 "register_operand")) |
| 4559 |
(use (match_operand:V4SI 3 "register_operand"))] |
| 4560 |
"TARGET_P9_VECTOR" |
| 4561 |
{ |
| 4562 |
rtx absd = gen_reg_rtx (V8HImode); |
| 4563 |
rtx zero = gen_reg_rtx (V4SImode); |
| 4564 |
rtx psum = gen_reg_rtx (V4SImode); |
| 4565 |
|
| 4566 |
emit_insn (gen_uabdv8hi3 (absd, operands[1], operands[2])); |
| 4567 |
emit_insn (gen_altivec_vspltisw (zero, const0_rtx)); |
| 4568 |
emit_insn (gen_altivec_vsum4shs (psum, absd, zero)); |
| 4569 |
emit_insn (gen_addv4si3 (operands[0], psum, operands[3])); |
| 4570 |
DONE; |
| 4571 |
}) |
| 4572 |
|
| 4573 |
;; Decimal Integer operations |
| 4574 |
(define_int_iterator UNSPEC_BCD_ADD_SUB [UNSPEC_BCDADD UNSPEC_BCDSUB]) |
| 4575 |
|
| 4576 |
(define_int_attr bcd_add_sub [(UNSPEC_BCDADD "add") |
| 4577 |
(UNSPEC_BCDSUB "sub")]) |
| 4578 |
|
| 4579 |
(define_code_iterator BCD_TEST [eq lt le gt ge unordered]) |
| 4580 |
(define_mode_iterator VBCD [V1TI V16QI]) |
| 4581 |
|
| 4582 |
(define_insn "bcd<bcd_add_sub>_<mode>" |
| 4583 |
[(set (match_operand:VBCD 0 "register_operand" "=v") |
| 4584 |
(unspec:VBCD [(match_operand:VBCD 1 "register_operand" "v") |
| 4585 |
(match_operand:VBCD 2 "register_operand" "v") |
| 4586 |
(match_operand:QI 3 "const_0_to_1_operand" "n")] |
| 4587 |
UNSPEC_BCD_ADD_SUB)) |
| 4588 |
(clobber (reg:CCFP CR6_REGNO))] |
| 4589 |
"TARGET_P8_VECTOR" |
| 4590 |
"bcd<bcd_add_sub>. %0,%1,%2,%3" |
| 4591 |
[(set_attr "type" "vecsimple")]) |
| 4592 |
|
| 4593 |
;; Use a floating point type (V2DFmode) for the compare to set CR6 so that we |
| 4594 |
;; can use the unordered test for BCD nans and add/subtracts that overflow. An |
| 4595 |
;; UNORDERED test on an integer type (like V1TImode) is not defined. The type |
| 4596 |
;; probably should be one that can go in the VMX (Altivec) registers, so we |
| 4597 |
;; can't use DDmode or DFmode. |
| 4598 |
(define_insn "*bcd<bcd_add_sub>_test_<mode>" |
| 4599 |
[(set (reg:CCFP CR6_REGNO) |
| 4600 |
(compare:CCFP |
| 4601 |
(unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v") |
| 4602 |
(match_operand:VBCD 2 "register_operand" "v") |
| 4603 |
(match_operand:QI 3 "const_0_to_1_operand" "i")] |
| 4604 |
UNSPEC_BCD_ADD_SUB) |
| 4605 |
(match_operand:V2DF 4 "zero_constant" "j"))) |
| 4606 |
(clobber (match_scratch:VBCD 0 "=v"))] |
| 4607 |
"TARGET_P8_VECTOR" |
| 4608 |
"bcd<bcd_add_sub>. %0,%1,%2,%3" |
| 4609 |
[(set_attr "type" "vecsimple")]) |
| 4610 |
|
| 4611 |
(define_insn "*bcd<bcd_add_sub>_test2_<mode>" |
| 4612 |
[(set (match_operand:VBCD 0 "register_operand" "=v") |
| 4613 |
(unspec:VBCD [(match_operand:VBCD 1 "register_operand" "v") |
| 4614 |
(match_operand:VBCD 2 "register_operand" "v") |
| 4615 |
(match_operand:QI 3 "const_0_to_1_operand" "i")] |
| 4616 |
UNSPEC_BCD_ADD_SUB)) |
| 4617 |
(set (reg:CCFP CR6_REGNO) |
| 4618 |
(compare:CCFP |
| 4619 |
(unspec:V2DF [(match_dup 1) |
| 4620 |
(match_dup 2) |
| 4621 |
(match_dup 3)] |
| 4622 |
UNSPEC_BCD_ADD_SUB) |
| 4623 |
(match_operand:V2DF 4 "zero_constant" "j")))] |
| 4624 |
"TARGET_P8_VECTOR" |
| 4625 |
"bcd<bcd_add_sub>. %0,%1,%2,%3" |
| 4626 |
[(set_attr "type" "vecsimple")]) |
| 4627 |
|
| 4628 |
(define_insn "vcfuged" |
| 4629 |
[(set (match_operand:V2DI 0 "altivec_register_operand" "=v") |
| 4630 |
(unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4631 |
(match_operand:V2DI 2 "altivec_register_operand" "v")] |
| 4632 |
UNSPEC_VCFUGED))] |
| 4633 |
"TARGET_POWER10" |
| 4634 |
"vcfuged %0,%1,%2" |
| 4635 |
[(set_attr "type" "vecsimple")]) |
| 4636 |
|
| 4637 |
(define_insn "vclzdm" |
| 4638 |
[(set (match_operand:V2DI 0 "altivec_register_operand" "=v") |
| 4639 |
(unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4640 |
(match_operand:V2DI 2 "altivec_register_operand" "v")] |
| 4641 |
UNSPEC_VCLZDM))] |
| 4642 |
"TARGET_POWER10" |
| 4643 |
"vclzdm %0,%1,%2" |
| 4644 |
[(set_attr "type" "vecsimple")]) |
| 4645 |
|
| 4646 |
(define_insn "vctzdm" |
| 4647 |
[(set (match_operand:V2DI 0 "altivec_register_operand" "=v") |
| 4648 |
(unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4649 |
(match_operand:V2DI 2 "altivec_register_operand" "v")] |
| 4650 |
UNSPEC_VCTZDM))] |
| 4651 |
"TARGET_POWER10" |
| 4652 |
"vctzdm %0,%1,%2" |
| 4653 |
[(set_attr "type" "vecsimple")]) |
| 4654 |
|
| 4655 |
(define_insn "vpdepd" |
| 4656 |
[(set (match_operand:V2DI 0 "altivec_register_operand" "=v") |
| 4657 |
(unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4658 |
(match_operand:V2DI 2 "altivec_register_operand" "v")] |
| 4659 |
UNSPEC_VPDEPD))] |
| 4660 |
"TARGET_POWER10" |
| 4661 |
"vpdepd %0,%1,%2" |
| 4662 |
[(set_attr "type" "vecsimple")]) |
| 4663 |
|
| 4664 |
(define_insn "vpextd" |
| 4665 |
[(set (match_operand:V2DI 0 "altivec_register_operand" "=v") |
| 4666 |
(unspec:V2DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4667 |
(match_operand:V2DI 2 "altivec_register_operand" "v")] |
| 4668 |
UNSPEC_VPEXTD))] |
| 4669 |
"TARGET_POWER10" |
| 4670 |
"vpextd %0,%1,%2" |
| 4671 |
[(set_attr "type" "vecsimple")]) |
| 4672 |
|
| 4673 |
(define_insn "vgnb" |
| 4674 |
[(set (match_operand:DI 0 "register_operand" "=r") |
| 4675 |
(unspec:DI [(match_operand:V2DI 1 "altivec_register_operand" "v") |
| 4676 |
(match_operand:QI 2 "u3bit_cint_operand" "n")] |
| 4677 |
UNSPEC_VGNB))] |
| 4678 |
"TARGET_POWER10" |
| 4679 |
"vgnb %0,%1,%2" |
| 4680 |
[(set_attr "type" "vecsimple")]) |
| 4681 |
|
| 4682 |
(define_insn "vclrlb" |
| 4683 |
[(set (match_operand:V16QI 0 "altivec_register_operand" "=v") |
| 4684 |
(unspec:V16QI [(match_operand:V16QI 1 "altivec_register_operand" "v") |
| 4685 |
(match_operand:SI 2 "gpc_reg_operand" "r")] |
| 4686 |
UNSPEC_VCLRLB))] |
| 4687 |
"TARGET_POWER10" |
| 4688 |
{ |
| 4689 |
if (BYTES_BIG_ENDIAN) |
| 4690 |
return "vclrlb %0,%1,%2"; |
| 4691 |
else |
| 4692 |
return "vclrrb %0,%1,%2"; |
| 4693 |
} |
| 4694 |
[(set_attr "type" "vecsimple")]) |
| 4695 |
|
| 4696 |
(define_insn "vclrrb" |
| 4697 |
[(set (match_operand:V16QI 0 "altivec_register_operand" "=v") |
| 4698 |
(unspec:V16QI [(match_operand:V16QI 1 "altivec_register_operand" "v") |
| 4699 |
(match_operand:SI 2 "gpc_reg_operand" "r")] |
| 4700 |
UNSPEC_VCLRRB))] |
| 4701 |
"TARGET_POWER10" |
| 4702 |
{ |
| 4703 |
if (BYTES_BIG_ENDIAN) |
| 4704 |
return "vclrrb %0,%1,%2"; |
| 4705 |
else |
| 4706 |
return "vclrlb %0,%1,%2"; |
| 4707 |
} |
| 4708 |
[(set_attr "type" "vecsimple")]) |
| 4709 |
|
| 4710 |
(define_expand "bcd<bcd_add_sub>_<code>_<mode>" |
| 4711 |
[(parallel [(set (reg:CCFP CR6_REGNO) |
| 4712 |
(compare:CCFP |
| 4713 |
(unspec:V2DF [(match_operand:VBCD 1 "register_operand") |
| 4714 |
(match_operand:VBCD 2 "register_operand") |
| 4715 |
(match_operand:QI 3 "const_0_to_1_operand")] |
| 4716 |
UNSPEC_BCD_ADD_SUB) |
| 4717 |
(match_dup 4))) |
| 4718 |
(clobber (match_scratch:VBCD 5))]) |
| 4719 |
(set (match_operand:SI 0 "register_operand") |
| 4720 |
(BCD_TEST:SI (reg:CCFP CR6_REGNO) |
| 4721 |
(const_int 0)))] |
| 4722 |
"TARGET_P8_VECTOR" |
| 4723 |
{ |
| 4724 |
operands[4] = CONST0_RTX (V2DFmode); |
| 4725 |
}) |
| 4726 |
|
| 4727 |
(define_insn "*bcdinvalid_<mode>" |
| 4728 |
[(set (reg:CCFP CR6_REGNO) |
| 4729 |
(compare:CCFP |
| 4730 |
(unspec:V2DF [(match_operand:VBCD 1 "register_operand" "v")] |
| 4731 |
UNSPEC_BCDSUB) |
| 4732 |
(match_operand:V2DF 2 "zero_constant" "j"))) |
| 4733 |
(clobber (match_scratch:VBCD 0 "=v"))] |
| 4734 |
"TARGET_P8_VECTOR" |
| 4735 |
"bcdsub. %0,%1,%1,0" |
| 4736 |
[(set_attr "type" "vecsimple")]) |
| 4737 |
|
| 4738 |
(define_expand "bcdinvalid_<mode>" |
| 4739 |
[(parallel [(set (reg:CCFP CR6_REGNO) |
| 4740 |
(compare:CCFP |
| 4741 |
(unspec:V2DF [(match_operand:VBCD 1 "register_operand")] |
| 4742 |
UNSPEC_BCDSUB) |
| 4743 |
(match_dup 2))) |
| 4744 |
(clobber (match_scratch:VBCD 3))]) |
| 4745 |
(set (match_operand:SI 0 "register_operand") |
| 4746 |
(unordered:SI (reg:CCFP CR6_REGNO) |
| 4747 |
(const_int 0)))] |
| 4748 |
"TARGET_P8_VECTOR" |
| 4749 |
{ |
| 4750 |
operands[2] = CONST0_RTX (V2DFmode); |
| 4751 |
}) |
| 4752 |
|
| 4753 |
(define_insn "bcdshift_v16qi" |
| 4754 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 4755 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v") |
| 4756 |
(match_operand:V16QI 2 "register_operand" "v") |
| 4757 |
(match_operand:QI 3 "const_0_to_1_operand" "n")] |
| 4758 |
UNSPEC_BCDSHIFT)) |
| 4759 |
(clobber (reg:CCFP CR6_REGNO))] |
| 4760 |
"TARGET_P8_VECTOR" |
| 4761 |
"bcds. %0,%1,%2,%3" |
| 4762 |
[(set_attr "type" "vecsimple")]) |
| 4763 |
|
| 4764 |
(define_expand "bcdmul10_v16qi" |
| 4765 |
[(set (match_operand:V16QI 0 "register_operand") |
| 4766 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand")] |
| 4767 |
UNSPEC_BCDSHIFT)) |
| 4768 |
(clobber (reg:CCFP CR6_REGNO))] |
| 4769 |
"TARGET_P9_VECTOR" |
| 4770 |
{ |
| 4771 |
rtx one = gen_reg_rtx (V16QImode); |
| 4772 |
|
| 4773 |
emit_insn (gen_altivec_vspltisb (one, const1_rtx)); |
| 4774 |
emit_insn (gen_bcdshift_v16qi (operands[0], one, operands[1], const0_rtx)); |
| 4775 |
|
| 4776 |
DONE; |
| 4777 |
}) |
| 4778 |
|
| 4779 |
(define_expand "bcddiv10_v16qi" |
| 4780 |
[(set (match_operand:V16QI 0 "register_operand") |
| 4781 |
(unspec:V16QI [(match_operand:V16QI 1 "register_operand")] |
| 4782 |
UNSPEC_BCDSHIFT)) |
| 4783 |
(clobber (reg:CCFP CR6_REGNO))] |
| 4784 |
"TARGET_P9_VECTOR" |
| 4785 |
{ |
| 4786 |
rtx one = gen_reg_rtx (V16QImode); |
| 4787 |
|
| 4788 |
emit_insn (gen_altivec_vspltisb (one, constm1_rtx)); |
| 4789 |
emit_insn (gen_bcdshift_v16qi (operands[0], one, operands[1], const0_rtx)); |
| 4790 |
|
| 4791 |
DONE; |
| 4792 |
}) |
| 4793 |
|
| 4794 |
|
| 4795 |
;; Peephole2 pattern to combine a bcdadd/bcdsub that calculates the value and |
| 4796 |
;; the bcdadd/bcdsub that tests the value. The combiner won't work since |
| 4797 |
;; CR6 is a hard coded register. Unfortunately, all of the Altivec predicate |
| 4798 |
;; support is hard coded to use the fixed register CR6 instead of creating |
| 4799 |
;; a register class for CR6. |
| 4800 |
|
| 4801 |
(define_peephole2 |
| 4802 |
[(parallel [(set (match_operand:V1TI 0 "register_operand") |
| 4803 |
(unspec:V1TI [(match_operand:V1TI 1 "register_operand") |
| 4804 |
(match_operand:V1TI 2 "register_operand") |
| 4805 |
(match_operand:QI 3 "const_0_to_1_operand")] |
| 4806 |
UNSPEC_BCD_ADD_SUB)) |
| 4807 |
(clobber (reg:CCFP CR6_REGNO))]) |
| 4808 |
(parallel [(set (reg:CCFP CR6_REGNO) |
| 4809 |
(compare:CCFP |
| 4810 |
(unspec:V2DF [(match_dup 1) |
| 4811 |
(match_dup 2) |
| 4812 |
(match_dup 3)] |
| 4813 |
UNSPEC_BCD_ADD_SUB) |
| 4814 |
(match_operand:V2DF 4 "zero_constant"))) |
| 4815 |
(clobber (match_operand:V1TI 5 "register_operand"))])] |
| 4816 |
"TARGET_P8_VECTOR" |
| 4817 |
[(parallel [(set (match_dup 0) |
| 4818 |
(unspec:V1TI [(match_dup 1) |
| 4819 |
(match_dup 2) |
| 4820 |
(match_dup 3)] |
| 4821 |
UNSPEC_BCD_ADD_SUB)) |
| 4822 |
(set (reg:CCFP CR6_REGNO) |
| 4823 |
(compare:CCFP |
| 4824 |
(unspec:V2DF [(match_dup 1) |
| 4825 |
(match_dup 2) |
| 4826 |
(match_dup 3)] |
| 4827 |
UNSPEC_BCD_ADD_SUB) |
| 4828 |
(match_dup 4)))])]) |