| 1 |
;;- Instruction patterns for the System z vector facility builtins. |
| 2 |
;; Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by Andreas Krebbel ([email protected]) |
| 4 |
|
| 5 |
;; This file is part of GCC. |
| 6 |
|
| 7 |
;; GCC is free software; you can redistribute it and/or modify it under |
| 8 |
;; the terms of the GNU General Public License as published by the Free |
| 9 |
;; Software Foundation; either version 3, or (at your option) any later |
| 10 |
;; version. |
| 11 |
|
| 12 |
;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 |
;; WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 14 |
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 |
;; 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 |
; The patterns in this file are enabled with -mzvector |
| 22 |
|
| 23 |
(define_mode_iterator V_HW_32_64 [V4SI V2DI V2DF (V4SF "TARGET_VXE")]) |
| 24 |
(define_mode_iterator VI_HW_SD [V4SI V2DI]) |
| 25 |
|
| 26 |
; Full size vector modes with more than one element which are directly supported in vector registers by the hardware. |
| 27 |
(define_mode_iterator VEC_HW [V16QI V8HI V4SI V2DI V2DF (V4SF "TARGET_VXE")]) |
| 28 |
(define_mode_iterator VECF_HW [(V4SF "TARGET_VXE") V2DF]) |
| 29 |
|
| 30 |
; The element type of the vector with floating point modes translated |
| 31 |
; to int modes of the same size. |
| 32 |
(define_mode_attr non_vec_int[(V1QI "QI") (V2QI "QI") (V4QI "QI") (V8QI "QI") (V16QI "QI") |
| 33 |
(V1HI "HI") (V2HI "HI") (V4HI "HI") (V8HI "HI") |
| 34 |
(V1SI "SI") (V2SI "SI") (V4SI "SI") |
| 35 |
(V1DI "DI") (V2DI "DI") |
| 36 |
(V1SF "SI") (V2SF "SI") (V4SF "SI") |
| 37 |
(V1DF "DI") (V2DF "DI")]) |
| 38 |
|
| 39 |
; Condition code modes generated by int comparisons |
| 40 |
(define_mode_iterator VICMP [CCVEQ CCVIH CCVIHU]) |
| 41 |
|
| 42 |
; Comparisons supported by the vec_cmp* builtins |
| 43 |
(define_code_iterator intcmp [eq gt gtu ge geu lt ltu le leu]) |
| 44 |
(define_code_iterator fpcmp [eq gt ge lt le]) |
| 45 |
|
| 46 |
; Comparisons supported by the vec_all/any* builtins |
| 47 |
(define_code_iterator intcmpcc [eq ne gt ge lt le gtu geu ltu leu]) |
| 48 |
(define_code_iterator fpcmpcc [eq ne gt ge unle unlt lt le]) |
| 49 |
|
| 50 |
; Flags for vector string instructions (vfae all 4, vfee only ZS and CS, vstrc all 4) |
| 51 |
(define_constants |
| 52 |
[(VSTRING_FLAG_IN 8) ; invert result |
| 53 |
(VSTRING_FLAG_RT 4) ; result type |
| 54 |
(VSTRING_FLAG_ZS 2) ; zero search |
| 55 |
(VSTRING_FLAG_CS 1)]) ; condition code set |
| 56 |
|
| 57 |
; Rounding modes as being used for e.g. VFI |
| 58 |
(define_constants |
| 59 |
[(VEC_RND_CURRENT 0) |
| 60 |
(VEC_RND_NEAREST_AWAY_FROM_ZERO 1) |
| 61 |
(VEC_RND_SHORT_PREC 3) |
| 62 |
(VEC_RND_NEAREST_TO_EVEN 4) |
| 63 |
(VEC_RND_TO_ZERO 5) |
| 64 |
(VEC_RND_TO_INF 6) |
| 65 |
(VEC_RND_TO_MINF 7)]) |
| 66 |
|
| 67 |
; Inexact suppression facility flag as being used for e.g. VFI |
| 68 |
(define_constants |
| 69 |
[(VEC_INEXACT 0) |
| 70 |
(VEC_NOINEXACT 4)]) |
| 71 |
|
| 72 |
|
| 73 |
; Vector gather element |
| 74 |
|
| 75 |
; vgef, vgeg |
| 76 |
(define_insn "vec_gather_element<mode>" |
| 77 |
[(set (match_operand:V_HW_32_64 0 "register_operand" "=v") |
| 78 |
(unspec:V_HW_32_64 [(match_operand:V_HW_32_64 1 "register_operand" "0") |
| 79 |
(match_operand:<TOINTVEC> 2 "register_operand" "v") |
| 80 |
(match_operand:BLK 3 "memory_operand" "R") |
| 81 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 82 |
UNSPEC_VEC_GATHER))] |
| 83 |
"TARGET_VX && UINTVAL (operands[4]) < GET_MODE_NUNITS (<V_HW_32_64:MODE>mode)" |
| 84 |
"vge<bhfgq>\t%0,%O3(%v2,%R3),%b4" |
| 85 |
[(set_attr "op_type" "VRV")]) |
| 86 |
|
| 87 |
(define_expand "vec_genmask<mode>" |
| 88 |
[(match_operand:VI_HW 0 "register_operand" "=v") |
| 89 |
(match_operand:QI 1 "const_int_operand" "C") |
| 90 |
(match_operand:QI 2 "const_int_operand" "C")] |
| 91 |
"TARGET_VX" |
| 92 |
{ |
| 93 |
int bitlen = GET_MODE_UNIT_BITSIZE (<VI_HW:MODE>mode); |
| 94 |
/* To bit little endian style. */ |
| 95 |
int end = bitlen - 1 - INTVAL (operands[1]); |
| 96 |
int start = bitlen - 1 - INTVAL (operands[2]); |
| 97 |
int i; |
| 98 |
unsigned HOST_WIDE_INT mask; |
| 99 |
bool swapped_p = false; |
| 100 |
|
| 101 |
if (start > end) |
| 102 |
{ |
| 103 |
i = start - 1; start = end + 1; end = i; |
| 104 |
swapped_p = true; |
| 105 |
} |
| 106 |
if (end == 63) |
| 107 |
mask = HOST_WIDE_INT_M1U; |
| 108 |
else |
| 109 |
mask = (HOST_WIDE_INT_1U << (end + 1)) - 1; |
| 110 |
|
| 111 |
mask &= ~((HOST_WIDE_INT_1U << start) - 1); |
| 112 |
|
| 113 |
if (swapped_p) |
| 114 |
mask = ~mask; |
| 115 |
|
| 116 |
rtx mask_rtx = gen_int_mode (mask, GET_MODE_INNER (<VI_HW:MODE>mode)); |
| 117 |
|
| 118 |
emit_insn (gen_rtx_SET (operands[0], |
| 119 |
gen_const_vec_duplicate (<VI_HW:MODE>mode, |
| 120 |
mask_rtx))); |
| 121 |
DONE; |
| 122 |
}) |
| 123 |
|
| 124 |
(define_expand "vec_genbytemaskv16qi" |
| 125 |
[(match_operand:V16QI 0 "register_operand" "") |
| 126 |
(match_operand:HI 1 "const_int_operand" "")] |
| 127 |
"TARGET_VX" |
| 128 |
{ |
| 129 |
int i; |
| 130 |
unsigned mask = 0x8000; |
| 131 |
rtx const_vec[16]; |
| 132 |
unsigned HOST_WIDE_INT byte_mask = UINTVAL (operands[1]); |
| 133 |
|
| 134 |
for (i = 0; i < 16; i++) |
| 135 |
{ |
| 136 |
if (mask & byte_mask) |
| 137 |
const_vec[i] = constm1_rtx; |
| 138 |
else |
| 139 |
const_vec[i] = const0_rtx; |
| 140 |
mask = mask >> 1; |
| 141 |
} |
| 142 |
emit_insn (gen_rtx_SET (operands[0], |
| 143 |
gen_rtx_CONST_VECTOR (V16QImode, |
| 144 |
gen_rtvec_v (16, const_vec)))); |
| 145 |
DONE; |
| 146 |
}) |
| 147 |
|
| 148 |
(define_expand "@vec_splats<mode>" |
| 149 |
[(set (match_operand:VEC_HW 0 "register_operand" "") |
| 150 |
(vec_duplicate:VEC_HW (match_operand:<non_vec> 1 "general_operand" "")))] |
| 151 |
"TARGET_VX") |
| 152 |
|
| 153 |
(define_expand "vec_insert<mode>" |
| 154 |
[(set (match_operand:VEC_HW 0 "register_operand" "") |
| 155 |
(unspec:VEC_HW [(match_operand:<non_vec> 2 "register_operand" "") |
| 156 |
(match_operand:SI 3 "nonmemory_operand" "") |
| 157 |
(match_operand:VEC_HW 1 "register_operand" "")] |
| 158 |
UNSPEC_VEC_SET))] |
| 159 |
"TARGET_VX" |
| 160 |
"") |
| 161 |
|
| 162 |
; This is vec_set + modulo arithmetic on the element selector (op 2) |
| 163 |
(define_expand "vec_promote<mode>" |
| 164 |
[(set (match_operand:VEC_HW 0 "register_operand" "") |
| 165 |
(unspec:VEC_HW [(match_operand:<non_vec> 1 "register_operand" "") |
| 166 |
(match_operand:SI 2 "nonmemory_operand" "") |
| 167 |
(match_dup 0)] |
| 168 |
UNSPEC_VEC_SET))] |
| 169 |
"TARGET_VX" |
| 170 |
"") |
| 171 |
|
| 172 |
; vec_extract is also an RTL standard name -> vector.md |
| 173 |
|
| 174 |
; vllezb, vllezh, vllezf, vllezg |
| 175 |
(define_insn "vec_insert_and_zero<mode>" |
| 176 |
[(set (match_operand:VEC_HW 0 "register_operand" "=v") |
| 177 |
(unspec:VEC_HW [(match_operand:<non_vec> 1 "memory_operand" "R")] |
| 178 |
UNSPEC_VEC_INSERT_AND_ZERO))] |
| 179 |
"TARGET_VX" |
| 180 |
"vllez<bhfgq>\t%v0,%1" |
| 181 |
[(set_attr "op_type" "VRX")]) |
| 182 |
|
| 183 |
; vec_revb (vec_insert_and_zero(x)) bswap-and-replicate-1.c |
| 184 |
; vllebrzh, vllebrzf, vllebrzg |
| 185 |
(define_insn "*vec_insert_and_zero_bswap<mode>" |
| 186 |
[(set (match_operand:V_HW_HSD 0 "register_operand" "=v") |
| 187 |
(bswap:V_HW_HSD (unspec:V_HW_HSD |
| 188 |
[(match_operand:<non_vec> 1 "memory_operand" "R")] |
| 189 |
UNSPEC_VEC_INSERT_AND_ZERO))) |
| 190 |
(use (match_operand:V16QI 2 "permute_pattern_operand" "X"))] |
| 191 |
"TARGET_VXE2" |
| 192 |
"vllebrz<bhfgq>\t%v0,%1" |
| 193 |
[(set_attr "op_type" "VRX")]) |
| 194 |
|
| 195 |
|
| 196 |
(define_insn "vlbb" |
| 197 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 198 |
(unspec:V16QI [(match_operand:BLK 1 "memory_operand" "R") |
| 199 |
(match_operand:QI 2 "const_mask_operand" "C")] |
| 200 |
UNSPEC_VEC_LOAD_BNDRY))] |
| 201 |
"TARGET_VX && UINTVAL (operands[2]) < 7" |
| 202 |
"vlbb\t%v0,%1,%2" |
| 203 |
[(set_attr "op_type" "VRX")]) |
| 204 |
|
| 205 |
; Vector load rightmost with length |
| 206 |
|
| 207 |
(define_expand "vlrlrv16qi" |
| 208 |
[(set (match_operand:V16QI 0 "register_operand" "") |
| 209 |
(unspec:V16QI [(match_operand:BLK 2 "memory_operand" "") |
| 210 |
(match_operand:SI 1 "nonmemory_operand" "")] |
| 211 |
UNSPEC_VEC_LOAD_LEN_R))] |
| 212 |
"TARGET_VXE" |
| 213 |
{ |
| 214 |
/* vlrlr sets all length values beyond 15 to 15. Emulate the same |
| 215 |
behavior for immediate length operands. vlrl would trigger a |
| 216 |
SIGILL for too large immediate operands. */ |
| 217 |
if (CONST_INT_P (operands[1]) |
| 218 |
&& (UINTVAL (operands[1]) & 0xffffffff) > 15) |
| 219 |
operands[1] = GEN_INT (15); |
| 220 |
}) |
| 221 |
|
| 222 |
(define_insn "*vlrlrv16qi" |
| 223 |
[(set (match_operand:V16QI 0 "register_operand" "=v, v, v") |
| 224 |
(unspec:V16QI [(match_operand:BLK 2 "memory_operand" "Q, R, Q") |
| 225 |
(match_operand:SI 1 "nonmemory_operand" "d,j>f,jb4")] |
| 226 |
UNSPEC_VEC_LOAD_LEN_R))] |
| 227 |
"TARGET_VXE" |
| 228 |
"@ |
| 229 |
vlrlr\t%v0,%1,%2 |
| 230 |
vl\t%v0,%2%A2 |
| 231 |
vlrl\t%v0,%2,%1" |
| 232 |
[(set_attr "op_type" "VRS,VRX,VSI")]) |
| 233 |
|
| 234 |
|
| 235 |
; vmrhb, vmrhh, vmrhf, vmrhg |
| 236 |
(define_expand "vec_mergeh<mode>" |
| 237 |
[(match_operand:V_128_NOSINGLE 0 "register_operand" "") |
| 238 |
(match_operand:V_128_NOSINGLE 1 "register_operand" "") |
| 239 |
(match_operand:V_128_NOSINGLE 2 "register_operand" "")] |
| 240 |
"TARGET_VX" |
| 241 |
{ |
| 242 |
s390_expand_merge (operands[0], operands[1], operands[2], true); |
| 243 |
DONE; |
| 244 |
}) |
| 245 |
|
| 246 |
; vmrlb, vmrlh, vmrlf, vmrlg |
| 247 |
(define_expand "vec_mergel<mode>" |
| 248 |
[(match_operand:V_128_NOSINGLE 0 "register_operand" "") |
| 249 |
(match_operand:V_128_NOSINGLE 1 "register_operand" "") |
| 250 |
(match_operand:V_128_NOSINGLE 2 "register_operand" "")] |
| 251 |
"TARGET_VX" |
| 252 |
{ |
| 253 |
s390_expand_merge (operands[0], operands[1], operands[2], false); |
| 254 |
DONE; |
| 255 |
}) |
| 256 |
|
| 257 |
|
| 258 |
; Vector pack |
| 259 |
|
| 260 |
; vpkh, vpkf, vpkg |
| 261 |
(define_insn "vec_pack<mode>" |
| 262 |
[(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 263 |
(unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 264 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 265 |
UNSPEC_VEC_PACK))] |
| 266 |
"TARGET_VX" |
| 267 |
"vpk<bhfgq>\t%v0,%v1,%v2" |
| 268 |
[(set_attr "op_type" "VRR")]) |
| 269 |
|
| 270 |
|
| 271 |
; Vector pack saturate |
| 272 |
|
| 273 |
; vpksh, vpksf, vpksg |
| 274 |
(define_insn "vec_packs<mode>" |
| 275 |
[(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 276 |
(unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 277 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 278 |
UNSPEC_VEC_PACK_SATURATE))] |
| 279 |
"TARGET_VX" |
| 280 |
"vpks<bhfgq>\t%v0,%v1,%v2" |
| 281 |
[(set_attr "op_type" "VRR")]) |
| 282 |
|
| 283 |
|
| 284 |
; This is vec_packs_cc + loading cc into a caller specified memory location. |
| 285 |
(define_expand "vec_packs_cc<mode>" |
| 286 |
[(parallel |
| 287 |
[(set (reg:CCRAW CC_REGNUM) |
| 288 |
(unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "") |
| 289 |
(match_operand:VI_HW_HSD 2 "register_operand" "")] |
| 290 |
UNSPEC_VEC_PACK_SATURATE_GENCC)) |
| 291 |
(set (match_operand:<vec_half> 0 "register_operand" "") |
| 292 |
(unspec:<vec_half> [(match_dup 1) (match_dup 2)] |
| 293 |
UNSPEC_VEC_PACK_SATURATE_CC))]) |
| 294 |
(set (match_dup 4) |
| 295 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT)) |
| 296 |
(set (match_operand:SI 3 "memory_operand" "") |
| 297 |
(match_dup 4))] |
| 298 |
"TARGET_VX" |
| 299 |
{ |
| 300 |
operands[4] = gen_reg_rtx (SImode); |
| 301 |
}) |
| 302 |
|
| 303 |
; vpksh, vpksf, vpksg |
| 304 |
(define_insn "*vec_packs_cc<mode>" |
| 305 |
[(set (reg:CCRAW CC_REGNUM) |
| 306 |
(unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 307 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 308 |
UNSPEC_VEC_PACK_SATURATE_GENCC)) |
| 309 |
(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 310 |
(unspec:<vec_half> [(match_dup 1) (match_dup 2)] |
| 311 |
UNSPEC_VEC_PACK_SATURATE_CC))] |
| 312 |
"TARGET_VX" |
| 313 |
"vpks<bhfgq>s\t%v0,%v1,%v2" |
| 314 |
[(set_attr "op_type" "VRR")]) |
| 315 |
|
| 316 |
|
| 317 |
; Vector pack logical saturate |
| 318 |
|
| 319 |
; vpklsh, vpklsf, vpklsg |
| 320 |
(define_insn "vec_packsu<mode>" |
| 321 |
[(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 322 |
(unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 323 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 324 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE))] |
| 325 |
"TARGET_VX" |
| 326 |
"vpkls<bhfgq>\t%v0,%v1,%v2" |
| 327 |
[(set_attr "op_type" "VRR")]) |
| 328 |
|
| 329 |
; Emulate saturate unsigned pack on signed operands. |
| 330 |
; Zero out negative elements and continue with the unsigned saturating pack. |
| 331 |
(define_expand "vec_packsu_u<mode>" |
| 332 |
[(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 333 |
(unspec:<vec_half> [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 334 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 335 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE))] |
| 336 |
"TARGET_VX" |
| 337 |
{ |
| 338 |
rtx null_vec = CONST0_RTX(<MODE>mode); |
| 339 |
machine_mode half_mode; |
| 340 |
switch (<MODE>mode) |
| 341 |
{ |
| 342 |
case E_V8HImode: half_mode = V16QImode; break; |
| 343 |
case E_V4SImode: half_mode = V8HImode; break; |
| 344 |
case E_V2DImode: half_mode = V4SImode; break; |
| 345 |
default: gcc_unreachable (); |
| 346 |
} |
| 347 |
s390_expand_vcond (operands[1], operands[1], null_vec, |
| 348 |
GE, operands[1], null_vec); |
| 349 |
s390_expand_vcond (operands[2], operands[2], null_vec, |
| 350 |
GE, operands[2], null_vec); |
| 351 |
emit_insn (gen_rtx_SET (operands[0], |
| 352 |
gen_rtx_UNSPEC (half_mode, |
| 353 |
gen_rtvec (2, operands[1], operands[2]), |
| 354 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE))); |
| 355 |
DONE; |
| 356 |
}) |
| 357 |
|
| 358 |
; This is vec_packsu_cc + loading cc into a caller specified memory location. |
| 359 |
; FIXME: The reg to target mem copy should be issued by reload?! |
| 360 |
(define_expand "vec_packsu_cc<mode>" |
| 361 |
[(parallel |
| 362 |
[(set (reg:CCRAW CC_REGNUM) |
| 363 |
(unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "") |
| 364 |
(match_operand:VI_HW_HSD 2 "register_operand" "")] |
| 365 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC)) |
| 366 |
(set (match_operand:<vec_half> 0 "register_operand" "") |
| 367 |
(unspec:<vec_half> [(match_dup 1) (match_dup 2)] |
| 368 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC))]) |
| 369 |
(set (match_dup 4) |
| 370 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT)) |
| 371 |
(set (match_operand:SI 3 "memory_operand" "") |
| 372 |
(match_dup 4))] |
| 373 |
"TARGET_VX" |
| 374 |
{ |
| 375 |
operands[4] = gen_reg_rtx (SImode); |
| 376 |
}) |
| 377 |
|
| 378 |
; vpklsh, vpklsf, vpklsg |
| 379 |
(define_insn "*vec_packsu_cc<mode>" |
| 380 |
[(set (reg:CCRAW CC_REGNUM) |
| 381 |
(unspec:CCRAW [(match_operand:VI_HW_HSD 1 "register_operand" "v") |
| 382 |
(match_operand:VI_HW_HSD 2 "register_operand" "v")] |
| 383 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE_GENCC)) |
| 384 |
(set (match_operand:<vec_half> 0 "register_operand" "=v") |
| 385 |
(unspec:<vec_half> [(match_dup 1) (match_dup 2)] |
| 386 |
UNSPEC_VEC_PACK_UNSIGNED_SATURATE_CC))] |
| 387 |
"TARGET_VX" |
| 388 |
"vpkls<bhfgq>s\t%v0,%v1,%v2" |
| 389 |
[(set_attr "op_type" "VRR")]) |
| 390 |
|
| 391 |
|
| 392 |
; Vector permute |
| 393 |
|
| 394 |
; vec_perm is also RTL standard name, but we can only use it for V16QI |
| 395 |
|
| 396 |
(define_insn "vec_zperm<mode>" |
| 397 |
[(set (match_operand:V_HW_HSD 0 "register_operand" "=v") |
| 398 |
(unspec:V_HW_HSD [(match_operand:V_HW_HSD 1 "register_operand" "v") |
| 399 |
(match_operand:V_HW_HSD 2 "register_operand" "v") |
| 400 |
(match_operand:V16QI 3 "register_operand" "v")] |
| 401 |
UNSPEC_VEC_PERM))] |
| 402 |
"TARGET_VX" |
| 403 |
"vperm\t%v0,%v1,%v2,%v3" |
| 404 |
[(set_attr "op_type" "VRR")]) |
| 405 |
|
| 406 |
; Incoming op3 is in vec_permi format and will we turned into a |
| 407 |
; permute vector consisting of op3 and op4. |
| 408 |
(define_expand "vec_permi<mode>" |
| 409 |
[(set (match_operand:V_HW_2 0 "register_operand" "") |
| 410 |
(vec_select:V_HW_2 |
| 411 |
(vec_concat:<vec_2x_nelts> |
| 412 |
(match_operand:V_HW_2 1 "register_operand" "") |
| 413 |
(match_operand:V_HW_2 2 "register_operand" "")) |
| 414 |
(parallel [(match_operand:QI 3 "const_mask_operand" "") (match_dup 4)])))] |
| 415 |
"TARGET_VX" |
| 416 |
{ |
| 417 |
HOST_WIDE_INT val = INTVAL (operands[3]); |
| 418 |
operands[3] = GEN_INT ((val & 2) >> 1); |
| 419 |
operands[4] = GEN_INT ((val & 1) + 2); |
| 420 |
}) |
| 421 |
|
| 422 |
|
| 423 |
; Vector replicate |
| 424 |
|
| 425 |
|
| 426 |
; Replicate from vector element |
| 427 |
(define_expand "@vec_splat<mode>" |
| 428 |
[(set (match_operand:V_HW 0 "register_operand" "") |
| 429 |
(vec_duplicate:V_HW (vec_select:<non_vec> |
| 430 |
(match_operand:V_HW 1 "register_operand" "") |
| 431 |
(parallel |
| 432 |
[(match_operand:QI 2 "const_mask_operand" "")]))))] |
| 433 |
"TARGET_VX") |
| 434 |
|
| 435 |
; Vector scatter element |
| 436 |
|
| 437 |
; vscef, vsceg |
| 438 |
|
| 439 |
; A 64 bit target address generated from 32 bit elements |
| 440 |
(define_insn "vec_scatter_element<V_HW_4:mode>_DI" |
| 441 |
[(set (mem:<non_vec> |
| 442 |
(plus:DI (zero_extend:DI |
| 443 |
(vec_select:SI |
| 444 |
(match_operand:V4SI 1 "register_operand" "v") |
| 445 |
(parallel [(match_operand:QI 3 "const_mask_operand" "C")]))) |
| 446 |
(match_operand:SI 2 "address_operand" "ZQ"))) |
| 447 |
(vec_select:<non_vec> |
| 448 |
(match_operand:V_HW_4 0 "register_operand" "v") |
| 449 |
(parallel [(match_dup 3)])))] |
| 450 |
"TARGET_VX && TARGET_64BIT && UINTVAL (operands[3]) < 4" |
| 451 |
"vscef\t%v0,%O2(%v1,%R2),%3" |
| 452 |
[(set_attr "op_type" "VRV")]) |
| 453 |
|
| 454 |
; A 31 bit target address is generated from 64 bit elements |
| 455 |
; vsceg |
| 456 |
(define_insn "vec_scatter_element<V_HW_2:mode>_SI" |
| 457 |
[(set (mem:<non_vec> |
| 458 |
(plus:SI (subreg:SI |
| 459 |
(vec_select:<non_vec_int> |
| 460 |
(match_operand:<TOINTVEC> 1 "register_operand" "v") |
| 461 |
(parallel [(match_operand:QI 3 "const_mask_operand" "C")])) 4) |
| 462 |
(match_operand:SI 2 "address_operand" "ZQ"))) |
| 463 |
(vec_select:<non_vec> |
| 464 |
(match_operand:V_HW_2 0 "register_operand" "v") |
| 465 |
(parallel [(match_dup 3)])))] |
| 466 |
"TARGET_VX && !TARGET_64BIT && UINTVAL (operands[3]) < GET_MODE_NUNITS (<V_HW_2:MODE>mode)" |
| 467 |
"vsce<V_HW_2:bhfgq>\t%v0,%O2(%v1,%R2),%3" |
| 468 |
[(set_attr "op_type" "VRV")]) |
| 469 |
|
| 470 |
; Element size and target address size is the same |
| 471 |
; vscef, vsceg |
| 472 |
(define_insn "vec_scatter_element<mode>_<non_vec_int>" |
| 473 |
[(set (mem:<non_vec> |
| 474 |
(plus:<non_vec_int> |
| 475 |
(vec_select:<non_vec_int> |
| 476 |
(match_operand:<TOINTVEC> 1 "register_operand" "v") |
| 477 |
(parallel [(match_operand:QI 3 "const_mask_operand" "C")])) |
| 478 |
(match_operand:DI 2 "address_operand" "ZQ"))) |
| 479 |
(vec_select:<non_vec> |
| 480 |
(match_operand:V_HW_32_64 0 "register_operand" "v") |
| 481 |
(parallel [(match_dup 3)])))] |
| 482 |
"TARGET_VX && UINTVAL (operands[3]) < GET_MODE_NUNITS (<V_HW_32_64:MODE>mode)" |
| 483 |
"vsce<bhfgq>\t%v0,%O2(%v1,%R2),%3" |
| 484 |
[(set_attr "op_type" "VRV")]) |
| 485 |
|
| 486 |
; Depending on the address size we have to expand a different pattern. |
| 487 |
; This however cannot be represented in s390-builtins.def so we do the |
| 488 |
; multiplexing here in the expander. |
| 489 |
(define_expand "vec_scatter_element<V_HW_32_64:mode>" |
| 490 |
[(match_operand:V_HW_32_64 0 "register_operand" "") |
| 491 |
(match_operand:<TOINTVEC> 1 "register_operand" "") |
| 492 |
(match_operand 2 "address_operand" "") |
| 493 |
(match_operand:QI 3 "const_mask_operand" "")] |
| 494 |
"TARGET_VX" |
| 495 |
{ |
| 496 |
if (TARGET_64BIT) |
| 497 |
{ |
| 498 |
PUT_MODE (operands[2], DImode); |
| 499 |
emit_insn ( |
| 500 |
gen_vec_scatter_element<V_HW_32_64:mode>_DI (operands[0], operands[1], |
| 501 |
operands[2], operands[3])); |
| 502 |
} |
| 503 |
else |
| 504 |
{ |
| 505 |
PUT_MODE (operands[2], SImode); |
| 506 |
emit_insn ( |
| 507 |
gen_vec_scatter_element<V_HW_32_64:mode>_SI (operands[0], operands[1], |
| 508 |
operands[2], operands[3])); |
| 509 |
} |
| 510 |
DONE; |
| 511 |
}) |
| 512 |
|
| 513 |
|
| 514 |
; Vector select |
| 515 |
|
| 516 |
; for all b in bits op0[b] = op3[b] == 0 ? op2[b] : op1[b] |
| 517 |
; implemented as: op0 = (op1 & op3) | (op2 & ~op3) |
| 518 |
|
| 519 |
; Used to expand the vec_sel builtin. Operands op1 and op2 already got |
| 520 |
; swapped in s390-c.cc when we get here. |
| 521 |
|
| 522 |
(define_insn "vsel<mode>" |
| 523 |
[(set (match_operand:V_HW1_FT 0 "register_operand" "=v") |
| 524 |
(ior:V_HW1_FT |
| 525 |
(and:V_HW1_FT (match_operand:V_HW1_FT 1 "register_operand" "v") |
| 526 |
(match_operand:V_HW1_FT 3 "register_operand" "v")) |
| 527 |
(and:V_HW1_FT (not:V_HW1_FT (match_dup 3)) |
| 528 |
(match_operand:V_HW1_FT 2 "register_operand" "v"))))] |
| 529 |
"TARGET_VX" |
| 530 |
"vsel\t%v0,%1,%2,%3" |
| 531 |
[(set_attr "op_type" "VRR")]) |
| 532 |
|
| 533 |
(define_insn "*vsel<mode>_swapped" |
| 534 |
[(set (match_operand:V_HW1_FT 0 "register_operand" "=v") |
| 535 |
(ior:V_HW1_FT |
| 536 |
(and:V_HW1_FT (not:V_HW1_FT (match_operand:V_HW1_FT 3 "register_operand" "v")) |
| 537 |
(match_operand:V_HW1_FT 1 "register_operand" "v")) |
| 538 |
(and:V_HW1_FT (match_dup 3) |
| 539 |
(match_operand:V_HW1_FT 2 "register_operand" "v"))))] |
| 540 |
"TARGET_VX" |
| 541 |
"vsel\t%v0,%2,%1,%3" |
| 542 |
[(set_attr "op_type" "VRR")]) |
| 543 |
|
| 544 |
|
| 545 |
; Vector sign extend to doubleword |
| 546 |
|
| 547 |
; Sign extend of right most vector element to respective double-word |
| 548 |
; vsegb, vsegh, vsegf |
| 549 |
(define_insn "vec_extend<mode>" |
| 550 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 551 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")] |
| 552 |
UNSPEC_VEC_EXTEND))] |
| 553 |
"TARGET_VX" |
| 554 |
"vseg<bhfgq>\t%v0,%1" |
| 555 |
[(set_attr "op_type" "VRR")]) |
| 556 |
|
| 557 |
|
| 558 |
; Vector store with length |
| 559 |
|
| 560 |
; Store bytes in OP1 from OP0 with the highest indexed byte to be |
| 561 |
; stored from OP0 given by OP2 |
| 562 |
(define_insn "vstl<mode>" |
| 563 |
[(set (match_operand:BLK 2 "memory_operand" "=Q") |
| 564 |
(unspec:BLK [(match_operand:V 0 "register_operand" "v") |
| 565 |
(match_operand:SI 1 "register_operand" "d")] |
| 566 |
UNSPEC_VEC_STORE_LEN))] |
| 567 |
"TARGET_VX" |
| 568 |
"vstl\t%v0,%1,%2" |
| 569 |
[(set_attr "op_type" "VRS")]) |
| 570 |
|
| 571 |
; Vector store rightmost with length |
| 572 |
|
| 573 |
(define_expand "vstrlrv16qi" |
| 574 |
[(set (match_operand:BLK 2 "memory_operand" "") |
| 575 |
(unspec:BLK [(match_operand:V16QI 0 "register_operand" "") |
| 576 |
(match_operand:SI 1 "nonmemory_operand" "")] |
| 577 |
UNSPEC_VEC_STORE_LEN_R))] |
| 578 |
"TARGET_VXE" |
| 579 |
{ |
| 580 |
/* vstrlr sets all length values beyond 15 to 15. Emulate the same |
| 581 |
behavior for immediate length operands. vstrl would trigger a |
| 582 |
SIGILL for too large immediate operands. */ |
| 583 |
if (CONST_INT_P (operands[1]) |
| 584 |
&& (UINTVAL (operands[1]) & 0xffffffff) > 15) |
| 585 |
operands[1] = GEN_INT (15); |
| 586 |
}) |
| 587 |
|
| 588 |
(define_insn "*vstrlrv16qi" |
| 589 |
[(set (match_operand:BLK 2 "memory_operand" "=Q, R, Q") |
| 590 |
(unspec:BLK [(match_operand:V16QI 0 "register_operand" "v, v, v") |
| 591 |
(match_operand:SI 1 "nonmemory_operand" "d,j>f,jb4")] |
| 592 |
UNSPEC_VEC_STORE_LEN_R))] |
| 593 |
"TARGET_VXE" |
| 594 |
"@ |
| 595 |
vstrlr\t%v0,%1,%2 |
| 596 |
vst\t%v0,%2%A2 |
| 597 |
vstrl\t%v0,%2,%1" |
| 598 |
[(set_attr "op_type" "VRS,VRX,VSI")]) |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
; vector bit permute |
| 603 |
|
| 604 |
(define_insn "vbpermv16qi" |
| 605 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 606 |
(unspec:V2DI [(match_operand:V16QI 1 "register_operand" "v") |
| 607 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 608 |
UNSPEC_VEC_VBPERM))] |
| 609 |
"TARGET_VXE" |
| 610 |
"vbperm\t%v0,%v1,%v2" |
| 611 |
[(set_attr "op_type" "VRR")]) |
| 612 |
|
| 613 |
; Vector unpack high |
| 614 |
|
| 615 |
; vuphb, vuphh, vuphf, vuphg |
| 616 |
(define_insn "vec_unpackh<mode>" |
| 617 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 618 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v")] |
| 619 |
UNSPEC_VEC_UNPACKH))] |
| 620 |
"TARGET_VX" |
| 621 |
"vuph<bhfgq>\t%v0,%v1" |
| 622 |
[(set_attr "op_type" "VRR")]) |
| 623 |
|
| 624 |
; vuplhb, vuplhh, vuplhf, vuplhg |
| 625 |
(define_insn "vec_unpackh_l<mode>" |
| 626 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 627 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v")] |
| 628 |
UNSPEC_VEC_UNPACKH_L))] |
| 629 |
"TARGET_VX" |
| 630 |
"vuplh<bhfgq>\t%v0,%v1" |
| 631 |
[(set_attr "op_type" "VRR")]) |
| 632 |
|
| 633 |
|
| 634 |
; Vector unpack low |
| 635 |
|
| 636 |
; vuplb, vuplhw, vuplf, vuplg |
| 637 |
(define_insn "vec_unpackl<mode>" |
| 638 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 639 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v")] |
| 640 |
UNSPEC_VEC_UNPACKL))] |
| 641 |
"TARGET_VX" |
| 642 |
"vupl<bhfgq><w>\t%v0,%v1" |
| 643 |
[(set_attr "op_type" "VRR")]) |
| 644 |
|
| 645 |
; vupllb, vupllh, vupllf, vupllg |
| 646 |
(define_insn "vec_unpackl_l<mode>" |
| 647 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 648 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v")] |
| 649 |
UNSPEC_VEC_UNPACKL_L))] |
| 650 |
"TARGET_VX" |
| 651 |
"vupll<bhfgq>\t%v0,%v1" |
| 652 |
[(set_attr "op_type" "VRR")]) |
| 653 |
|
| 654 |
|
| 655 |
; Vector add |
| 656 |
|
| 657 |
; Vector add compute carry |
| 658 |
|
| 659 |
; vaccb, vacch, vaccf, vaccg, vaccq |
| 660 |
(define_insn "vacc<bhfgq>_<mode>" |
| 661 |
[(set (match_operand:VIT_HW 0 "register_operand" "=v") |
| 662 |
(unspec:VIT_HW [(match_operand:VIT_HW 1 "register_operand" "v") |
| 663 |
(match_operand:VIT_HW 2 "register_operand" "v")] |
| 664 |
UNSPEC_VEC_ADDC))] |
| 665 |
"TARGET_VX" |
| 666 |
"vacc<bhfgq>\t%v0,%v1,%v2" |
| 667 |
[(set_attr "op_type" "VRR")]) |
| 668 |
|
| 669 |
; Vector add with carry |
| 670 |
|
| 671 |
(define_insn "vacq" |
| 672 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 673 |
(unspec:TI [(match_operand:TI 1 "register_operand" "v") |
| 674 |
(match_operand:TI 2 "register_operand" "v") |
| 675 |
(match_operand:TI 3 "register_operand" "v")] |
| 676 |
UNSPEC_VEC_ADDE_U128))] |
| 677 |
"TARGET_VX" |
| 678 |
"vacq\t%v0,%v1,%v2,%v3" |
| 679 |
[(set_attr "op_type" "VRR")]) |
| 680 |
|
| 681 |
|
| 682 |
; Vector add with carry compute carry |
| 683 |
|
| 684 |
(define_insn "vacccq" |
| 685 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 686 |
(unspec:TI [(match_operand:TI 1 "register_operand" "v") |
| 687 |
(match_operand:TI 2 "register_operand" "v") |
| 688 |
(match_operand:TI 3 "register_operand" "v")] |
| 689 |
UNSPEC_VEC_ADDEC_U128))] |
| 690 |
"TARGET_VX" |
| 691 |
"vacccq\t%v0,%v1,%v2,%v3" |
| 692 |
[(set_attr "op_type" "VRR")]) |
| 693 |
|
| 694 |
|
| 695 |
; Vector and |
| 696 |
|
| 697 |
; Vector and with complement |
| 698 |
|
| 699 |
; vnc |
| 700 |
(define_insn "vec_andc<mode>3" |
| 701 |
[(set (match_operand:VT_HW 0 "register_operand" "=v") |
| 702 |
(and:VT_HW (not:VT_HW (match_operand:VT_HW 2 "register_operand" "v")) |
| 703 |
(match_operand:VT_HW 1 "register_operand" "v")))] |
| 704 |
"TARGET_VX" |
| 705 |
"vnc\t%v0,%v1,%v2" |
| 706 |
[(set_attr "op_type" "VRR")]) |
| 707 |
|
| 708 |
|
| 709 |
; Vector average |
| 710 |
|
| 711 |
; vavgb, vavgh, vavgf, vavgg, vavgq |
| 712 |
(define_insn "vec_avg<mode>" |
| 713 |
[(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 714 |
(unspec:VIT_HW_VXE3_T [(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 715 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v")] |
| 716 |
UNSPEC_VEC_AVG))] |
| 717 |
"TARGET_VX" |
| 718 |
"vavg<bhfgq>\t%v0,%v1,%v2" |
| 719 |
[(set_attr "op_type" "VRR")]) |
| 720 |
|
| 721 |
; Vector average logical |
| 722 |
|
| 723 |
; vavglb, vavglh, vavglf, vavglg, vavglq |
| 724 |
(define_insn "vec_avgu<mode>" |
| 725 |
[(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 726 |
(unspec:VIT_HW_VXE3_T [(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 727 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v")] |
| 728 |
UNSPEC_VEC_AVGU))] |
| 729 |
"TARGET_VX" |
| 730 |
"vavgl<bhfgq>\t%v0,%v1,%v2" |
| 731 |
[(set_attr "op_type" "VRR")]) |
| 732 |
|
| 733 |
|
| 734 |
; Vector checksum |
| 735 |
|
| 736 |
(define_insn "vec_checksum" |
| 737 |
[(set (match_operand:V4SI 0 "register_operand" "=v") |
| 738 |
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v") |
| 739 |
(match_operand:V4SI 2 "register_operand" "v")] |
| 740 |
UNSPEC_VEC_CHECKSUM))] |
| 741 |
"TARGET_VX" |
| 742 |
"vcksm\t%v0,%v1,%v2" |
| 743 |
[(set_attr "op_type" "VRR")]) |
| 744 |
|
| 745 |
;; |
| 746 |
;; Vector compare |
| 747 |
;; |
| 748 |
|
| 749 |
; vec_all/any int compares |
| 750 |
|
| 751 |
(define_expand "vec_all_<intcmpcc:code><VIT_HW_VXE3_T:mode>" |
| 752 |
[(match_operand:SI 0 "register_operand" "") |
| 753 |
(intcmpcc (match_operand:VIT_HW_VXE3_T 1 "register_operand" "") |
| 754 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" ""))] |
| 755 |
"TARGET_VX" |
| 756 |
{ |
| 757 |
s390_expand_vec_compare_cc (operands[0], |
| 758 |
<intcmpcc:CODE>, |
| 759 |
operands[1], |
| 760 |
operands[2], |
| 761 |
true); |
| 762 |
DONE; |
| 763 |
}) |
| 764 |
|
| 765 |
(define_expand "vec_any_<intcmpcc:code><VIT_HW_VXE3_T:mode>" |
| 766 |
[(match_operand:SI 0 "register_operand" "") |
| 767 |
(intcmpcc (match_operand:VIT_HW_VXE3_T 1 "register_operand" "") |
| 768 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" ""))] |
| 769 |
"TARGET_VX" |
| 770 |
{ |
| 771 |
s390_expand_vec_compare_cc (operands[0], |
| 772 |
<intcmpcc:CODE>, |
| 773 |
operands[1], |
| 774 |
operands[2], |
| 775 |
false); |
| 776 |
DONE; |
| 777 |
}) |
| 778 |
|
| 779 |
; vec_all/any fp compares |
| 780 |
|
| 781 |
(define_expand "vec_all_<fpcmpcc:code><mode>" |
| 782 |
[(match_operand:SI 0 "register_operand" "") |
| 783 |
(fpcmpcc (match_operand:VECF_HW 1 "register_operand" "") |
| 784 |
(match_operand:VECF_HW 2 "register_operand" ""))] |
| 785 |
"TARGET_VX" |
| 786 |
{ |
| 787 |
s390_expand_vec_compare_cc (operands[0], |
| 788 |
<fpcmpcc:CODE>, |
| 789 |
operands[1], |
| 790 |
operands[2], |
| 791 |
true); |
| 792 |
DONE; |
| 793 |
}) |
| 794 |
|
| 795 |
(define_expand "vec_any_<fpcmpcc:code><mode>" |
| 796 |
[(match_operand:SI 0 "register_operand" "") |
| 797 |
(fpcmpcc (match_operand:VECF_HW 1 "register_operand" "") |
| 798 |
(match_operand:VECF_HW 2 "register_operand" ""))] |
| 799 |
"TARGET_VX" |
| 800 |
{ |
| 801 |
s390_expand_vec_compare_cc (operands[0], |
| 802 |
<fpcmpcc:CODE>, |
| 803 |
operands[1], |
| 804 |
operands[2], |
| 805 |
false); |
| 806 |
DONE; |
| 807 |
}) |
| 808 |
|
| 809 |
|
| 810 |
; Compare without generating CC |
| 811 |
|
| 812 |
(define_expand "vec_cmp<intcmp:code><VIT_HW_VXE3_T:mode>" |
| 813 |
[(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 814 |
(intcmp:VIT_HW_VXE3_T (match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 815 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v")))] |
| 816 |
"TARGET_VX" |
| 817 |
{ |
| 818 |
s390_expand_vec_compare (operands[0], <intcmp:CODE>, operands[1], operands[2]); |
| 819 |
DONE; |
| 820 |
}) |
| 821 |
|
| 822 |
(define_expand "vec_cmp<fpcmp:code><mode>" |
| 823 |
[(set (match_operand:<TOINTVEC> 0 "register_operand" "=v") |
| 824 |
(fpcmp:<TOINTVEC> (match_operand:VF_HW 1 "register_operand" "v") |
| 825 |
(match_operand:VF_HW 2 "register_operand" "v")))] |
| 826 |
"TARGET_VX" |
| 827 |
{ |
| 828 |
s390_expand_vec_compare (operands[0], <fpcmp:CODE>, operands[1], operands[2]); |
| 829 |
DONE; |
| 830 |
}) |
| 831 |
|
| 832 |
|
| 833 |
; Vector count leading zeros |
| 834 |
|
| 835 |
; vec_cntlz -> clz |
| 836 |
; vec_cnttz -> ctz |
| 837 |
|
| 838 |
; Vector xor |
| 839 |
|
| 840 |
; vec_xor -> xor |
| 841 |
|
| 842 |
; Vector Galois field multiply sum |
| 843 |
|
| 844 |
; vgfmb, vgfmh, vgfmf |
| 845 |
(define_insn "vec_gfmsum<mode>" |
| 846 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 847 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 848 |
(match_operand:VI_HW_QHS 2 "register_operand" "v")] |
| 849 |
UNSPEC_VEC_GFMSUM))] |
| 850 |
"TARGET_VX" |
| 851 |
"vgfm<bhfgq>\t%v0,%v1,%v2" |
| 852 |
[(set_attr "op_type" "VRR")]) |
| 853 |
|
| 854 |
(define_insn "vec_gfmsum_128" |
| 855 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 856 |
(unspec:V16QI [(match_operand:V2DI 1 "register_operand" "v") |
| 857 |
(match_operand:V2DI 2 "register_operand" "v")] |
| 858 |
UNSPEC_VEC_GFMSUM_128))] |
| 859 |
"TARGET_VX" |
| 860 |
"vgfmg\t%v0,%v1,%v2" |
| 861 |
[(set_attr "op_type" "VRR")]) |
| 862 |
|
| 863 |
; vgfmab, vgfmah, vgfmaf |
| 864 |
(define_insn "vec_gfmsum_accum<mode>" |
| 865 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 866 |
(unspec:<vec_double> [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 867 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 868 |
(match_operand:<vec_double> 3 "register_operand" "v")] |
| 869 |
UNSPEC_VEC_GFMSUM_ACCUM))] |
| 870 |
"TARGET_VX" |
| 871 |
"vgfma<bhfgq>\t%v0,%v1,%v2,%v3" |
| 872 |
[(set_attr "op_type" "VRR")]) |
| 873 |
|
| 874 |
(define_insn "vec_gfmsum_accum_128" |
| 875 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 876 |
(unspec:TI [(match_operand:V2DI 1 "register_operand" "v") |
| 877 |
(match_operand:V2DI 2 "register_operand" "v") |
| 878 |
(match_operand:TI 3 "register_operand" "v")] |
| 879 |
UNSPEC_VEC_GFMSUM_ACCUM_128))] |
| 880 |
"TARGET_VX" |
| 881 |
"vgfmag\t%v0,%v1,%v2,%v3" |
| 882 |
[(set_attr "op_type" "VRR")]) |
| 883 |
|
| 884 |
|
| 885 |
; FIXME: vec_neg ? |
| 886 |
|
| 887 |
; Vector load positive: vec_abs -> abs |
| 888 |
; Vector maximum vec_max -> smax, logical vec_max -> umax |
| 889 |
; Vector maximum vec_min -> smin, logical vec_min -> umin |
| 890 |
|
| 891 |
|
| 892 |
; Vector multiply and add high |
| 893 |
|
| 894 |
; vec_mladd -> vec_vmal |
| 895 |
; vmalb, vmalh, vmalf, vmalg, vmalq |
| 896 |
(define_insn "vec_vmal<mode>" |
| 897 |
[(set (match_operand:VIT_HW_VXE3_DT 0 "register_operand" "=v") |
| 898 |
(unspec:VIT_HW_VXE3_DT [(match_operand:VIT_HW_VXE3_DT 1 "register_operand" "v") |
| 899 |
(match_operand:VIT_HW_VXE3_DT 2 "register_operand" "v") |
| 900 |
(match_operand:VIT_HW_VXE3_DT 3 "register_operand" "v")] |
| 901 |
UNSPEC_VEC_VMAL))] |
| 902 |
"TARGET_VX" |
| 903 |
"vmal<bhfgq><w>\t%v0,%v1,%v2,%v3" |
| 904 |
[(set_attr "op_type" "VRR")]) |
| 905 |
|
| 906 |
; vec_mhadd -> vec_vmah/vec_vmalh |
| 907 |
|
| 908 |
; vmahb; vmahh, vmahf, vmahg, vmahq |
| 909 |
(define_insn "vec_vmah<mode>" |
| 910 |
[(set (match_operand:VIT_HW_VXE3_DT 0 "register_operand" "=v") |
| 911 |
(unspec:VIT_HW_VXE3_DT [(match_operand:VIT_HW_VXE3_DT 1 "register_operand" "v") |
| 912 |
(match_operand:VIT_HW_VXE3_DT 2 "register_operand" "v") |
| 913 |
(match_operand:VIT_HW_VXE3_DT 3 "register_operand" "v")] |
| 914 |
UNSPEC_VEC_VMAH))] |
| 915 |
"TARGET_VX" |
| 916 |
"vmah<bhfgq>\t%v0,%v1,%v2,%v3" |
| 917 |
[(set_attr "op_type" "VRR")]) |
| 918 |
|
| 919 |
; vmalhb; vmalhh, vmalhf, vmalhg, vmalhq |
| 920 |
(define_insn "vec_vmalh<mode>" |
| 921 |
[(set (match_operand:VIT_HW_VXE3_DT 0 "register_operand" "=v") |
| 922 |
(unspec:VIT_HW_VXE3_DT [(match_operand:VIT_HW_VXE3_DT 1 "register_operand" "v") |
| 923 |
(match_operand:VIT_HW_VXE3_DT 2 "register_operand" "v") |
| 924 |
(match_operand:VIT_HW_VXE3_DT 3 "register_operand" "v")] |
| 925 |
UNSPEC_VEC_VMALH))] |
| 926 |
"TARGET_VX" |
| 927 |
"vmalh<bhfgq>\t%v0,%v1,%v2,%v3" |
| 928 |
[(set_attr "op_type" "VRR")]) |
| 929 |
|
| 930 |
; vec_meadd -> vec_vmae/vec_vmale |
| 931 |
|
| 932 |
; vmaeb; vmaeh, vmaef, vmaeg |
| 933 |
(define_insn "vec_vmae<mode>" |
| 934 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 935 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v") |
| 936 |
(match_operand:VI_HW_VXE3 2 "register_operand" "v") |
| 937 |
(match_operand:<vec_double> 3 "register_operand" "v")] |
| 938 |
UNSPEC_VEC_VMAE))] |
| 939 |
"TARGET_VX" |
| 940 |
"vmae<bhfgq>\t%v0,%v1,%v2,%v3" |
| 941 |
[(set_attr "op_type" "VRR")]) |
| 942 |
|
| 943 |
; vmaleb; vmaleh, vmalef, vmaleg |
| 944 |
(define_insn "vec_vmale<mode>" |
| 945 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 946 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v") |
| 947 |
(match_operand:VI_HW_VXE3 2 "register_operand" "v") |
| 948 |
(match_operand:<vec_double> 3 "register_operand" "v")] |
| 949 |
UNSPEC_VEC_VMALE))] |
| 950 |
"TARGET_VX" |
| 951 |
"vmale<bhfgq>\t%v0,%v1,%v2,%v3" |
| 952 |
[(set_attr "op_type" "VRR")]) |
| 953 |
|
| 954 |
; vec_moadd -> vec_vmao/vec_vmalo |
| 955 |
|
| 956 |
; vmaob; vmaoh, vmaof, vmaog |
| 957 |
(define_insn "vec_vmao<mode>" |
| 958 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 959 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v") |
| 960 |
(match_operand:VI_HW_VXE3 2 "register_operand" "v") |
| 961 |
(match_operand:<vec_double> 3 "register_operand" "v")] |
| 962 |
UNSPEC_VEC_VMAO))] |
| 963 |
"TARGET_VX" |
| 964 |
"vmao<bhfgq>\t%v0,%v1,%v2,%v3" |
| 965 |
[(set_attr "op_type" "VRR")]) |
| 966 |
|
| 967 |
; vmalob; vmaloh, vmalof, vmalog |
| 968 |
(define_insn "vec_vmalo<mode>" |
| 969 |
[(set (match_operand:<vec_double> 0 "register_operand" "=v") |
| 970 |
(unspec:<vec_double> [(match_operand:VI_HW_VXE3 1 "register_operand" "v") |
| 971 |
(match_operand:VI_HW_VXE3 2 "register_operand" "v") |
| 972 |
(match_operand:<vec_double> 3 "register_operand" "v")] |
| 973 |
UNSPEC_VEC_VMALO))] |
| 974 |
"TARGET_VX" |
| 975 |
"vmalo<bhfgq>\t%v0,%v1,%v2,%v3" |
| 976 |
[(set_attr "op_type" "VRR")]) |
| 977 |
|
| 978 |
|
| 979 |
; Vector multiply high |
| 980 |
|
| 981 |
; vec_mulh -> vec_smulh/vec_umulh |
| 982 |
|
| 983 |
; vmhb, vmhh, vmhf, vmhg, vmhq |
| 984 |
(define_insn "vec_smulh<mode>" |
| 985 |
[(set (match_operand:VIT_HW_VXE3_DT 0 "register_operand" "=v") |
| 986 |
(unspec:VIT_HW_VXE3_DT [(match_operand:VIT_HW_VXE3_DT 1 "register_operand" "v") |
| 987 |
(match_operand:VIT_HW_VXE3_DT 2 "register_operand" "v")] |
| 988 |
UNSPEC_VEC_SMULT_HI))] |
| 989 |
"TARGET_VX" |
| 990 |
"vmh<bhfgq>\t%v0,%v1,%v2" |
| 991 |
[(set_attr "op_type" "VRR")]) |
| 992 |
|
| 993 |
; vmlhb, vmlhh, vmlhf, vmlhg, vmlhq |
| 994 |
(define_insn "vec_umulh<mode>" |
| 995 |
[(set (match_operand:VIT_HW_VXE3_DT 0 "register_operand" "=v") |
| 996 |
(unspec:VIT_HW_VXE3_DT [(match_operand:VIT_HW_VXE3_DT 1 "register_operand" "v") |
| 997 |
(match_operand:VIT_HW_VXE3_DT 2 "register_operand" "v")] |
| 998 |
UNSPEC_VEC_UMULT_HI))] |
| 999 |
"TARGET_VX" |
| 1000 |
"vmlh<bhfgq>\t%v0,%v1,%v2" |
| 1001 |
[(set_attr "op_type" "VRR")]) |
| 1002 |
|
| 1003 |
|
| 1004 |
; Vector multiply low |
| 1005 |
|
| 1006 |
; vec_mule -> vec_widen_umult_even/vec_widen_smult_even |
| 1007 |
; vec_mulo -> vec_widen_umult_odd/vec_widen_smult_odd |
| 1008 |
|
| 1009 |
|
| 1010 |
; Vector nor |
| 1011 |
|
| 1012 |
(define_insn "vec_nor<mode>3" |
| 1013 |
[(set (match_operand:VT_HW 0 "register_operand" "=v") |
| 1014 |
(not:VT_HW |
| 1015 |
(ior:VT_HW (match_operand:VT_HW 1 "register_operand" "v") |
| 1016 |
(match_operand:VT_HW 2 "register_operand" "v"))))] |
| 1017 |
"TARGET_VX" |
| 1018 |
"vno\t%v0,%v1,%v2" |
| 1019 |
[(set_attr "op_type" "VRR")]) |
| 1020 |
|
| 1021 |
|
| 1022 |
; Vector or |
| 1023 |
|
| 1024 |
; Vector population count vec_popcnt -> popcount |
| 1025 |
; Vector element rotate left logical vec_rl -> vrotl, vec_rli -> rot |
| 1026 |
|
| 1027 |
; Vector element rotate and insert under mask |
| 1028 |
|
| 1029 |
; verimb, verimh, verimf, verimg |
| 1030 |
(define_insn "verim<mode>" |
| 1031 |
[(set (match_operand:VI_HW 0 "register_operand" "=v") |
| 1032 |
(unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "0") |
| 1033 |
(match_operand:VI_HW 2 "register_operand" "v") |
| 1034 |
(match_operand:VI_HW 3 "register_operand" "v") |
| 1035 |
(match_operand:QI 4 "const_int_operand" "C")] |
| 1036 |
UNSPEC_VEC_RL_MASK))] |
| 1037 |
"TARGET_VX" |
| 1038 |
"verim<bhfgq>\t%v0,%v2,%v3,%b4" |
| 1039 |
[(set_attr "op_type" "VRI")]) |
| 1040 |
|
| 1041 |
|
| 1042 |
; Vector shift left |
| 1043 |
|
| 1044 |
(define_insn "@vec_sll<V_HW3:mode><VI_HW_QHS:mode>" |
| 1045 |
[(set (match_operand:V_HW3 0 "register_operand" "=v") |
| 1046 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "v") |
| 1047 |
(match_operand:VI_HW_QHS 2 "register_operand" "v")] |
| 1048 |
UNSPEC_VEC_SLL))] |
| 1049 |
"TARGET_VX" |
| 1050 |
"vsl\t%v0,%v1,%v2" |
| 1051 |
[(set_attr "op_type" "VRR")]) |
| 1052 |
|
| 1053 |
|
| 1054 |
; Vector shift left by byte |
| 1055 |
|
| 1056 |
; Pattern definition in vector.md, see vec_vslb |
| 1057 |
(define_expand "@vec_slb<mode>" |
| 1058 |
[(set (match_operand:V_HW3 0 "register_operand" "") |
| 1059 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "") |
| 1060 |
(match_operand:V16QI 2 "register_operand" "")] |
| 1061 |
UNSPEC_VEC_SLB))] |
| 1062 |
"TARGET_VX") |
| 1063 |
|
| 1064 |
; Vector shift left double by byte |
| 1065 |
|
| 1066 |
(define_insn "vec_sld<mode>" |
| 1067 |
[(set (match_operand:V_HW 0 "register_operand" "=v") |
| 1068 |
(unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v") |
| 1069 |
(match_operand:V_HW 2 "register_operand" "v") |
| 1070 |
(match_operand:QI 3 "const_int_operand" "C")] |
| 1071 |
UNSPEC_VEC_SLDBYTE))] |
| 1072 |
"TARGET_VX" |
| 1073 |
"vsldb\t%v0,%v1,%v2,%b3" |
| 1074 |
[(set_attr "op_type" "VRI")]) |
| 1075 |
|
| 1076 |
(define_expand "vec_sldw<mode>" |
| 1077 |
[(set (match_operand:V_HW 0 "register_operand" "") |
| 1078 |
(unspec:V_HW [(match_operand:V_HW 1 "register_operand" "") |
| 1079 |
(match_operand:V_HW 2 "register_operand" "") |
| 1080 |
(match_operand:QI 3 "const_int_operand" "")] |
| 1081 |
UNSPEC_VEC_SLDBYTE))] |
| 1082 |
"TARGET_VX" |
| 1083 |
{ |
| 1084 |
operands[3] = GEN_INT (INTVAL (operands[3]) << 2); |
| 1085 |
}) |
| 1086 |
|
| 1087 |
; Vector shift left double by bit |
| 1088 |
|
| 1089 |
(define_insn "vec_sldb<mode>" |
| 1090 |
[(set (match_operand:V_HW 0 "register_operand" "=v") |
| 1091 |
(unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v") |
| 1092 |
(match_operand:V_HW 2 "register_operand" "v") |
| 1093 |
(match_operand:QI 3 "const_int_operand" "C")] |
| 1094 |
UNSPEC_VEC_SLDBIT))] |
| 1095 |
"TARGET_VXE2" |
| 1096 |
"vsld\t%v0,%v1,%v2,%b3" |
| 1097 |
[(set_attr "op_type" "VRI")]) |
| 1098 |
|
| 1099 |
; Vector shift right double by bit |
| 1100 |
|
| 1101 |
(define_insn "vec_srdb<mode>" |
| 1102 |
[(set (match_operand:V_HW 0 "register_operand" "=v") |
| 1103 |
(unspec:V_HW [(match_operand:V_HW 1 "register_operand" "v") |
| 1104 |
(match_operand:V_HW 2 "register_operand" "v") |
| 1105 |
(match_operand:QI 3 "const_int_operand" "C")] |
| 1106 |
UNSPEC_VEC_SRDBIT))] |
| 1107 |
"TARGET_VXE2" |
| 1108 |
"vsrd\t%v0,%v1,%v2,%b3" |
| 1109 |
[(set_attr "op_type" "VRI")]) |
| 1110 |
|
| 1111 |
; Vector shift right arithmetic |
| 1112 |
|
| 1113 |
(define_insn "@vec_sral<V_HW3:mode><VI_HW_QHS:mode>" |
| 1114 |
[(set (match_operand:V_HW3 0 "register_operand" "=v") |
| 1115 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "v") |
| 1116 |
(match_operand:VI_HW_QHS 2 "register_operand" "v")] |
| 1117 |
UNSPEC_VEC_SRAL))] |
| 1118 |
"TARGET_VX" |
| 1119 |
"vsra\t%v0,%v1,%v2" |
| 1120 |
[(set_attr "op_type" "VRR")]) |
| 1121 |
|
| 1122 |
|
| 1123 |
; Vector shift right arithmetic by byte |
| 1124 |
|
| 1125 |
(define_insn "@vec_srab<mode>" |
| 1126 |
[(set (match_operand:V_HW3 0 "register_operand" "=v") |
| 1127 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "v") |
| 1128 |
(match_operand:V16QI 2 "register_operand" "v")] |
| 1129 |
UNSPEC_VEC_SRAB))] |
| 1130 |
"TARGET_VX" |
| 1131 |
"vsrab\t%v0,%v1,%v2" |
| 1132 |
[(set_attr "op_type" "VRR")]) |
| 1133 |
|
| 1134 |
|
| 1135 |
; Vector shift right logical |
| 1136 |
|
| 1137 |
(define_insn "@vec_srl<V_HW3:mode><VI_HW_QHS:mode>" |
| 1138 |
[(set (match_operand:V_HW3 0 "register_operand" "=v") |
| 1139 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "v") |
| 1140 |
(match_operand:VI_HW_QHS 2 "register_operand" "v")] |
| 1141 |
UNSPEC_VEC_SRL))] |
| 1142 |
"TARGET_VX" |
| 1143 |
"vsrl\t%v0,%v1,%v2" |
| 1144 |
[(set_attr "op_type" "VRR")]) |
| 1145 |
|
| 1146 |
|
| 1147 |
; Vector shift right logical by byte |
| 1148 |
|
| 1149 |
; Pattern definition in vector.md, see vec_vsrb |
| 1150 |
(define_expand "@vec_srb<mode>" |
| 1151 |
[(set (match_operand:V_HW3 0 "register_operand" "") |
| 1152 |
(unspec:V_HW3 [(match_operand:V_HW3 1 "register_operand" "") |
| 1153 |
(match_operand:V16QI 2 "register_operand" "")] |
| 1154 |
UNSPEC_VEC_SRLB))] |
| 1155 |
"TARGET_VX") |
| 1156 |
|
| 1157 |
; Vector subtract |
| 1158 |
|
| 1159 |
; Vector subtract compute borrow indication |
| 1160 |
|
| 1161 |
; vscbib, vscbih, vscbif, vscbig, vscbiq |
| 1162 |
(define_insn "vscbi<bhfgq>_<mode>" |
| 1163 |
[(set (match_operand:VIT_HW 0 "register_operand" "=v") |
| 1164 |
(unspec:VIT_HW [(match_operand:VIT_HW 1 "register_operand" "v") |
| 1165 |
(match_operand:VIT_HW 2 "register_operand" "v")] |
| 1166 |
UNSPEC_VEC_SUBC))] |
| 1167 |
"TARGET_VX" |
| 1168 |
"vscbi<bhfgq>\t%v0,%v1,%v2" |
| 1169 |
[(set_attr "op_type" "VRR")]) |
| 1170 |
|
| 1171 |
; Vector subtract with borrow indication |
| 1172 |
|
| 1173 |
(define_insn "vsbiq" |
| 1174 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 1175 |
(unspec:TI [(match_operand:TI 1 "register_operand" "v") |
| 1176 |
(match_operand:TI 2 "register_operand" "v") |
| 1177 |
(match_operand:TI 3 "register_operand" "v")] |
| 1178 |
UNSPEC_VEC_SUBE_U128))] |
| 1179 |
"TARGET_VX" |
| 1180 |
"vsbiq\t%v0,%v1,%v2,%v3" |
| 1181 |
[(set_attr "op_type" "VRR")]) |
| 1182 |
|
| 1183 |
|
| 1184 |
; Vector subtract with borrow compute and borrow indication |
| 1185 |
|
| 1186 |
(define_insn "vsbcbiq" |
| 1187 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 1188 |
(unspec:TI [(match_operand:TI 1 "register_operand" "v") |
| 1189 |
(match_operand:TI 2 "register_operand" "v") |
| 1190 |
(match_operand:TI 3 "register_operand" "v")] |
| 1191 |
UNSPEC_VEC_SUBEC_U128))] |
| 1192 |
"TARGET_VX" |
| 1193 |
"vsbcbiq\t%v0,%v1,%v2,%v3" |
| 1194 |
[(set_attr "op_type" "VRR")]) |
| 1195 |
|
| 1196 |
|
| 1197 |
; Vector sum across |
| 1198 |
|
| 1199 |
; Sum across DImode parts of the 1st operand and add the rightmost |
| 1200 |
; element of 2nd operand |
| 1201 |
; vsumgh, vsumgf |
| 1202 |
(define_expand "vec_sum2<mode>" |
| 1203 |
[(set (match_operand:V2DI 0 "register_operand" "") |
| 1204 |
(unspec:V2DI [(match_operand:VI_HW_HS 1 "register_operand" "") |
| 1205 |
(match_operand:VI_HW_HS 2 "register_operand" "")] |
| 1206 |
UNSPEC_VEC_VSUMG))] |
| 1207 |
"TARGET_VX") |
| 1208 |
|
| 1209 |
; vsumqh, vsumqf |
| 1210 |
(define_insn "vec_sum_u128<mode>" |
| 1211 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1212 |
(unspec:V2DI [(match_operand:VI_HW_SD 1 "register_operand" "v") |
| 1213 |
(match_operand:VI_HW_SD 2 "register_operand" "v")] |
| 1214 |
UNSPEC_VEC_VSUMQ))] |
| 1215 |
"TARGET_VX" |
| 1216 |
"vsumq<bhfgq>\t%v0,%v1,%v2" |
| 1217 |
[(set_attr "op_type" "VRR")]) |
| 1218 |
|
| 1219 |
; vsumb, vsumh |
| 1220 |
(define_expand "vec_sum4<mode>" |
| 1221 |
[(set (match_operand:V4SI 0 "register_operand" "") |
| 1222 |
(unspec:V4SI [(match_operand:VI_HW_QH 1 "register_operand" "") |
| 1223 |
(match_operand:VI_HW_QH 2 "register_operand" "")] |
| 1224 |
UNSPEC_VEC_VSUM))] |
| 1225 |
"TARGET_VX") |
| 1226 |
|
| 1227 |
|
| 1228 |
; Vector test under mask |
| 1229 |
|
| 1230 |
(define_expand "vec_test_mask_int<mode>" |
| 1231 |
[(set (reg:CCRAW CC_REGNUM) |
| 1232 |
(unspec:CCRAW [(match_operand:V_HW 1 "register_operand" "") |
| 1233 |
(match_operand:<TOINTVEC> 2 "register_operand" "")] |
| 1234 |
UNSPEC_VEC_TEST_MASK)) |
| 1235 |
(set (match_operand:SI 0 "register_operand" "") |
| 1236 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1237 |
"TARGET_VX") |
| 1238 |
|
| 1239 |
(define_insn "*vec_test_mask<mode>" |
| 1240 |
[(set (reg:CCRAW CC_REGNUM) |
| 1241 |
(unspec:CCRAW [(match_operand:V_HW 0 "register_operand" "v") |
| 1242 |
(match_operand:<TOINTVEC> 1 "register_operand" "v")] |
| 1243 |
UNSPEC_VEC_TEST_MASK))] |
| 1244 |
"TARGET_VX" |
| 1245 |
"vtm\t%v0,%v1" |
| 1246 |
[(set_attr "op_type" "VRR")]) |
| 1247 |
|
| 1248 |
|
| 1249 |
; Vector multiply sum logical |
| 1250 |
|
| 1251 |
(define_insn "vec_msumv2di" |
| 1252 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1253 |
(unspec:V16QI [(match_operand:V2DI 1 "register_operand" "v") |
| 1254 |
(match_operand:V2DI 2 "register_operand" "v") |
| 1255 |
(match_operand:V16QI 3 "register_operand" "v") |
| 1256 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 1257 |
UNSPEC_VEC_MSUM))] |
| 1258 |
"TARGET_VXE" |
| 1259 |
"vmslg\t%v0,%v1,%v2,%v3,%4" |
| 1260 |
[(set_attr "op_type" "VRR")]) |
| 1261 |
|
| 1262 |
(define_insn "vmslg" |
| 1263 |
[(set (match_operand:TI 0 "register_operand" "=v") |
| 1264 |
(unspec:TI [(match_operand:V2DI 1 "register_operand" "v") |
| 1265 |
(match_operand:V2DI 2 "register_operand" "v") |
| 1266 |
(match_operand:TI 3 "register_operand" "v") |
| 1267 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 1268 |
UNSPEC_VEC_MSUM))] |
| 1269 |
"TARGET_VXE" |
| 1270 |
"vmslg\t%v0,%v1,%v2,%v3,%4" |
| 1271 |
[(set_attr "op_type" "VRR")]) |
| 1272 |
|
| 1273 |
|
| 1274 |
; Vector find any element equal |
| 1275 |
|
| 1276 |
; vfaeb, vfaeh, vfaef |
| 1277 |
; vfaezb, vfaezh, vfaezf |
| 1278 |
(define_insn "vfae<mode>" |
| 1279 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1280 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1281 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1282 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 1283 |
UNSPEC_VEC_VFAE))] |
| 1284 |
"TARGET_VX" |
| 1285 |
{ |
| 1286 |
unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); |
| 1287 |
|
| 1288 |
if (flags & VSTRING_FLAG_ZS) |
| 1289 |
{ |
| 1290 |
flags &= ~VSTRING_FLAG_ZS; |
| 1291 |
operands[3] = GEN_INT (flags); |
| 1292 |
return "vfaez<bhfgq>\t%v0,%v1,%v2,%b3"; |
| 1293 |
} |
| 1294 |
return "vfae<bhfgq>\t%v0,%v1,%v2,%b3"; |
| 1295 |
} |
| 1296 |
[(set_attr "op_type" "VRR")]) |
| 1297 |
|
| 1298 |
; vfaebs, vfaehs, vfaefs |
| 1299 |
; vfaezbs, vfaezhs, vfaezfs |
| 1300 |
(define_insn "*vfaes<mode>" |
| 1301 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1302 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1303 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1304 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 1305 |
UNSPEC_VEC_VFAE)) |
| 1306 |
(set (reg:CCRAW CC_REGNUM) |
| 1307 |
(unspec:CCRAW [(match_dup 1) |
| 1308 |
(match_dup 2) |
| 1309 |
(match_dup 3)] |
| 1310 |
UNSPEC_VEC_VFAECC))] |
| 1311 |
"TARGET_VX" |
| 1312 |
{ |
| 1313 |
unsigned HOST_WIDE_INT flags = UINTVAL (operands[3]); |
| 1314 |
|
| 1315 |
if (flags & VSTRING_FLAG_ZS) |
| 1316 |
{ |
| 1317 |
flags &= ~VSTRING_FLAG_ZS; |
| 1318 |
operands[3] = GEN_INT (flags); |
| 1319 |
return "vfaez<bhfgq>s\t%v0,%v1,%v2,%b3"; |
| 1320 |
} |
| 1321 |
return "vfae<bhfgq>s\t%v0,%v1,%v2,%b3"; |
| 1322 |
} |
| 1323 |
[(set_attr "op_type" "VRR")]) |
| 1324 |
|
| 1325 |
(define_expand "vfaez<mode>" |
| 1326 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1327 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1328 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1329 |
(match_operand:QI 3 "const_mask_operand" "")] |
| 1330 |
UNSPEC_VEC_VFAE))] |
| 1331 |
"TARGET_VX" |
| 1332 |
{ |
| 1333 |
operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_ZS); |
| 1334 |
}) |
| 1335 |
|
| 1336 |
(define_expand "vfaes<mode>" |
| 1337 |
[(parallel |
| 1338 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1339 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1340 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1341 |
(match_operand:QI 3 "const_mask_operand" "")] |
| 1342 |
UNSPEC_VEC_VFAE)) |
| 1343 |
(set (reg:CCRAW CC_REGNUM) |
| 1344 |
(unspec:CCRAW [(match_dup 1) |
| 1345 |
(match_dup 2) |
| 1346 |
(match_dup 3)] |
| 1347 |
UNSPEC_VEC_VFAECC))]) |
| 1348 |
(set (match_operand:SI 4 "memory_operand" "") |
| 1349 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1350 |
"TARGET_VX" |
| 1351 |
{ |
| 1352 |
operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_CS); |
| 1353 |
}) |
| 1354 |
|
| 1355 |
(define_expand "vfaezs<mode>" |
| 1356 |
[(parallel |
| 1357 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1358 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1359 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1360 |
(match_operand:SI 3 "const_mask_operand" "")] |
| 1361 |
UNSPEC_VEC_VFAE)) |
| 1362 |
(set (reg:CCRAW CC_REGNUM) |
| 1363 |
(unspec:CCRAW [(match_dup 1) |
| 1364 |
(match_dup 2) |
| 1365 |
(match_dup 3)] |
| 1366 |
UNSPEC_VEC_VFAECC))]) |
| 1367 |
(set (match_operand:SI 4 "memory_operand" "") |
| 1368 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1369 |
"TARGET_VX" |
| 1370 |
{ |
| 1371 |
operands[3] = GEN_INT (INTVAL (operands[3]) | VSTRING_FLAG_CS | VSTRING_FLAG_ZS); |
| 1372 |
}) |
| 1373 |
|
| 1374 |
|
| 1375 |
; Vector find element equal |
| 1376 |
|
| 1377 |
; vfeeb, vfeeh, vfeef |
| 1378 |
(define_insn "vfee<mode>" |
| 1379 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1380 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1381 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1382 |
(const_int 0)] |
| 1383 |
UNSPEC_VEC_VFEE))] |
| 1384 |
"TARGET_VX" |
| 1385 |
"vfee<bhfgq>\t%v0,%v1,%v2,0" |
| 1386 |
[(set_attr "op_type" "VRR")]) |
| 1387 |
|
| 1388 |
; vfeezb, vfeezh, vfeezf |
| 1389 |
(define_insn "vfeez<mode>" |
| 1390 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1391 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1392 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1393 |
(const_int VSTRING_FLAG_ZS)] |
| 1394 |
UNSPEC_VEC_VFEE))] |
| 1395 |
"TARGET_VX" |
| 1396 |
"vfeez<bhfgq>s\t%v0,%v1,%v2,2" |
| 1397 |
[(set_attr "op_type" "VRR")]) |
| 1398 |
|
| 1399 |
(define_expand "vfees<mode>" |
| 1400 |
[(parallel |
| 1401 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1402 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1403 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1404 |
(const_int VSTRING_FLAG_CS)] |
| 1405 |
UNSPEC_VEC_VFEE)) |
| 1406 |
(set (reg:CCRAW CC_REGNUM) |
| 1407 |
(unspec:CCRAW [(match_dup 1) |
| 1408 |
(match_dup 2) |
| 1409 |
(const_int VSTRING_FLAG_CS)] |
| 1410 |
UNSPEC_VEC_VFEECC))]) |
| 1411 |
(set (match_operand:SI 3 "memory_operand" "") |
| 1412 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1413 |
"TARGET_VX") |
| 1414 |
|
| 1415 |
(define_expand "vfeezs<mode>" |
| 1416 |
[(parallel |
| 1417 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1418 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1419 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1420 |
(match_dup 4)] |
| 1421 |
UNSPEC_VEC_VFEE)) |
| 1422 |
(set (reg:CCRAW CC_REGNUM) |
| 1423 |
(unspec:CCRAW [(match_dup 1) |
| 1424 |
(match_dup 2) |
| 1425 |
(match_dup 4)] |
| 1426 |
UNSPEC_VEC_VFEECC))]) |
| 1427 |
(set (match_operand:SI 3 "memory_operand" "") |
| 1428 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1429 |
"TARGET_VX" |
| 1430 |
{ |
| 1431 |
operands[4] = GEN_INT (VSTRING_FLAG_ZS | VSTRING_FLAG_CS); |
| 1432 |
}) |
| 1433 |
|
| 1434 |
; Vector find element not equal |
| 1435 |
|
| 1436 |
; vfeneb, vfeneh, vfenef |
| 1437 |
(define_insn "vfene<mode>" |
| 1438 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1439 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1440 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1441 |
(const_int 0)] |
| 1442 |
UNSPEC_VEC_VFENE))] |
| 1443 |
"TARGET_VX" |
| 1444 |
"vfene<bhfgq>\t%v0,%v1,%v2,0" |
| 1445 |
[(set_attr "op_type" "VRR")]) |
| 1446 |
|
| 1447 |
; vec_vfenes can be found in vector.md since it is used for strlen |
| 1448 |
|
| 1449 |
; vfenezb, vfenezh, vfenezf |
| 1450 |
(define_insn "vfenez<mode>" |
| 1451 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1452 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1453 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1454 |
(const_int VSTRING_FLAG_ZS)] |
| 1455 |
UNSPEC_VEC_VFENE))] |
| 1456 |
"TARGET_VX" |
| 1457 |
"vfenez<bhfgq>\t%v0,%v1,%v2" |
| 1458 |
[(set_attr "op_type" "VRR")]) |
| 1459 |
|
| 1460 |
(define_expand "vfenes<mode>" |
| 1461 |
[(parallel |
| 1462 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1463 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1464 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1465 |
(const_int VSTRING_FLAG_CS)] |
| 1466 |
UNSPEC_VEC_VFENE)) |
| 1467 |
(set (reg:CCRAW CC_REGNUM) |
| 1468 |
(unspec:CCRAW [(match_dup 1) |
| 1469 |
(match_dup 2) |
| 1470 |
(const_int VSTRING_FLAG_CS)] |
| 1471 |
UNSPEC_VEC_VFENECC))]) |
| 1472 |
(set (match_operand:SI 3 "memory_operand" "") |
| 1473 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1474 |
"TARGET_VX") |
| 1475 |
|
| 1476 |
(define_expand "vfenezs<mode>" |
| 1477 |
[(parallel |
| 1478 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1479 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1480 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1481 |
(match_dup 4)] |
| 1482 |
UNSPEC_VEC_VFENE)) |
| 1483 |
(set (reg:CCRAW CC_REGNUM) |
| 1484 |
(unspec:CCRAW [(match_dup 1) |
| 1485 |
(match_dup 2) |
| 1486 |
(match_dup 4)] |
| 1487 |
UNSPEC_VEC_VFENECC))]) |
| 1488 |
(set (match_operand:SI 3 "memory_operand" "") |
| 1489 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1490 |
"TARGET_VX" |
| 1491 |
{ |
| 1492 |
operands[4] = GEN_INT (VSTRING_FLAG_ZS | VSTRING_FLAG_CS); |
| 1493 |
}) |
| 1494 |
|
| 1495 |
; Vector isolate string |
| 1496 |
|
| 1497 |
; vistrb, vistrh, vistrf |
| 1498 |
(define_insn "vistr<mode>" |
| 1499 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1500 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")] |
| 1501 |
UNSPEC_VEC_VISTR))] |
| 1502 |
"TARGET_VX" |
| 1503 |
"vistr<bhfgq>\t%v0,%v1" |
| 1504 |
[(set_attr "op_type" "VRR")]) |
| 1505 |
|
| 1506 |
; vistrbs, vistrhs, vistrfs |
| 1507 |
(define_insn "*vistrs<mode>" |
| 1508 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1509 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v")] |
| 1510 |
UNSPEC_VEC_VISTR)) |
| 1511 |
(set (reg:CCRAW CC_REGNUM) |
| 1512 |
(unspec:CCRAW [(match_dup 1)] UNSPEC_VEC_VISTRCC))] |
| 1513 |
"TARGET_VX" |
| 1514 |
"vistr<bhfgq>s\t%v0,%v1" |
| 1515 |
[(set_attr "op_type" "VRR")]) |
| 1516 |
|
| 1517 |
(define_expand "vistrs<mode>" |
| 1518 |
[(parallel |
| 1519 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1520 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "")] |
| 1521 |
UNSPEC_VEC_VISTR)) |
| 1522 |
(set (reg:CCRAW CC_REGNUM) |
| 1523 |
(unspec:CCRAW [(match_dup 1)] |
| 1524 |
UNSPEC_VEC_VISTRCC))]) |
| 1525 |
(set (match_operand:SI 2 "memory_operand" "") |
| 1526 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1527 |
"TARGET_VX") |
| 1528 |
|
| 1529 |
|
| 1530 |
; Vector compare range |
| 1531 |
|
| 1532 |
; vstrcb, vstrch, vstrcf |
| 1533 |
; vstrczb, vstrczh, vstrczf |
| 1534 |
(define_insn "vstrc<mode>" |
| 1535 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1536 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1537 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1538 |
(match_operand:VI_HW_QHS 3 "register_operand" "v") |
| 1539 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 1540 |
UNSPEC_VEC_VSTRC))] |
| 1541 |
"TARGET_VX" |
| 1542 |
{ |
| 1543 |
unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]); |
| 1544 |
|
| 1545 |
if (flags & VSTRING_FLAG_ZS) |
| 1546 |
{ |
| 1547 |
flags &= ~VSTRING_FLAG_ZS; |
| 1548 |
operands[4] = GEN_INT (flags); |
| 1549 |
return "vstrcz<bhfgq>\t%v0,%v1,%v2,%v3,%b4"; |
| 1550 |
} |
| 1551 |
return "vstrc<bhfgq>\t%v0,%v1,%v2,%v3,%b4"; |
| 1552 |
} |
| 1553 |
[(set_attr "op_type" "VRR")]) |
| 1554 |
|
| 1555 |
; vstrcbs, vstrchs, vstrcfs |
| 1556 |
; vstrczbs, vstrczhs, vstrczfs |
| 1557 |
(define_insn "*vstrcs<mode>" |
| 1558 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") |
| 1559 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1560 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1561 |
(match_operand:VI_HW_QHS 3 "register_operand" "v") |
| 1562 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 1563 |
UNSPEC_VEC_VSTRC)) |
| 1564 |
(set (reg:CCRAW CC_REGNUM) |
| 1565 |
(unspec:CCRAW [(match_dup 1) |
| 1566 |
(match_dup 2) |
| 1567 |
(match_dup 3) |
| 1568 |
(match_dup 4)] |
| 1569 |
UNSPEC_VEC_VSTRCCC))] |
| 1570 |
"TARGET_VX" |
| 1571 |
{ |
| 1572 |
unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]); |
| 1573 |
|
| 1574 |
if (flags & VSTRING_FLAG_ZS) |
| 1575 |
{ |
| 1576 |
flags &= ~VSTRING_FLAG_ZS; |
| 1577 |
operands[4] = GEN_INT (flags); |
| 1578 |
return "vstrcz<bhfgq>s\t%v0,%v1,%v2,%v3,%b4"; |
| 1579 |
} |
| 1580 |
return "vstrc<bhfgq>s\t%v0,%v1,%v2,%v3,%b4"; |
| 1581 |
} |
| 1582 |
[(set_attr "op_type" "VRR")]) |
| 1583 |
|
| 1584 |
(define_expand "vstrcz<mode>" |
| 1585 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1586 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1587 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1588 |
(match_operand:VI_HW_QHS 3 "register_operand" "") |
| 1589 |
(match_operand:QI 4 "const_mask_operand" "")] |
| 1590 |
UNSPEC_VEC_VSTRC))] |
| 1591 |
"TARGET_VX" |
| 1592 |
{ |
| 1593 |
operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_ZS); |
| 1594 |
}) |
| 1595 |
|
| 1596 |
(define_expand "vstrcs<mode>" |
| 1597 |
[(parallel |
| 1598 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1599 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1600 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1601 |
(match_operand:VI_HW_QHS 3 "register_operand" "") |
| 1602 |
(match_operand:QI 4 "const_mask_operand" "")] |
| 1603 |
UNSPEC_VEC_VSTRC)) |
| 1604 |
(set (reg:CCRAW CC_REGNUM) |
| 1605 |
(unspec:CCRAW [(match_dup 1) |
| 1606 |
(match_dup 2) |
| 1607 |
(match_dup 3) |
| 1608 |
(match_dup 4)] |
| 1609 |
UNSPEC_VEC_VSTRCCC))]) |
| 1610 |
(set (match_operand:SI 5 "memory_operand" "") |
| 1611 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1612 |
"TARGET_VX" |
| 1613 |
{ |
| 1614 |
operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_CS); |
| 1615 |
}) |
| 1616 |
|
| 1617 |
(define_expand "vstrczs<mode>" |
| 1618 |
[(parallel |
| 1619 |
[(set (match_operand:VI_HW_QHS 0 "register_operand" "") |
| 1620 |
(unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1621 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1622 |
(match_operand:VI_HW_QHS 3 "register_operand" "") |
| 1623 |
(match_operand:QI 4 "const_mask_operand" "")] |
| 1624 |
UNSPEC_VEC_VSTRC)) |
| 1625 |
(set (reg:CCRAW CC_REGNUM) |
| 1626 |
(unspec:CCRAW [(match_dup 1) |
| 1627 |
(match_dup 2) |
| 1628 |
(match_dup 3) |
| 1629 |
(match_dup 4)] |
| 1630 |
UNSPEC_VEC_VSTRCCC))]) |
| 1631 |
(set (match_operand:SI 5 "memory_operand" "") |
| 1632 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1633 |
"TARGET_VX" |
| 1634 |
{ |
| 1635 |
operands[4] = GEN_INT (INTVAL (operands[4]) | VSTRING_FLAG_CS | VSTRING_FLAG_ZS); |
| 1636 |
}) |
| 1637 |
|
| 1638 |
; Vector string search |
| 1639 |
|
| 1640 |
(define_expand "vstrs<mode>" |
| 1641 |
[(parallel |
| 1642 |
[(set (match_operand:V16QI 0 "register_operand" "") |
| 1643 |
(unspec:V16QI [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1644 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1645 |
(match_operand:V16QI 3 "register_operand" "") |
| 1646 |
(const_int 0)] |
| 1647 |
UNSPEC_VEC_VSTRS)) |
| 1648 |
(set (reg:CCRAW CC_REGNUM) |
| 1649 |
(unspec:CCRAW [(match_dup 1) |
| 1650 |
(match_dup 2) |
| 1651 |
(match_dup 3) |
| 1652 |
(const_int 0)] |
| 1653 |
UNSPEC_VEC_VSTRSCC))]) |
| 1654 |
(set (match_operand:SI 4 "memory_operand" "") |
| 1655 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1656 |
"TARGET_VXE2") |
| 1657 |
|
| 1658 |
(define_expand "vstrsz<mode>" |
| 1659 |
[(parallel |
| 1660 |
[(set (match_operand:V16QI 0 "register_operand" "") |
| 1661 |
(unspec:V16QI [(match_operand:VI_HW_QHS 1 "register_operand" "") |
| 1662 |
(match_operand:VI_HW_QHS 2 "register_operand" "") |
| 1663 |
(match_operand:V16QI 3 "register_operand" "") |
| 1664 |
(const_int VSTRING_FLAG_ZS)] |
| 1665 |
UNSPEC_VEC_VSTRS)) |
| 1666 |
(set (reg:CCRAW CC_REGNUM) |
| 1667 |
(unspec:CCRAW [(match_dup 1) |
| 1668 |
(match_dup 2) |
| 1669 |
(match_dup 3) |
| 1670 |
(const_int VSTRING_FLAG_ZS)] |
| 1671 |
UNSPEC_VEC_VSTRSCC))]) |
| 1672 |
(set (match_operand:SI 4 "memory_operand" "") |
| 1673 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1674 |
"TARGET_VXE2") |
| 1675 |
|
| 1676 |
; vstrsb, vstrsh, vstrsf |
| 1677 |
; vstrszb, vstrszh, vstrszf |
| 1678 |
(define_insn "vec_vstrs<mode>" |
| 1679 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 1680 |
(unspec:V16QI [(match_operand:VI_HW_QHS 1 "register_operand" "v") |
| 1681 |
(match_operand:VI_HW_QHS 2 "register_operand" "v") |
| 1682 |
(match_operand:V16QI 3 "register_operand" "v") |
| 1683 |
(match_operand:QI 4 "const_mask_operand" "C")] |
| 1684 |
UNSPEC_VEC_VSTRS)) |
| 1685 |
(set (reg:CCRAW CC_REGNUM) |
| 1686 |
(unspec:CCRAW [(match_dup 1) |
| 1687 |
(match_dup 2) |
| 1688 |
(match_dup 3) |
| 1689 |
(match_dup 4)] |
| 1690 |
UNSPEC_VEC_VSTRSCC))] |
| 1691 |
"TARGET_VXE2" |
| 1692 |
{ |
| 1693 |
unsigned HOST_WIDE_INT flags = UINTVAL (operands[4]); |
| 1694 |
|
| 1695 |
gcc_assert (!(flags & ~VSTRING_FLAG_ZS)); |
| 1696 |
|
| 1697 |
if (flags == VSTRING_FLAG_ZS) |
| 1698 |
return "vstrsz<bhfgq>\t%v0,%v1,%v2,%v3"; |
| 1699 |
return "vstrs<bhfgq>\t%v0,%v1,%v2,%v3"; |
| 1700 |
} |
| 1701 |
[(set_attr "op_type" "VRR")]) |
| 1702 |
|
| 1703 |
|
| 1704 |
; Vector convert int<->float |
| 1705 |
|
| 1706 |
(define_insn "vcdgb" |
| 1707 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 1708 |
(unspec:V2DF [(match_operand:V2DI 1 "register_operand" "v") |
| 1709 |
(match_operand:QI 2 "const_mask_operand" "C") ; inexact suppression |
| 1710 |
(match_operand:QI 3 "const_mask_operand" "C")] ; rounding mode |
| 1711 |
UNSPEC_VEC_VCDGB))] |
| 1712 |
"TARGET_VX && UINTVAL (operands[3]) != 2 && UINTVAL (operands[3]) <= 7" |
| 1713 |
"vcdgb\t%v0,%v1,%b2,%b3" |
| 1714 |
[(set_attr "op_type" "VRR")]) |
| 1715 |
|
| 1716 |
|
| 1717 |
; The result needs to be multiplied with 2**-op2 |
| 1718 |
(define_expand "vec_ctd_s64" |
| 1719 |
[(set (match_operand:V2DF 0 "register_operand" "") |
| 1720 |
(unspec:V2DF [(match_operand:V2DI 1 "register_operand" "") |
| 1721 |
(const_int VEC_NOINEXACT) |
| 1722 |
(const_int VEC_RND_CURRENT)] |
| 1723 |
UNSPEC_VEC_VCDGB)) |
| 1724 |
(use (match_operand:QI 2 "const_int_operand" "")) |
| 1725 |
(set (match_dup 0) (mult:V2DF (match_dup 0) (match_dup 3)))] |
| 1726 |
"TARGET_VX" |
| 1727 |
{ |
| 1728 |
REAL_VALUE_TYPE f; |
| 1729 |
rtx c; |
| 1730 |
|
| 1731 |
real_2expN (&f, -INTVAL (operands[2]), DFmode); |
| 1732 |
c = const_double_from_real_value (f, DFmode); |
| 1733 |
|
| 1734 |
operands[3] = gen_const_vec_duplicate (V2DFmode, c); |
| 1735 |
operands[3] = force_reg (V2DFmode, operands[3]); |
| 1736 |
}) |
| 1737 |
|
| 1738 |
(define_insn "vcdlgb" |
| 1739 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 1740 |
(unspec:V2DF [(match_operand:V2DI 1 "register_operand" "v") |
| 1741 |
(match_operand:QI 2 "const_mask_operand" "C") ; inexact suppression |
| 1742 |
(match_operand:QI 3 "const_mask_operand" "C")] ; rounding mode |
| 1743 |
UNSPEC_VEC_VCDLGB))] |
| 1744 |
"TARGET_VX && UINTVAL (operands[3]) != 2 && UINTVAL (operands[3]) <= 7" |
| 1745 |
"vcdlgb\t%v0,%v1,%b2,%b3" |
| 1746 |
[(set_attr "op_type" "VRR")]) |
| 1747 |
|
| 1748 |
; The result needs to be multiplied with 2**-op2 |
| 1749 |
(define_expand "vec_ctd_u64" |
| 1750 |
[(set (match_operand:V2DF 0 "register_operand" "") |
| 1751 |
(unspec:V2DF [(match_operand:V2DI 1 "register_operand" "") |
| 1752 |
(const_int VEC_NOINEXACT) |
| 1753 |
(const_int VEC_RND_CURRENT)] |
| 1754 |
UNSPEC_VEC_VCDLGB)) |
| 1755 |
(use (match_operand:QI 2 "const_int_operand" "")) |
| 1756 |
(set (match_dup 0) (mult:V2DF (match_dup 0) (match_dup 3)))] |
| 1757 |
"TARGET_VX" |
| 1758 |
{ |
| 1759 |
REAL_VALUE_TYPE f; |
| 1760 |
rtx c; |
| 1761 |
|
| 1762 |
real_2expN (&f, -INTVAL (operands[2]), DFmode); |
| 1763 |
c = const_double_from_real_value (f, DFmode); |
| 1764 |
|
| 1765 |
operands[3] = gen_const_vec_duplicate (V2DFmode, c); |
| 1766 |
operands[3] = force_reg (V2DFmode, operands[3]); |
| 1767 |
}) |
| 1768 |
|
| 1769 |
(define_insn "vcgdb" |
| 1770 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1771 |
(unspec:V2DI [(match_operand:V2DF 1 "register_operand" "v") |
| 1772 |
(match_operand:QI 2 "const_mask_operand" "C") |
| 1773 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 1774 |
UNSPEC_VEC_VCGDB))] |
| 1775 |
"TARGET_VX && UINTVAL (operands[3]) != 2 && UINTVAL (operands[3]) <= 7" |
| 1776 |
"vcgdb\t%v0,%v1,%b2,%b3" |
| 1777 |
[(set_attr "op_type" "VRR")]) |
| 1778 |
|
| 1779 |
; The input needs to be multiplied with 2**op2 |
| 1780 |
(define_expand "vec_ctsl" |
| 1781 |
[(use (match_operand:QI 2 "const_int_operand" "")) |
| 1782 |
(set (match_dup 4) (mult:V2DF (match_operand:V2DF 1 "register_operand" "") |
| 1783 |
(match_dup 3))) |
| 1784 |
(set (match_operand:V2DI 0 "register_operand" "") |
| 1785 |
(unspec:V2DI [(match_dup 4) |
| 1786 |
(const_int VEC_NOINEXACT) |
| 1787 |
(const_int VEC_RND_CURRENT)] |
| 1788 |
UNSPEC_VEC_VCGDB))] |
| 1789 |
"TARGET_VX" |
| 1790 |
{ |
| 1791 |
REAL_VALUE_TYPE f; |
| 1792 |
rtx c; |
| 1793 |
|
| 1794 |
real_2expN (&f, INTVAL (operands[2]), DFmode); |
| 1795 |
c = const_double_from_real_value (f, DFmode); |
| 1796 |
|
| 1797 |
operands[3] = gen_const_vec_duplicate (V2DFmode, c); |
| 1798 |
operands[3] = force_reg (V2DFmode, operands[3]); |
| 1799 |
operands[4] = gen_reg_rtx (V2DFmode); |
| 1800 |
}) |
| 1801 |
|
| 1802 |
(define_insn "vclgdb" |
| 1803 |
[(set (match_operand:V2DI 0 "register_operand" "=v") |
| 1804 |
(unspec:V2DI [(match_operand:V2DF 1 "register_operand" "v") |
| 1805 |
(match_operand:QI 2 "const_mask_operand" "C") |
| 1806 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 1807 |
UNSPEC_VEC_VCLGDB))] |
| 1808 |
"TARGET_VX && UINTVAL (operands[3]) != 2 && UINTVAL (operands[3]) <= 7" |
| 1809 |
"vclgdb\t%v0,%v1,%b2,%b3" |
| 1810 |
[(set_attr "op_type" "VRR")]) |
| 1811 |
|
| 1812 |
; The input needs to be multiplied with 2**op2 |
| 1813 |
(define_expand "vec_ctul" |
| 1814 |
[(use (match_operand:QI 2 "const_int_operand" "")) |
| 1815 |
(set (match_dup 4) (mult:V2DF (match_operand:V2DF 1 "register_operand" "") |
| 1816 |
(match_dup 3))) |
| 1817 |
(set (match_operand:V2DI 0 "register_operand" "") |
| 1818 |
(unspec:V2DI [(match_dup 4) |
| 1819 |
(const_int VEC_NOINEXACT) |
| 1820 |
(const_int VEC_RND_CURRENT)] |
| 1821 |
UNSPEC_VEC_VCLGDB))] |
| 1822 |
"TARGET_VX" |
| 1823 |
{ |
| 1824 |
REAL_VALUE_TYPE f; |
| 1825 |
rtx c; |
| 1826 |
|
| 1827 |
real_2expN (&f, INTVAL (operands[2]), DFmode); |
| 1828 |
c = const_double_from_real_value (f, DFmode); |
| 1829 |
|
| 1830 |
operands[3] = gen_const_vec_duplicate (V2DFmode, c); |
| 1831 |
operands[3] = force_reg (V2DFmode, operands[3]); |
| 1832 |
operands[4] = gen_reg_rtx (V2DFmode); |
| 1833 |
}) |
| 1834 |
|
| 1835 |
; Vector load fp integer - IEEE inexact exception is suppressed |
| 1836 |
; vfisb, vfidb, wfisb, wfidb, wfixb |
| 1837 |
(define_insn "vec_fpint<mode>" |
| 1838 |
[(set (match_operand:VFT 0 "register_operand" "=v") |
| 1839 |
(unspec:VFT [(match_operand:VFT 1 "register_operand" "v") |
| 1840 |
(match_operand:QI 2 "const_mask_operand" "C") ; inexact suppression control |
| 1841 |
(match_operand:QI 3 "const_mask_operand" "C")] ; rounding mode |
| 1842 |
UNSPEC_VEC_VFI))] |
| 1843 |
"TARGET_VX" |
| 1844 |
"<vw>fi<sdx>b\t%v0,%v1,%b2,%b3" |
| 1845 |
[(set_attr "op_type" "VRR")]) |
| 1846 |
|
| 1847 |
|
| 1848 |
; Vector load lengthened - V4SF -> V2DF |
| 1849 |
|
| 1850 |
(define_insn "vflls" |
| 1851 |
[(set (match_operand:V2DF 0 "register_operand" "=v") |
| 1852 |
(unspec:V2DF [(match_operand:V4SF 1 "register_operand" "v")] |
| 1853 |
UNSPEC_VEC_VFLL))] |
| 1854 |
"TARGET_VX" |
| 1855 |
"vldeb\t%v0,%v1" |
| 1856 |
[(set_attr "op_type" "VRR")]) |
| 1857 |
|
| 1858 |
(define_expand "vec_ld2f" |
| 1859 |
[; Initialize a vector to all zeroes. FIXME: This should not be |
| 1860 |
; necessary since all elements of the vector will be set anyway. |
| 1861 |
; This is just to make it explicit to the data flow framework. |
| 1862 |
(set (match_dup 2) (match_dup 3)) |
| 1863 |
(set (match_dup 2) (unspec:V4SF [(match_operand:SF 1 "memory_operand" "") |
| 1864 |
(const_int 0) |
| 1865 |
(match_dup 2)] |
| 1866 |
UNSPEC_VEC_SET)) |
| 1867 |
(set (match_dup 2) (unspec:V4SF [(match_dup 4) |
| 1868 |
(const_int 2) |
| 1869 |
(match_dup 2)] |
| 1870 |
UNSPEC_VEC_SET)) |
| 1871 |
(set (match_operand:V2DF 0 "register_operand" "") |
| 1872 |
(unspec:V2DF [(match_dup 2)] UNSPEC_VEC_VFLL))] |
| 1873 |
"TARGET_VX" |
| 1874 |
{ |
| 1875 |
operands[2] = gen_reg_rtx (V4SFmode); |
| 1876 |
operands[3] = CONST0_RTX (V4SFmode); |
| 1877 |
operands[4] = adjust_address (operands[1], SFmode, 4); |
| 1878 |
}) |
| 1879 |
|
| 1880 |
|
| 1881 |
; Vector load rounded - V2DF -> V4SF |
| 1882 |
|
| 1883 |
(define_insn "vflrd" |
| 1884 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 1885 |
(unspec:V4SF [(match_operand:V2DF 1 "register_operand" "v") |
| 1886 |
(match_operand:QI 2 "const_mask_operand" "C") |
| 1887 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 1888 |
UNSPEC_VEC_VFLR))] |
| 1889 |
"TARGET_VX" |
| 1890 |
"vledb\t%v0,%v1,%b2,%b3" |
| 1891 |
[(set_attr "op_type" "VRR")]) |
| 1892 |
|
| 1893 |
(define_expand "vec_st2f" |
| 1894 |
[(set (match_dup 2) |
| 1895 |
(unspec:V4SF [(match_operand:V2DF 0 "register_operand" "") |
| 1896 |
(const_int VEC_INEXACT) |
| 1897 |
(const_int VEC_RND_CURRENT)] |
| 1898 |
UNSPEC_VEC_VFLR)) |
| 1899 |
(set (match_operand:SF 1 "memory_operand" "") |
| 1900 |
(vec_select:SF (match_dup 2) |
| 1901 |
(parallel [(const_int 0)]))) |
| 1902 |
(set (match_dup 3) |
| 1903 |
(vec_select:SF (match_dup 2) |
| 1904 |
(parallel [(const_int 2)])))] |
| 1905 |
"TARGET_VX" |
| 1906 |
{ |
| 1907 |
operands[2] = gen_reg_rtx (V4SFmode); |
| 1908 |
operands[3] = adjust_address (operands[1], SFmode, 4); |
| 1909 |
}) |
| 1910 |
|
| 1911 |
|
| 1912 |
; Vector square root fp vec_sqrt -> sqrt rtx standard name |
| 1913 |
|
| 1914 |
;; Vector FP test data class immediate |
| 1915 |
|
| 1916 |
; vec_all_nan, vec_all_numeric, vec_any_nan, vec_any_numeric |
| 1917 |
; These ignore the vector result and only want CC stored to an int |
| 1918 |
; pointer. |
| 1919 |
|
| 1920 |
; vftcisb, vftcidb, wftcixb |
| 1921 |
(define_insn "*vftci<mode>_cconly" |
| 1922 |
[(set (reg:CCRAW CC_REGNUM) |
| 1923 |
(unspec:CCRAW [(match_operand:VF_HW 1 "register_operand" "v") |
| 1924 |
(match_operand:HI 2 "const_int_operand" "J")] |
| 1925 |
UNSPEC_VEC_VFTCICC)) |
| 1926 |
(clobber (match_scratch:<TOINTVEC> 0 "=v"))] |
| 1927 |
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")" |
| 1928 |
"<vw>ftci<sdx>b\t%v0,%v1,%x2" |
| 1929 |
[(set_attr "op_type" "VRR")]) |
| 1930 |
|
| 1931 |
(define_expand "vftci<mode>_intcconly" |
| 1932 |
[(parallel |
| 1933 |
[(set (reg:CCRAW CC_REGNUM) |
| 1934 |
(unspec:CCRAW [(match_operand:VF_HW 0 "register_operand") |
| 1935 |
(match_operand:HI 1 "const_int_operand")] |
| 1936 |
UNSPEC_VEC_VFTCICC)) |
| 1937 |
(clobber (scratch:<TOINTVEC>))]) |
| 1938 |
(set (match_operand:SI 2 "register_operand" "") |
| 1939 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1940 |
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[1]), 'J', \"J\")") |
| 1941 |
|
| 1942 |
; vec_fp_test_data_class wants the result vector and the CC stored to |
| 1943 |
; an int pointer. |
| 1944 |
|
| 1945 |
; vftcisb, vftcidb, wftcixb |
| 1946 |
(define_insn "vftci<mode>" |
| 1947 |
[(set (match_operand:VF_HW 0 "register_operand" "=v") |
| 1948 |
(unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v") |
| 1949 |
(match_operand:HI 2 "const_int_operand" "J")] |
| 1950 |
UNSPEC_VEC_VFTCI)) |
| 1951 |
(set (reg:CCRAW CC_REGNUM) |
| 1952 |
(unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCICC))] |
| 1953 |
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")" |
| 1954 |
"<vw>ftci<sdx>b\t%v0,%v1,%x2" |
| 1955 |
[(set_attr "op_type" "VRR")]) |
| 1956 |
|
| 1957 |
(define_expand "vftci<mode>_intcc" |
| 1958 |
[(parallel |
| 1959 |
[(set (match_operand:VF_HW 0 "register_operand") |
| 1960 |
(unspec:VF_HW [(match_operand:VF_HW 1 "register_operand") |
| 1961 |
(match_operand:HI 2 "const_int_operand")] |
| 1962 |
UNSPEC_VEC_VFTCI)) |
| 1963 |
(set (reg:CCRAW CC_REGNUM) |
| 1964 |
(unspec:CCRAW [(match_dup 1) (match_dup 2)] UNSPEC_VEC_VFTCICC))]) |
| 1965 |
(set (match_operand:SI 3 "nonimmediate_operand") |
| 1966 |
(unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1967 |
"TARGET_VX && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operands[2]), 'J', \"J\")") |
| 1968 |
|
| 1969 |
;; |
| 1970 |
;; Integer compares |
| 1971 |
;; |
| 1972 |
|
| 1973 |
; All comparisons which produce a CC need fully populated (VI_HW) |
| 1974 |
; vector arguments. Otherwise the any/all CCs would be just bogus. |
| 1975 |
|
| 1976 |
(define_insn "*vec_cmp<VICMP:insn_cmp><VIT_HW_VXE3_T:mode>_cconly" |
| 1977 |
[(set (reg:VICMP CC_REGNUM) |
| 1978 |
(compare:VICMP (match_operand:VIT_HW_VXE3_T 0 "register_operand" "v") |
| 1979 |
(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v"))) |
| 1980 |
(clobber (match_scratch:VIT_HW_VXE3_T 2 "=v"))] |
| 1981 |
"TARGET_VX" |
| 1982 |
"vc<VICMP:insn_cmp><VIT_HW_VXE3_T:bhfgq>s\t%v2,%v0,%v1" |
| 1983 |
[(set_attr "op_type" "VRR")]) |
| 1984 |
|
| 1985 |
; FIXME: The following 2x3 definitions should be merged into 2 with |
| 1986 |
; VICMP like above but I could not find a way to set the comparison |
| 1987 |
; operator (eq) depending on the mode CCVEQ (mode_iterator). Or the |
| 1988 |
; other way around - setting the mode depending on the code |
| 1989 |
; (code_iterator). |
| 1990 |
(define_expand "vec_cmpeq<VIT_HW_VXE3_T:mode>_cc" |
| 1991 |
[(parallel |
| 1992 |
[(set (reg:CCVEQ CC_REGNUM) |
| 1993 |
(compare:CCVEQ (match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 1994 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v"))) |
| 1995 |
(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 1996 |
(eq:VIT_HW_VXE3_T (match_dup 1) (match_dup 2)))]) |
| 1997 |
(set (match_operand:SI 3 "memory_operand" "") |
| 1998 |
(unspec:SI [(reg:CCVEQ CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 1999 |
"TARGET_VX") |
| 2000 |
|
| 2001 |
(define_expand "vec_cmph<VIT_HW_VXE3_T:mode>_cc" |
| 2002 |
[(parallel |
| 2003 |
[(set (reg:CCVIH CC_REGNUM) |
| 2004 |
(compare:CCVIH (match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 2005 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v"))) |
| 2006 |
(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 2007 |
(gt:VIT_HW_VXE3_T (match_dup 1) (match_dup 2)))]) |
| 2008 |
(set (match_operand:SI 3 "memory_operand" "") |
| 2009 |
(unspec:SI [(reg:CCVIH CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 2010 |
"TARGET_VX") |
| 2011 |
|
| 2012 |
(define_expand "vec_cmphl<VIT_HW_VXE3_T:mode>_cc" |
| 2013 |
[(parallel |
| 2014 |
[(set (reg:CCVIHU CC_REGNUM) |
| 2015 |
(compare:CCVIHU (match_operand:VIT_HW_VXE3_T 1 "register_operand" "v") |
| 2016 |
(match_operand:VIT_HW_VXE3_T 2 "register_operand" "v"))) |
| 2017 |
(set (match_operand:VIT_HW_VXE3_T 0 "register_operand" "=v") |
| 2018 |
(gtu:VIT_HW_VXE3_T (match_dup 1) (match_dup 2)))]) |
| 2019 |
(set (match_operand:SI 3 "memory_operand" "") |
| 2020 |
(unspec:SI [(reg:CCVIHU CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 2021 |
"TARGET_VX") |
| 2022 |
|
| 2023 |
|
| 2024 |
(define_insn "*vec_cmpeq<VIT_HW_VXE3_T:mode>_cc" |
| 2025 |
[(set (reg:CCVEQ CC_REGNUM) |
| 2026 |
(compare:CCVEQ (match_operand:VIT_HW_VXE3_T 0 "register_operand" "v") |
| 2027 |
(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v"))) |
| 2028 |
(set (match_operand:VIT_HW_VXE3_T 2 "register_operand" "=v") |
| 2029 |
(eq:VIT_HW_VXE3_T (match_dup 0) (match_dup 1)))] |
| 2030 |
"TARGET_VX" |
| 2031 |
"vceq<VIT_HW_VXE3_T:bhfgq>s\t%v2,%v0,%v1" |
| 2032 |
[(set_attr "op_type" "VRR")]) |
| 2033 |
|
| 2034 |
(define_insn "*vec_cmph<VIT_HW_VXE3_T:mode>_cc" |
| 2035 |
[(set (reg:CCVIH CC_REGNUM) |
| 2036 |
(compare:CCVIH (match_operand:VIT_HW_VXE3_T 0 "register_operand" "v") |
| 2037 |
(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v"))) |
| 2038 |
(set (match_operand:VIT_HW_VXE3_T 2 "register_operand" "=v") |
| 2039 |
(gt:VIT_HW_VXE3_T (match_dup 0) (match_dup 1)))] |
| 2040 |
"TARGET_VX" |
| 2041 |
"vch<VIT_HW_VXE3_T:bhfgq>s\t%v2,%v0,%v1" |
| 2042 |
[(set_attr "op_type" "VRR")]) |
| 2043 |
|
| 2044 |
(define_insn "*vec_cmphl<VIT_HW_VXE3_T:mode>_cc" |
| 2045 |
[(set (reg:CCVIHU CC_REGNUM) |
| 2046 |
(compare:CCVIHU (match_operand:VIT_HW_VXE3_T 0 "register_operand" "v") |
| 2047 |
(match_operand:VIT_HW_VXE3_T 1 "register_operand" "v"))) |
| 2048 |
(set (match_operand:VIT_HW_VXE3_T 2 "register_operand" "=v") |
| 2049 |
(gtu:VIT_HW_VXE3_T (match_dup 0) (match_dup 1)))] |
| 2050 |
"TARGET_VX" |
| 2051 |
"vchl<VIT_HW_VXE3_T:bhfgq>s\t%v2,%v0,%v1" |
| 2052 |
[(set_attr "op_type" "VRR")]) |
| 2053 |
|
| 2054 |
;; |
| 2055 |
;; Floating point compares |
| 2056 |
;; |
| 2057 |
|
| 2058 |
; vfcesbs, vfcedbs, wfcexbs, vfchsbs, vfchdbs, wfchxbs, vfchesbs, vfchedbs, wfchexbs |
| 2059 |
(define_insn "*vec_cmp<insn_cmp><VF_HW:mode>_cconly" |
| 2060 |
[(set (reg:VFCMP CC_REGNUM) |
| 2061 |
(compare:VFCMP (match_operand:VF_HW 0 "register_operand" "v") |
| 2062 |
(match_operand:VF_HW 1 "register_operand" "v"))) |
| 2063 |
(clobber (match_scratch:<TOINTVEC> 2 "=v"))] |
| 2064 |
"TARGET_VX" |
| 2065 |
"<vw>fc<asm_fcmp><sdx>bs\t%v2,%v0,%v1" |
| 2066 |
[(set_attr "op_type" "VRR")]) |
| 2067 |
|
| 2068 |
; FIXME: Merge the following 2x3 patterns with VFCMP |
| 2069 |
(define_expand "vec_cmpeq<mode>_cc" |
| 2070 |
[(parallel |
| 2071 |
[(set (reg:CCVEQ CC_REGNUM) |
| 2072 |
(compare:CCVEQ (match_operand:VF_HW 1 "register_operand" "v") |
| 2073 |
(match_operand:VF_HW 2 "register_operand" "v"))) |
| 2074 |
(set (match_operand:<TOINTVEC> 0 "register_operand" "=v") |
| 2075 |
(eq:<TOINTVEC> (match_dup 1) (match_dup 2)))]) |
| 2076 |
(set (match_operand:SI 3 "memory_operand" "") |
| 2077 |
(unspec:SI [(reg:CCVEQ CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 2078 |
"TARGET_VX") |
| 2079 |
|
| 2080 |
(define_expand "vec_cmph<mode>_cc" |
| 2081 |
[(parallel |
| 2082 |
[(set (reg:CCVFH CC_REGNUM) |
| 2083 |
(compare:CCVFH (match_operand:VF_HW 1 "register_operand" "v") |
| 2084 |
(match_operand:VF_HW 2 "register_operand" "v"))) |
| 2085 |
(set (match_operand:<TOINTVEC> 0 "register_operand" "=v") |
| 2086 |
(gt:<TOINTVEC> (match_dup 1) (match_dup 2)))]) |
| 2087 |
(set (match_operand:SI 3 "memory_operand" "") |
| 2088 |
(unspec:SI [(reg:CCVIH CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 2089 |
"TARGET_VX") |
| 2090 |
|
| 2091 |
(define_expand "vec_cmphe<mode>_cc" |
| 2092 |
[(parallel |
| 2093 |
[(set (reg:CCVFHE CC_REGNUM) |
| 2094 |
(compare:CCVFHE (match_operand:VF_HW 1 "register_operand" "v") |
| 2095 |
(match_operand:VF_HW 2 "register_operand" "v"))) |
| 2096 |
(set (match_operand:<TOINTVEC> 0 "register_operand" "=v") |
| 2097 |
(ge:<TOINTVEC> (match_dup 1) (match_dup 2)))]) |
| 2098 |
(set (match_operand:SI 3 "memory_operand" "") |
| 2099 |
(unspec:SI [(reg:CCVFHE CC_REGNUM)] UNSPEC_CC_TO_INT))] |
| 2100 |
"TARGET_VX") |
| 2101 |
|
| 2102 |
; These 3 cannot be merged as the insn defintion above since it also |
| 2103 |
; requires to rewrite the RTL equality operator that the same time as |
| 2104 |
; the CC mode. |
| 2105 |
|
| 2106 |
; vfcesbs, vfcedbs, wfcexbs |
| 2107 |
(define_insn "*vec_cmpeq<mode>_cc" |
| 2108 |
[(set (reg:CCVEQ CC_REGNUM) |
| 2109 |
(compare:CCVEQ (match_operand:VF_HW 0 "register_operand" "v") |
| 2110 |
(match_operand:VF_HW 1 "register_operand" "v"))) |
| 2111 |
(set (match_operand:<TOINTVEC> 2 "register_operand" "=v") |
| 2112 |
(eq:<TOINTVEC> (match_dup 0) (match_dup 1)))] |
| 2113 |
"TARGET_VX" |
| 2114 |
"<vw>fce<sdx>bs\t%v2,%v0,%v1" |
| 2115 |
[(set_attr "op_type" "VRR")]) |
| 2116 |
|
| 2117 |
; vfchsbs, vfchdbs, wfchxbs |
| 2118 |
(define_insn "*vec_cmph<mode>_cc" |
| 2119 |
[(set (reg:CCVFH CC_REGNUM) |
| 2120 |
(compare:CCVFH (match_operand:VF_HW 0 "register_operand" "v") |
| 2121 |
(match_operand:VF_HW 1 "register_operand" "v"))) |
| 2122 |
(set (match_operand:<TOINTVEC> 2 "register_operand" "=v") |
| 2123 |
(gt:<TOINTVEC> (match_dup 0) (match_dup 1)))] |
| 2124 |
"TARGET_VX" |
| 2125 |
"<vw>fch<sdx>bs\t%v2,%v0,%v1" |
| 2126 |
[(set_attr "op_type" "VRR")]) |
| 2127 |
|
| 2128 |
; vfchesbs, vfchedbs, wfchexbs |
| 2129 |
(define_insn "*vec_cmphe<mode>_cc" |
| 2130 |
[(set (reg:CCVFHE CC_REGNUM) |
| 2131 |
(compare:CCVFHE (match_operand:VF_HW 0 "register_operand" "v") |
| 2132 |
(match_operand:VF_HW 1 "register_operand" "v"))) |
| 2133 |
(set (match_operand:<TOINTVEC> 2 "register_operand" "=v") |
| 2134 |
(ge:<TOINTVEC> (match_dup 0) (match_dup 1)))] |
| 2135 |
"TARGET_VX" |
| 2136 |
"<vw>fche<sdx>bs\t%v2,%v0,%v1" |
| 2137 |
[(set_attr "op_type" "VRR")]) |
| 2138 |
|
| 2139 |
|
| 2140 |
(define_insn "vfmin<mode>" |
| 2141 |
[(set (match_operand:VF_HW 0 "register_operand" "=v") |
| 2142 |
(unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v") |
| 2143 |
(match_operand:VF_HW 2 "register_operand" "v") |
| 2144 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 2145 |
UNSPEC_VEC_VFMIN))] |
| 2146 |
"TARGET_VXE" |
| 2147 |
"<vw>fmin<sdx>b\t%v0,%v1,%v2,%b3" |
| 2148 |
[(set_attr "op_type" "VRR")]) |
| 2149 |
|
| 2150 |
(define_insn "vfmax<mode>" |
| 2151 |
[(set (match_operand:VF_HW 0 "register_operand" "=v") |
| 2152 |
(unspec:VF_HW [(match_operand:VF_HW 1 "register_operand" "v") |
| 2153 |
(match_operand:VF_HW 2 "register_operand" "v") |
| 2154 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 2155 |
UNSPEC_VEC_VFMAX))] |
| 2156 |
"TARGET_VXE" |
| 2157 |
"<vw>fmax<sdx>b\t%v0,%v1,%v2,%b3" |
| 2158 |
[(set_attr "op_type" "VRR")]) |
| 2159 |
|
| 2160 |
; vec_insert (__builtin_bswap32 (*a), b, 1) set-element-bswap-2.c |
| 2161 |
; b[1] = __builtin_bswap32 (*a) set-element-bswap-3.c |
| 2162 |
; vlebrh, vlebrf, vlebrg |
| 2163 |
(define_insn "*vec_set_bswap_elem<mode>" |
| 2164 |
[(set (match_operand:V_HW_HSD 0 "register_operand" "=v") |
| 2165 |
(unspec:V_HW_HSD [(bswap:<non_vec> (match_operand:<non_vec> 1 "memory_operand" "R")) |
| 2166 |
(match_operand:SI 2 "const_int_operand" "C") |
| 2167 |
(match_operand:V_HW_HSD 3 "register_operand" "0")] |
| 2168 |
UNSPEC_VEC_SET))] |
| 2169 |
"TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)" |
| 2170 |
"vlebr<bhfgq>\t%v0,%1,%2" |
| 2171 |
[(set_attr "op_type" "VRX")]) |
| 2172 |
|
| 2173 |
; vec_revb (vec_insert (*a, vec_revb (b), 1)) set-element-bswap-1.c |
| 2174 |
; vlebrh, vlebrf, vlebrg |
| 2175 |
(define_insn "*vec_set_bswap_vec<mode>" |
| 2176 |
[(set (match_operand:V_HW_HSD 0 "register_operand" "=v") |
| 2177 |
(bswap:V_HW_HSD |
| 2178 |
(unspec:V_HW_HSD [(match_operand:<non_vec> 1 "memory_operand" "R") |
| 2179 |
(match_operand:SI 2 "const_int_operand" "C") |
| 2180 |
(bswap:V_HW_HSD (match_operand:V_HW_HSD 3 "register_operand" "0"))] |
| 2181 |
UNSPEC_VEC_SET))) |
| 2182 |
(use (match_operand:V16QI 4 "permute_pattern_operand" "X"))] |
| 2183 |
"TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)" |
| 2184 |
"vlebr<bhfgq>\t%v0,%1,%2" |
| 2185 |
[(set_attr "op_type" "VRX")]) |
| 2186 |
|
| 2187 |
; *a = vec_extract (vec_revb (b), 1); get-element-bswap-3.c |
| 2188 |
; *a = vec_revb (b)[1]; get-element-bswap-4.c |
| 2189 |
; vstebrh, vstebrf, vstebrg |
| 2190 |
(define_insn "*vec_extract_bswap_vec<mode>" |
| 2191 |
[(set (match_operand:<non_vec> 0 "memory_operand" "=R") |
| 2192 |
(vec_select:<non_vec> |
| 2193 |
(bswap:V_HW_HSD (match_operand:V_HW_HSD 1 "register_operand" "v")) |
| 2194 |
(parallel [(match_operand:SI 2 "const_int_operand" "C")])))] |
| 2195 |
"TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)" |
| 2196 |
"vstebr<bhfgq>\t%v1,%0,%2" |
| 2197 |
[(set_attr "op_type" "VRX")]) |
| 2198 |
|
| 2199 |
; *a = __builtin_bswap32 (vec_extract (b, 1)); get-element-bswap-1.c |
| 2200 |
; *a = __builtin_bswap32 (b[1]); get-element-bswap-2.c |
| 2201 |
; vstebrh, vstebrf, vstebrg |
| 2202 |
(define_insn "*vec_extract_bswap_elem<mode>" |
| 2203 |
[(set (match_operand:<non_vec> 0 "memory_operand" "=R") |
| 2204 |
(bswap:<non_vec> |
| 2205 |
(vec_select:<non_vec> |
| 2206 |
(match_operand:V_HW_HSD 1 "register_operand" "v") |
| 2207 |
(parallel [(match_operand:SI 2 "const_int_operand" "C")]))))] |
| 2208 |
"TARGET_VXE2 && UINTVAL (operands[2]) < GET_MODE_NUNITS (<V_HW_HSD:MODE>mode)" |
| 2209 |
"vstebr<bhfgq>\t%v1,%0,%2" |
| 2210 |
[(set_attr "op_type" "VRX")]) |
| 2211 |
|
| 2212 |
|
| 2213 |
;; |
| 2214 |
;; NNPA Facility |
| 2215 |
;; |
| 2216 |
|
| 2217 |
(define_insn "vclfnhs_v8hi" |
| 2218 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2219 |
(unspec:V4SF [(vec_select:V4HI |
| 2220 |
(match_operand:V8HI 1 "register_operand" "v") |
| 2221 |
(parallel [(const_int 0) (const_int 1) (const_int 2) (const_int 3)])) |
| 2222 |
(match_operand:QI 2 "const_mask_operand" "C")] |
| 2223 |
UNSPEC_NNPA_VCLFNHS_V8HI))] |
| 2224 |
"TARGET_NNPA" |
| 2225 |
"vclfnh\t%v0,%v1,2,%2" |
| 2226 |
[(set_attr "op_type" "VRR")]) |
| 2227 |
|
| 2228 |
(define_insn "vclfnls_v8hi" |
| 2229 |
[(set (match_operand:V4SF 0 "register_operand" "=v") |
| 2230 |
(unspec:V4SF [(vec_select:V4HI |
| 2231 |
(match_operand:V8HI 1 "register_operand" "v") |
| 2232 |
(parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7)])) |
| 2233 |
(match_operand:QI 2 "const_mask_operand" "C")] |
| 2234 |
UNSPEC_NNPA_VCLFNLS_V8HI))] |
| 2235 |
"TARGET_NNPA" |
| 2236 |
"vclfnl\t%v0,%v1,2,%2" |
| 2237 |
[(set_attr "op_type" "VRR")]) |
| 2238 |
|
| 2239 |
(define_insn "vcrnfs_v8hi" |
| 2240 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2241 |
(unspec:V8HI [(match_operand:V4SF 1 "register_operand" "v") |
| 2242 |
(match_operand:V4SF 2 "register_operand" "v") |
| 2243 |
(match_operand:QI 3 "const_mask_operand" "C")] |
| 2244 |
UNSPEC_NNPA_VCRNFS_V8HI))] |
| 2245 |
"TARGET_NNPA" |
| 2246 |
"vcrnf\t%v0,%v1,%v2,%3,2" |
| 2247 |
[(set_attr "op_type" "VRR")]) |
| 2248 |
|
| 2249 |
(define_insn "vcfn_v8hi" |
| 2250 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2251 |
(unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") |
| 2252 |
(match_operand:QI 2 "const_mask_operand" "C")] |
| 2253 |
UNSPEC_NNPA_VCFN_V8HI))] |
| 2254 |
"TARGET_NNPA" |
| 2255 |
"vcfn\t%v0,%v1,1,%2" |
| 2256 |
[(set_attr "op_type" "VRR")]) |
| 2257 |
|
| 2258 |
(define_insn "vcnf_v8hi" |
| 2259 |
[(set (match_operand:V8HI 0 "register_operand" "=v") |
| 2260 |
(unspec:V8HI [(match_operand:V8HI 1 "register_operand" "v") |
| 2261 |
(match_operand:QI 2 "const_mask_operand" "C")] |
| 2262 |
UNSPEC_NNPA_VCNF_V8HI))] |
| 2263 |
"TARGET_NNPA" |
| 2264 |
"vcnf\t%v0,%v1,%2,1" |
| 2265 |
[(set_attr "op_type" "VRR")]) |
| 2266 |
|
| 2267 |
; vblendb, vblendh, vblendf, vblendg, vblendq |
| 2268 |
(define_insn "vblend<mode>" |
| 2269 |
[(set (match_operand:VT_HW 0 "register_operand" "=v") |
| 2270 |
(unspec:VT_HW [(match_operand:VT_HW 1 "register_operand" "v") |
| 2271 |
(match_operand:VT_HW 2 "register_operand" "v") |
| 2272 |
(match_operand:<VT_HW:TOINTVEC> 3 "register_operand" "v")] |
| 2273 |
UNSPEC_VEC_VBLEND))] |
| 2274 |
"TARGET_VXE3" |
| 2275 |
"vblend<bhfgq>\t%v0,%v1,%v2,%v3" |
| 2276 |
[(set_attr "op_type" "VRR")]) |
| 2277 |
|
| 2278 |
; vgemb |
| 2279 |
(define_insn "vgemv16qi" |
| 2280 |
[(set (match_operand:V16QI 0 "register_operand" "=v") |
| 2281 |
(unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")] |
| 2282 |
UNSPEC_VEC_VGEM))] |
| 2283 |
"TARGET_VXE3" |
| 2284 |
"vgemb\t%v0,%v1" |
| 2285 |
[(set_attr "op_type" "VRR")]) |
| 2286 |
|
| 2287 |
; vgemh, vgemf, vgemg, vgemq |
| 2288 |
(define_insn "vgem<mode>" |
| 2289 |
[(set (match_operand:VI_HW_HSDT 0 "register_operand" "=v") |
| 2290 |
(unspec:VI_HW_HSDT [(match_operand:V16QI 1 "register_operand" "v")] |
| 2291 |
UNSPEC_VEC_VGEM))] |
| 2292 |
"TARGET_VXE3" |
| 2293 |
"vgem<bhfgq>\t%v0,%v1" |
| 2294 |
[(set_attr "op_type" "VRR")]) |