| 1 |
;; ARM NEON coprocessor Machine Description |
| 2 |
;; Copyright (C) 2006-2025 Free Software Foundation, Inc. |
| 3 |
;; Written by CodeSourcery. |
| 4 |
;; |
| 5 |
;; This file is part of GCC. |
| 6 |
;; |
| 7 |
;; GCC is free software; you can redistribute it and/or modify it |
| 8 |
;; under the terms of the GNU General Public License as published by |
| 9 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 10 |
;; any later version. |
| 11 |
;; |
| 12 |
;; GCC is distributed in the hope that it will be useful, but |
| 13 |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
;; General Public License for more details. |
| 16 |
;; |
| 17 |
;; You should have received a copy of the GNU General Public License |
| 18 |
;; along with GCC; see the file COPYING3. If not see |
| 19 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
|
| 22 |
;; Attribute used to permit string comparisons against <VQH_mnem> in |
| 23 |
;; type attribute definitions. |
| 24 |
(define_attr "vqh_mnem" "vadd,vmin,vmax" (const_string "vadd")) |
| 25 |
|
| 26 |
(define_insn "unaligned_storev8qi" |
| 27 |
[(set (match_operand:V8QI 0 "memory_operand" "=Un") |
| 28 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "w")] |
| 29 |
UNSPEC_UNALIGNED_STORE))] |
| 30 |
"TARGET_NEON" |
| 31 |
"* |
| 32 |
return output_move_neon (operands); |
| 33 |
" |
| 34 |
[(set_attr "type" "neon_store1_1reg")]) |
| 35 |
|
| 36 |
(define_insn "*neon_mov<mode>" |
| 37 |
[(set (match_operand:VDXMOV 0 "nonimmediate_operand" |
| 38 |
"=w,Un,w, w, w, ?r,?w,?r, ?Us,*r") |
| 39 |
(match_operand:VDXMOV 1 "general_operand" |
| 40 |
" w,w, Dm,Dn,Uni, w, r, Usi,r,*r"))] |
| 41 |
"TARGET_NEON |
| 42 |
&& (register_operand (operands[0], <MODE>mode) |
| 43 |
|| register_operand (operands[1], <MODE>mode))" |
| 44 |
{ |
| 45 |
if (which_alternative == 2 || which_alternative == 3) |
| 46 |
{ |
| 47 |
int width, is_valid; |
| 48 |
static char templ[40]; |
| 49 |
|
| 50 |
is_valid = simd_immediate_valid_for_move (operands[1], <MODE>mode, |
| 51 |
&operands[1], &width); |
| 52 |
|
| 53 |
gcc_assert (is_valid != 0); |
| 54 |
|
| 55 |
if (width == 0) |
| 56 |
return "vmov.f32\t%P0, %1 @ <mode>"; |
| 57 |
else |
| 58 |
sprintf (templ, "vmov.i%d\t%%P0, %%x1 @ <mode>", width); |
| 59 |
|
| 60 |
return templ; |
| 61 |
} |
| 62 |
|
| 63 |
switch (which_alternative) |
| 64 |
{ |
| 65 |
case 0: return "vmov\t%P0, %P1 @ <mode>"; |
| 66 |
case 1: case 4: return output_move_neon (operands); |
| 67 |
case 2: case 3: gcc_unreachable (); |
| 68 |
case 5: return "vmov\t%Q0, %R0, %P1 @ <mode>"; |
| 69 |
case 6: return "vmov\t%P0, %Q1, %R1 @ <mode>"; |
| 70 |
case 9: return "#"; |
| 71 |
default: return output_move_double (operands, true, NULL); |
| 72 |
} |
| 73 |
} |
| 74 |
[(set_attr "type" "neon_move<q>,neon_store1_1reg,neon_move<q>,\ |
| 75 |
neon_move<q>,neon_load1_1reg, neon_to_gp<q>,\ |
| 76 |
neon_from_gp<q>,neon_load1_2reg, neon_store1_2reg,\ |
| 77 |
multiple") |
| 78 |
(set_attr "length" "4,4,4,4,4,4,4,8,8,8") |
| 79 |
(set_attr "arm_pool_range" "*,*,*,*,1020,*,*,1020,*,*") |
| 80 |
(set_attr "thumb2_pool_range" "*,*,*,*,1018,*,*,1018,*,*") |
| 81 |
(set_attr "neg_pool_range" "*,*,*,*,1004,*,*,1004,*,*")]) |
| 82 |
|
| 83 |
(define_insn "*neon_mov<mode>" |
| 84 |
[(set (match_operand:VQXMOV 0 "nonimmediate_operand" |
| 85 |
"=w,Un,w, w, w, ?r,?w,?r,?r, ?Us") |
| 86 |
(match_operand:VQXMOV 1 "general_operand" |
| 87 |
" w,w, Dm,DN,Uni, w, r, r, Usi, r"))] |
| 88 |
"TARGET_NEON |
| 89 |
&& (register_operand (operands[0], <MODE>mode) |
| 90 |
|| register_operand (operands[1], <MODE>mode))" |
| 91 |
{ |
| 92 |
if (which_alternative == 2 || which_alternative == 3) |
| 93 |
{ |
| 94 |
int width, is_valid; |
| 95 |
static char templ[40]; |
| 96 |
|
| 97 |
is_valid = simd_immediate_valid_for_move (operands[1], <MODE>mode, |
| 98 |
&operands[1], &width); |
| 99 |
|
| 100 |
gcc_assert (is_valid != 0); |
| 101 |
|
| 102 |
if (width == 0) |
| 103 |
return "vmov.f32\t%q0, %1 @ <mode>"; |
| 104 |
else |
| 105 |
sprintf (templ, "vmov.i%d\t%%q0, %%1 @ <mode>", width); |
| 106 |
|
| 107 |
return templ; |
| 108 |
} |
| 109 |
|
| 110 |
switch (which_alternative) |
| 111 |
{ |
| 112 |
case 0: return "vmov\t%q0, %q1 @ <mode>"; |
| 113 |
case 1: case 4: return output_move_neon (operands); |
| 114 |
case 2: case 3: gcc_unreachable (); |
| 115 |
case 5: return "vmov\t%Q0, %R0, %e1 @ <mode>\;vmov\t%J0, %K0, %f1"; |
| 116 |
case 6: return "vmov\t%e0, %Q1, %R1 @ <mode>\;vmov\t%f0, %J1, %K1"; |
| 117 |
default: return output_move_quad (operands); |
| 118 |
} |
| 119 |
} |
| 120 |
[(set_attr "type" "neon_move_q,neon_store2_2reg_q,neon_move_q,\ |
| 121 |
neon_move_q,neon_load2_2reg_q,neon_to_gp_q,\ |
| 122 |
neon_from_gp_q,mov_reg,neon_load1_4reg,neon_store1_4reg") |
| 123 |
(set_attr "length" "4,8,4,4,8,8,8,16,8,16") |
| 124 |
(set_attr "arm_pool_range" "*,*,*,*,1020,*,*,*,1020,*") |
| 125 |
(set_attr "thumb2_pool_range" "*,*,*,*,1018,*,*,*,1018,*") |
| 126 |
(set_attr "neg_pool_range" "*,*,*,*,996,*,*,*,996,*")]) |
| 127 |
|
| 128 |
/* We define these mov expanders to match the standard mov$a optab to prevent |
| 129 |
the mid-end from trying to do a subreg for these modes which is the most |
| 130 |
inefficient way to expand the move. Also big-endian subreg's aren't |
| 131 |
allowed for a subset of modes, See TARGET_CAN_CHANGE_MODE_CLASS. |
| 132 |
Without these RTL generation patterns the mid-end would attempt to take a |
| 133 |
sub-reg and may ICE if it can't. */ |
| 134 |
|
| 135 |
(define_expand "movti" |
| 136 |
[(set (match_operand:TI 0 "nonimmediate_operand") |
| 137 |
(match_operand:TI 1 "general_operand"))] |
| 138 |
"TARGET_NEON" |
| 139 |
{ |
| 140 |
gcc_checking_assert (aligned_operand (operands[0], TImode)); |
| 141 |
gcc_checking_assert (aligned_operand (operands[1], TImode)); |
| 142 |
if (can_create_pseudo_p ()) |
| 143 |
{ |
| 144 |
if (!REG_P (operands[0])) |
| 145 |
operands[1] = force_reg (TImode, operands[1]); |
| 146 |
} |
| 147 |
}) |
| 148 |
|
| 149 |
(define_expand "mov<mode>" |
| 150 |
[(set (match_operand:VSTRUCT 0 "nonimmediate_operand") |
| 151 |
(match_operand:VSTRUCT 1 "general_operand"))] |
| 152 |
"TARGET_NEON || TARGET_HAVE_MVE" |
| 153 |
{ |
| 154 |
gcc_checking_assert (aligned_operand (operands[0], <MODE>mode)); |
| 155 |
gcc_checking_assert (aligned_operand (operands[1], <MODE>mode)); |
| 156 |
if (can_create_pseudo_p ()) |
| 157 |
{ |
| 158 |
if (!REG_P (operands[0])) |
| 159 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 160 |
} |
| 161 |
}) |
| 162 |
|
| 163 |
;; The pattern mov<mode> where mode is v8hf, v4hf, v4bf and v8bf are split into |
| 164 |
;; two groups. The pattern movv8hf is common for MVE and NEON, so it is moved |
| 165 |
;; into vec-common.md file. Remaining mov expand patterns with half float and |
| 166 |
;; bfloats are implemented below. |
| 167 |
(define_expand "mov<mode>" |
| 168 |
[(set (match_operand:VHFBF_split 0 "s_register_operand") |
| 169 |
(match_operand:VHFBF_split 1 "s_register_operand"))] |
| 170 |
"TARGET_NEON" |
| 171 |
{ |
| 172 |
gcc_checking_assert (aligned_operand (operands[0], <MODE>mode)); |
| 173 |
gcc_checking_assert (aligned_operand (operands[1], <MODE>mode)); |
| 174 |
if (can_create_pseudo_p ()) |
| 175 |
{ |
| 176 |
if (!REG_P (operands[0])) |
| 177 |
operands[1] = force_reg (<MODE>mode, operands[1]); |
| 178 |
} |
| 179 |
}) |
| 180 |
|
| 181 |
(define_insn "*neon_mov<mode>" |
| 182 |
[(set (match_operand:VSTRUCT 0 "nonimmediate_operand" "=w,Ut,w") |
| 183 |
(match_operand:VSTRUCT 1 "general_operand" " w,w, Ut"))] |
| 184 |
"(TARGET_NEON || TARGET_HAVE_MVE) |
| 185 |
&& (register_operand (operands[0], <MODE>mode) |
| 186 |
|| register_operand (operands[1], <MODE>mode))" |
| 187 |
{ |
| 188 |
switch (which_alternative) |
| 189 |
{ |
| 190 |
case 0: return "#"; |
| 191 |
case 1: case 2: return output_move_neon (operands); |
| 192 |
default: gcc_unreachable (); |
| 193 |
} |
| 194 |
} |
| 195 |
[(set_attr "type" "neon_move_q,neon_store2_2reg_q,neon_load2_2reg_q") |
| 196 |
(set (attr "length") (symbol_ref "arm_attr_length_move_neon (insn)"))]) |
| 197 |
|
| 198 |
(define_split |
| 199 |
[(set (match_operand:EI 0 "s_register_operand" "") |
| 200 |
(match_operand:EI 1 "s_register_operand" ""))] |
| 201 |
"TARGET_NEON && reload_completed" |
| 202 |
[(set (match_dup 0) (match_dup 1)) |
| 203 |
(set (match_dup 2) (match_dup 3))] |
| 204 |
{ |
| 205 |
int rdest = REGNO (operands[0]); |
| 206 |
int rsrc = REGNO (operands[1]); |
| 207 |
rtx dest[2], src[2]; |
| 208 |
|
| 209 |
dest[0] = gen_rtx_REG (TImode, rdest); |
| 210 |
src[0] = gen_rtx_REG (TImode, rsrc); |
| 211 |
dest[1] = gen_rtx_REG (DImode, rdest + 4); |
| 212 |
src[1] = gen_rtx_REG (DImode, rsrc + 4); |
| 213 |
|
| 214 |
neon_disambiguate_copy (operands, dest, src, 2); |
| 215 |
}) |
| 216 |
|
| 217 |
(define_split |
| 218 |
[(set (match_operand:VSTRUCT2 0 "s_register_operand" "") |
| 219 |
(match_operand:VSTRUCT2 1 "s_register_operand" ""))] |
| 220 |
"(TARGET_NEON || TARGET_HAVE_MVE)&& reload_completed" |
| 221 |
[(set (match_dup 0) (match_dup 1)) |
| 222 |
(set (match_dup 2) (match_dup 3))] |
| 223 |
{ |
| 224 |
int rdest = REGNO (operands[0]); |
| 225 |
int rsrc = REGNO (operands[1]); |
| 226 |
rtx dest[2], src[2]; |
| 227 |
|
| 228 |
dest[0] = gen_rtx_REG (TImode, rdest); |
| 229 |
src[0] = gen_rtx_REG (TImode, rsrc); |
| 230 |
dest[1] = gen_rtx_REG (TImode, rdest + 4); |
| 231 |
src[1] = gen_rtx_REG (TImode, rsrc + 4); |
| 232 |
|
| 233 |
neon_disambiguate_copy (operands, dest, src, 2); |
| 234 |
}) |
| 235 |
|
| 236 |
(define_split |
| 237 |
[(set (match_operand:CI 0 "s_register_operand" "") |
| 238 |
(match_operand:CI 1 "s_register_operand" ""))] |
| 239 |
"TARGET_NEON && reload_completed" |
| 240 |
[(set (match_dup 0) (match_dup 1)) |
| 241 |
(set (match_dup 2) (match_dup 3)) |
| 242 |
(set (match_dup 4) (match_dup 5))] |
| 243 |
{ |
| 244 |
int rdest = REGNO (operands[0]); |
| 245 |
int rsrc = REGNO (operands[1]); |
| 246 |
rtx dest[3], src[3]; |
| 247 |
|
| 248 |
dest[0] = gen_rtx_REG (TImode, rdest); |
| 249 |
src[0] = gen_rtx_REG (TImode, rsrc); |
| 250 |
dest[1] = gen_rtx_REG (TImode, rdest + 4); |
| 251 |
src[1] = gen_rtx_REG (TImode, rsrc + 4); |
| 252 |
dest[2] = gen_rtx_REG (TImode, rdest + 8); |
| 253 |
src[2] = gen_rtx_REG (TImode, rsrc + 8); |
| 254 |
|
| 255 |
neon_disambiguate_copy (operands, dest, src, 3); |
| 256 |
}) |
| 257 |
|
| 258 |
(define_split |
| 259 |
[(set (match_operand:VSTRUCT4 0 "s_register_operand" "") |
| 260 |
(match_operand:VSTRUCT4 1 "s_register_operand" ""))] |
| 261 |
"(TARGET_NEON || TARGET_HAVE_MVE) && reload_completed" |
| 262 |
[(set (match_dup 0) (match_dup 1)) |
| 263 |
(set (match_dup 2) (match_dup 3)) |
| 264 |
(set (match_dup 4) (match_dup 5)) |
| 265 |
(set (match_dup 6) (match_dup 7))] |
| 266 |
{ |
| 267 |
int rdest = REGNO (operands[0]); |
| 268 |
int rsrc = REGNO (operands[1]); |
| 269 |
rtx dest[4], src[4]; |
| 270 |
|
| 271 |
dest[0] = gen_rtx_REG (TImode, rdest); |
| 272 |
src[0] = gen_rtx_REG (TImode, rsrc); |
| 273 |
dest[1] = gen_rtx_REG (TImode, rdest + 4); |
| 274 |
src[1] = gen_rtx_REG (TImode, rsrc + 4); |
| 275 |
dest[2] = gen_rtx_REG (TImode, rdest + 8); |
| 276 |
src[2] = gen_rtx_REG (TImode, rsrc + 8); |
| 277 |
dest[3] = gen_rtx_REG (TImode, rdest + 12); |
| 278 |
src[3] = gen_rtx_REG (TImode, rsrc + 12); |
| 279 |
|
| 280 |
neon_disambiguate_copy (operands, dest, src, 4); |
| 281 |
}) |
| 282 |
|
| 283 |
(define_insn "*movmisalign<mode>_neon_store" |
| 284 |
[(set (match_operand:VDX 0 "neon_permissive_struct_operand" "=Um") |
| 285 |
(unspec:VDX [(match_operand:VDX 1 "s_register_operand" " w")] |
| 286 |
UNSPEC_MISALIGNED_ACCESS))] |
| 287 |
"TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" |
| 288 |
"vst1.<V_sz_elem>\t{%P1}, %A0" |
| 289 |
[(set_attr "type" "neon_store1_1reg<q>")]) |
| 290 |
|
| 291 |
(define_insn "*movmisalign<mode>_neon_load" |
| 292 |
[(set (match_operand:VDX 0 "s_register_operand" "=w") |
| 293 |
(unspec:VDX [(match_operand:VDX 1 "neon_permissive_struct_operand" |
| 294 |
" Um")] |
| 295 |
UNSPEC_MISALIGNED_ACCESS))] |
| 296 |
"TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" |
| 297 |
"vld1.<V_sz_elem>\t{%P0}, %A1" |
| 298 |
[(set_attr "type" "neon_load1_1reg<q>")]) |
| 299 |
|
| 300 |
(define_insn "*movmisalign<mode>_neon_store" |
| 301 |
[(set (match_operand:VQX 0 "neon_permissive_struct_operand" "=Um") |
| 302 |
(unspec:VQX [(match_operand:VQX 1 "s_register_operand" " w")] |
| 303 |
UNSPEC_MISALIGNED_ACCESS))] |
| 304 |
"TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" |
| 305 |
"vst1.<V_sz_elem>\t{%q1}, %A0" |
| 306 |
[(set_attr "type" "neon_store1_1reg<q>")]) |
| 307 |
|
| 308 |
(define_insn "*movmisalign<mode>_neon_load" |
| 309 |
[(set (match_operand:VQX 0 "s_register_operand" "=w") |
| 310 |
(unspec:VQX [(match_operand:VQX 1 "neon_permissive_struct_operand" |
| 311 |
" Um")] |
| 312 |
UNSPEC_MISALIGNED_ACCESS))] |
| 313 |
"TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" |
| 314 |
"vld1.<V_sz_elem>\t{%q0}, %A1" |
| 315 |
[(set_attr "type" "neon_load1_1reg<q>")]) |
| 316 |
|
| 317 |
(define_insn "@vec_set<mode>_internal" |
| 318 |
[(set (match_operand:VD_LANE 0 "s_register_operand" "=w,w") |
| 319 |
(vec_merge:VD_LANE |
| 320 |
(vec_duplicate:VD_LANE |
| 321 |
(match_operand:<V_elem> 1 "nonimmediate_operand" "Um,r")) |
| 322 |
(match_operand:VD_LANE 3 "s_register_operand" "0,0") |
| 323 |
(match_operand:SI 2 "immediate_operand" "i,i")))] |
| 324 |
"TARGET_NEON" |
| 325 |
{ |
| 326 |
int elt = ffs ((int) INTVAL (operands[2])) - 1; |
| 327 |
if (BYTES_BIG_ENDIAN) |
| 328 |
elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt; |
| 329 |
operands[2] = GEN_INT (elt); |
| 330 |
|
| 331 |
if (which_alternative == 0) |
| 332 |
return "vld1.<V_sz_elem>\t{%P0[%c2]}, %A1"; |
| 333 |
else |
| 334 |
return "vmov.<V_sz_elem>\t%P0[%c2], %1"; |
| 335 |
} |
| 336 |
[(set_attr "type" "neon_load1_all_lanes<q>,neon_from_gp<q>")]) |
| 337 |
|
| 338 |
(define_insn "@vec_set<mode>_internal" |
| 339 |
[(set (match_operand:VQ2 0 "s_register_operand" "=w,w") |
| 340 |
(vec_merge:VQ2 |
| 341 |
(vec_duplicate:VQ2 |
| 342 |
(match_operand:<V_elem> 1 "nonimmediate_operand" "Um,r")) |
| 343 |
(match_operand:VQ2 3 "s_register_operand" "0,0") |
| 344 |
(match_operand:SI 2 "immediate_operand" "i,i")))] |
| 345 |
"TARGET_NEON" |
| 346 |
{ |
| 347 |
HOST_WIDE_INT elem = ffs ((int) INTVAL (operands[2])) - 1; |
| 348 |
int half_elts = GET_MODE_NUNITS (<MODE>mode) / 2; |
| 349 |
int elt = elem % half_elts; |
| 350 |
int hi = (elem / half_elts) * 2; |
| 351 |
int regno = REGNO (operands[0]); |
| 352 |
|
| 353 |
if (BYTES_BIG_ENDIAN) |
| 354 |
elt = half_elts - 1 - elt; |
| 355 |
|
| 356 |
operands[0] = gen_rtx_REG (<V_HALF>mode, regno + hi); |
| 357 |
operands[2] = GEN_INT (elt); |
| 358 |
|
| 359 |
if (which_alternative == 0) |
| 360 |
return "vld1.<V_sz_elem>\t{%P0[%c2]}, %A1"; |
| 361 |
else |
| 362 |
return "vmov.<V_sz_elem>\t%P0[%c2], %1"; |
| 363 |
} |
| 364 |
[(set_attr "type" "neon_load1_all_lanes<q>,neon_from_gp<q>")] |
| 365 |
) |
| 366 |
|
| 367 |
(define_insn "@vec_set<mode>_internal" |
| 368 |
[(set (match_operand:V2DI_ONLY 0 "s_register_operand" "=w,w") |
| 369 |
(vec_merge:V2DI_ONLY |
| 370 |
(vec_duplicate:V2DI_ONLY |
| 371 |
(match_operand:DI 1 "nonimmediate_operand" "Um,r")) |
| 372 |
(match_operand:V2DI_ONLY 3 "s_register_operand" "0,0") |
| 373 |
(match_operand:SI 2 "immediate_operand" "i,i")))] |
| 374 |
"TARGET_NEON" |
| 375 |
{ |
| 376 |
HOST_WIDE_INT elem = ffs ((int) INTVAL (operands[2])) - 1; |
| 377 |
int regno = REGNO (operands[0]) + 2 * elem; |
| 378 |
|
| 379 |
operands[0] = gen_rtx_REG (DImode, regno); |
| 380 |
|
| 381 |
if (which_alternative == 0) |
| 382 |
return "vld1.64\t%P0, %A1"; |
| 383 |
else |
| 384 |
return "vmov\t%P0, %Q1, %R1"; |
| 385 |
} |
| 386 |
[(set_attr "type" "neon_load1_all_lanes_q,neon_from_gp_q")] |
| 387 |
) |
| 388 |
|
| 389 |
(define_insn "vec_extract<mode><V_elem_l>" |
| 390 |
[(set (match_operand:<V_elem> 0 "nonimmediate_operand" "=Um,r") |
| 391 |
(vec_select:<V_elem> |
| 392 |
(match_operand:VD_LANE 1 "s_register_operand" "w,w") |
| 393 |
(parallel [(match_operand:SI 2 "immediate_operand" "i,i")])))] |
| 394 |
"TARGET_NEON" |
| 395 |
{ |
| 396 |
if (BYTES_BIG_ENDIAN) |
| 397 |
{ |
| 398 |
int elt = INTVAL (operands[2]); |
| 399 |
elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt; |
| 400 |
operands[2] = GEN_INT (elt); |
| 401 |
} |
| 402 |
|
| 403 |
if (which_alternative == 0) |
| 404 |
return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0"; |
| 405 |
else |
| 406 |
return "vmov.<V_uf_sclr>\t%0, %P1[%c2]"; |
| 407 |
} |
| 408 |
[(set_attr "type" "neon_store1_one_lane<q>,neon_to_gp<q>")] |
| 409 |
) |
| 410 |
|
| 411 |
;; Patterns comparing two vectors and conditionally jump. |
| 412 |
;; Avdanced SIMD lacks a vector != comparison, but this is a quite common |
| 413 |
;; operation. To not pay the penalty for inverting == we can map our any |
| 414 |
;; comparisons to all i.e. any(~x) => all(x). |
| 415 |
;; |
| 416 |
;; However unlike the AArch64 version, we can't optimize this further as the |
| 417 |
;; chain is too long for combine due to these being unspecs so it doesn't fold |
| 418 |
;; the operation to something simpler. |
| 419 |
(define_expand "cbranch<mode>4" |
| 420 |
[(set (pc) (if_then_else |
| 421 |
(match_operator 0 "expandable_comparison_operator" |
| 422 |
[(match_operand:VDQI 1 "register_operand") |
| 423 |
(match_operand:VDQI 2 "reg_or_zero_operand")]) |
| 424 |
(label_ref (match_operand 3 "" "")) |
| 425 |
(pc)))] |
| 426 |
"TARGET_NEON" |
| 427 |
{ |
| 428 |
rtx mask = operands[1]; |
| 429 |
|
| 430 |
/* If comparing against a non-zero vector we have to do a comparison first |
| 431 |
so we can have a != 0 comparison with the result. */ |
| 432 |
if (operands[2] != CONST0_RTX (<MODE>mode)) |
| 433 |
{ |
| 434 |
mask = gen_reg_rtx (<MODE>mode); |
| 435 |
emit_insn (gen_xor<mode>3 (mask, operands[1], operands[2])); |
| 436 |
} |
| 437 |
|
| 438 |
/* For 128-bit vectors we need an additional reductions. */ |
| 439 |
if (known_eq (128, GET_MODE_BITSIZE (<MODE>mode))) |
| 440 |
{ |
| 441 |
/* Always reduce using a V4SI. */ |
| 442 |
rtx op1 = lowpart_subreg (V4SImode, mask, <MODE>mode); |
| 443 |
mask = gen_reg_rtx (V2SImode); |
| 444 |
rtx low = gen_reg_rtx (V2SImode); |
| 445 |
rtx high = gen_reg_rtx (V2SImode); |
| 446 |
emit_insn (gen_neon_vget_lowv4si (low, op1)); |
| 447 |
emit_insn (gen_neon_vget_highv4si (high, op1)); |
| 448 |
emit_insn (gen_neon_vpumaxv2si (mask, low, high)); |
| 449 |
} |
| 450 |
|
| 451 |
rtx op1 = lowpart_subreg (V2SImode, mask, GET_MODE (mask)); |
| 452 |
emit_insn (gen_neon_vpumaxv2si (op1, op1, op1)); |
| 453 |
|
| 454 |
rtx val = gen_reg_rtx (SImode); |
| 455 |
emit_move_insn (val, gen_lowpart (SImode, mask)); |
| 456 |
emit_jump_insn (gen_cbranch_cc (operands[0], val, const0_rtx, operands[3])); |
| 457 |
DONE; |
| 458 |
}) |
| 459 |
|
| 460 |
;; This pattern is renamed from "vec_extract<mode><V_elem_l>" to |
| 461 |
;; "neon_vec_extract<mode><V_elem_l>" and this pattern is called |
| 462 |
;; by define_expand in vec-common.md file. |
| 463 |
(define_insn "neon_vec_extract<mode><V_elem_l>" |
| 464 |
[(set (match_operand:<V_elem> 0 "nonimmediate_operand" "=Um,r") |
| 465 |
(vec_select:<V_elem> |
| 466 |
(match_operand:VQ2 1 "s_register_operand" "w,w") |
| 467 |
(parallel [(match_operand:SI 2 "immediate_operand" "i,i")])))] |
| 468 |
"TARGET_NEON" |
| 469 |
{ |
| 470 |
int half_elts = GET_MODE_NUNITS (<MODE>mode) / 2; |
| 471 |
int elt = INTVAL (operands[2]) % half_elts; |
| 472 |
int hi = (INTVAL (operands[2]) / half_elts) * 2; |
| 473 |
int regno = REGNO (operands[1]); |
| 474 |
|
| 475 |
if (BYTES_BIG_ENDIAN) |
| 476 |
elt = half_elts - 1 - elt; |
| 477 |
|
| 478 |
operands[1] = gen_rtx_REG (<V_HALF>mode, regno + hi); |
| 479 |
operands[2] = GEN_INT (elt); |
| 480 |
|
| 481 |
if (which_alternative == 0) |
| 482 |
return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0"; |
| 483 |
else |
| 484 |
return "vmov.<V_uf_sclr>\t%0, %P1[%c2]"; |
| 485 |
} |
| 486 |
[(set_attr "type" "neon_store1_one_lane<q>,neon_to_gp<q>")] |
| 487 |
) |
| 488 |
|
| 489 |
;; This pattern is renamed from "vec_extractv2didi" to "neon_vec_extractv2didi" |
| 490 |
;; and this pattern is called by define_expand in vec-common.md file. |
| 491 |
(define_insn "neon_vec_extractv2didi" |
| 492 |
[(set (match_operand:DI 0 "nonimmediate_operand" "=Um,r") |
| 493 |
(vec_select:DI |
| 494 |
(match_operand:V2DI 1 "s_register_operand" "w,w") |
| 495 |
(parallel [(match_operand:SI 2 "immediate_operand" "i,i")])))] |
| 496 |
"TARGET_NEON" |
| 497 |
{ |
| 498 |
int regno = REGNO (operands[1]) + 2 * INTVAL (operands[2]); |
| 499 |
|
| 500 |
operands[1] = gen_rtx_REG (DImode, regno); |
| 501 |
|
| 502 |
if (which_alternative == 0) |
| 503 |
return "vst1.64\t{%P1}, %A0 @ v2di"; |
| 504 |
else |
| 505 |
return "vmov\t%Q0, %R0, %P1 @ v2di"; |
| 506 |
} |
| 507 |
[(set_attr "type" "neon_store1_one_lane_q,neon_to_gp_q")] |
| 508 |
) |
| 509 |
|
| 510 |
;; Doubleword and quadword arithmetic. |
| 511 |
|
| 512 |
;; NOTE: some other instructions also support 64-bit integer |
| 513 |
;; element size, which we could potentially use for "long long" operations. |
| 514 |
|
| 515 |
(define_insn "*add<mode>3_neon" |
| 516 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 517 |
(plus:VDQ (match_operand:VDQ 1 "s_register_operand" "w") |
| 518 |
(match_operand:VDQ 2 "s_register_operand" "w")))] |
| 519 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 520 |
"vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 521 |
[(set (attr "type") |
| 522 |
(if_then_else (match_test "<Is_float_mode>") |
| 523 |
(const_string "neon_fp_addsub_s<q>") |
| 524 |
(const_string "neon_add<q>")))] |
| 525 |
) |
| 526 |
|
| 527 |
(define_insn "*sub<mode>3_neon" |
| 528 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 529 |
(minus:VDQ (match_operand:VDQ 1 "s_register_operand" "w") |
| 530 |
(match_operand:VDQ 2 "s_register_operand" "w")))] |
| 531 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 532 |
"vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 533 |
[(set (attr "type") |
| 534 |
(if_then_else (match_test "<Is_float_mode>") |
| 535 |
(const_string "neon_fp_addsub_s<q>") |
| 536 |
(const_string "neon_sub<q>")))] |
| 537 |
) |
| 538 |
|
| 539 |
(define_insn "*mul<mode>3_neon" |
| 540 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 541 |
(mult:VDQW (match_operand:VDQW 1 "s_register_operand" "w") |
| 542 |
(match_operand:VDQW 2 "s_register_operand" "w")))] |
| 543 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 544 |
"vmul.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 545 |
[(set (attr "type") |
| 546 |
(if_then_else (match_test "<Is_float_mode>") |
| 547 |
(const_string "neon_fp_mul_s<q>") |
| 548 |
(const_string "neon_mul_<V_elem_ch><q>")))] |
| 549 |
) |
| 550 |
|
| 551 |
/* Perform division using multiply-by-reciprocal. |
| 552 |
Reciprocal is calculated using Newton-Raphson method. |
| 553 |
Enabled with -funsafe-math-optimizations -freciprocal-math |
| 554 |
and disabled for -Os since it increases code size . */ |
| 555 |
|
| 556 |
(define_expand "div<VCVTF:mode>3" |
| 557 |
[(set (match_operand:VCVTF 0 "s_register_operand") |
| 558 |
(div:VCVTF (match_operand:VCVTF 1 "s_register_operand") |
| 559 |
(match_operand:VCVTF 2 "s_register_operand")))] |
| 560 |
"ARM_HAVE_NEON_<MODE>_ARITH && !optimize_size |
| 561 |
&& flag_reciprocal_math" |
| 562 |
{ |
| 563 |
rtx rec = gen_reg_rtx (<MODE>mode); |
| 564 |
rtx vrecps_temp = gen_reg_rtx (<MODE>mode); |
| 565 |
|
| 566 |
/* Reciprocal estimate. */ |
| 567 |
emit_insn (gen_neon_vrecpe<mode> (rec, operands[2])); |
| 568 |
|
| 569 |
/* Perform 2 iterations of newton-raphson method. */ |
| 570 |
for (int i = 0; i < 2; i++) |
| 571 |
{ |
| 572 |
emit_insn (gen_neon_vrecps<mode> (vrecps_temp, rec, operands[2])); |
| 573 |
emit_insn (gen_mul<mode>3 (rec, rec, vrecps_temp)); |
| 574 |
} |
| 575 |
|
| 576 |
/* We now have reciprocal in rec, perform operands[0] = operands[1] * rec. */ |
| 577 |
emit_insn (gen_mul<mode>3 (operands[0], operands[1], rec)); |
| 578 |
DONE; |
| 579 |
} |
| 580 |
) |
| 581 |
|
| 582 |
|
| 583 |
(define_insn "mul<mode>3add<mode>_neon" |
| 584 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 585 |
(plus:VDQW (mult:VDQW (match_operand:VDQW 2 "s_register_operand" "w") |
| 586 |
(match_operand:VDQW 3 "s_register_operand" "w")) |
| 587 |
(match_operand:VDQW 1 "s_register_operand" "0")))] |
| 588 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 589 |
"vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 590 |
[(set (attr "type") |
| 591 |
(if_then_else (match_test "<Is_float_mode>") |
| 592 |
(const_string "neon_fp_mla_s<q>") |
| 593 |
(const_string "neon_mla_<V_elem_ch><q>")))] |
| 594 |
) |
| 595 |
|
| 596 |
(define_insn "mul<mode>3add<mode>_neon" |
| 597 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 598 |
(plus:VH (mult:VH (match_operand:VH 2 "s_register_operand" "w") |
| 599 |
(match_operand:VH 3 "s_register_operand" "w")) |
| 600 |
(match_operand:VH 1 "s_register_operand" "0")))] |
| 601 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 602 |
"vmla.f16\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 603 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 604 |
) |
| 605 |
|
| 606 |
(define_insn "mul<mode>3neg<mode>add<mode>_neon" |
| 607 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 608 |
(minus:VDQW (match_operand:VDQW 1 "s_register_operand" "0") |
| 609 |
(mult:VDQW (match_operand:VDQW 2 "s_register_operand" "w") |
| 610 |
(match_operand:VDQW 3 "s_register_operand" "w"))))] |
| 611 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 612 |
"vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 613 |
[(set (attr "type") |
| 614 |
(if_then_else (match_test "<Is_float_mode>") |
| 615 |
(const_string "neon_fp_mla_s<q>") |
| 616 |
(const_string "neon_mla_<V_elem_ch><q>")))] |
| 617 |
) |
| 618 |
|
| 619 |
;; Fused multiply-accumulate |
| 620 |
;; We define each insn twice here: |
| 621 |
;; 1: with flag_unsafe_math_optimizations for the widening multiply phase |
| 622 |
;; to be able to use when converting to FMA. |
| 623 |
;; 2: without flag_unsafe_math_optimizations for the intrinsics to use. |
| 624 |
(define_insn "fma<VCVTF:mode>4" |
| 625 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 626 |
(fma:VCVTF (match_operand:VCVTF 1 "register_operand" "w") |
| 627 |
(match_operand:VCVTF 2 "register_operand" "w") |
| 628 |
(match_operand:VCVTF 3 "register_operand" "0")))] |
| 629 |
"ARM_HAVE_NEON_<MODE>_ARITH && TARGET_FMA" |
| 630 |
"vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 631 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 632 |
) |
| 633 |
|
| 634 |
(define_insn "fma<VCVTF:mode>4_intrinsic" |
| 635 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 636 |
(fma:VCVTF (match_operand:VCVTF 1 "register_operand" "w") |
| 637 |
(match_operand:VCVTF 2 "register_operand" "w") |
| 638 |
(match_operand:VCVTF 3 "register_operand" "0")))] |
| 639 |
"TARGET_NEON && TARGET_FMA" |
| 640 |
"vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 641 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 642 |
) |
| 643 |
|
| 644 |
(define_insn "fma<VH:mode>4" |
| 645 |
[(set (match_operand:VH 0 "register_operand" "=w") |
| 646 |
(fma:VH |
| 647 |
(match_operand:VH 1 "register_operand" "w") |
| 648 |
(match_operand:VH 2 "register_operand" "w") |
| 649 |
(match_operand:VH 3 "register_operand" "0")))] |
| 650 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 651 |
"vfma.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 652 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 653 |
) |
| 654 |
|
| 655 |
(define_insn "*fmsub<VCVTF:mode>4" |
| 656 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 657 |
(fma:VCVTF (neg:VCVTF (match_operand:VCVTF 1 "register_operand" "w")) |
| 658 |
(match_operand:VCVTF 2 "register_operand" "w") |
| 659 |
(match_operand:VCVTF 3 "register_operand" "0")))] |
| 660 |
"ARM_HAVE_NEON_<MODE>_ARITH && TARGET_FMA" |
| 661 |
"vfms.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 662 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 663 |
) |
| 664 |
|
| 665 |
(define_insn "fmsub<VCVTF:mode>4_intrinsic" |
| 666 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 667 |
(fma:VCVTF |
| 668 |
(neg:VCVTF (match_operand:VCVTF 1 "register_operand" "w")) |
| 669 |
(match_operand:VCVTF 2 "register_operand" "w") |
| 670 |
(match_operand:VCVTF 3 "register_operand" "0")))] |
| 671 |
"TARGET_NEON && TARGET_FMA" |
| 672 |
"vfms.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 673 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 674 |
) |
| 675 |
|
| 676 |
(define_insn "fmsub<VH:mode>4_intrinsic" |
| 677 |
[(set (match_operand:VH 0 "register_operand" "=w") |
| 678 |
(fma:VH |
| 679 |
(neg:VH (match_operand:VH 1 "register_operand" "w")) |
| 680 |
(match_operand:VH 2 "register_operand" "w") |
| 681 |
(match_operand:VH 3 "register_operand" "0")))] |
| 682 |
"TARGET_NEON_FP16INST" |
| 683 |
"vfms.<V_if_elem>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 684 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 685 |
) |
| 686 |
|
| 687 |
(define_expand "<NEON_VRINT:nvrint_pattern><VCVTF:mode>2" |
| 688 |
[(set (match_operand:VCVTF 0 "s_register_operand") |
| 689 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand")] |
| 690 |
NEON_VRINT))] |
| 691 |
"TARGET_NEON && TARGET_VFP5 && flag_unsafe_math_optimizations" |
| 692 |
) |
| 693 |
|
| 694 |
(define_insn "neon_vrint<NEON_VRINT:nvrint_variant><VCVTF:mode>" |
| 695 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 696 |
(unspec:VCVTF [(match_operand:VCVTF 1 |
| 697 |
"s_register_operand" "w")] |
| 698 |
NEON_VRINT))] |
| 699 |
"TARGET_NEON && TARGET_VFP5" |
| 700 |
"vrint<nvrint_variant>.f32\\t%<V_reg>0, %<V_reg>1" |
| 701 |
[(set_attr "type" "neon_fp_round_<V_elem_ch><q>")] |
| 702 |
) |
| 703 |
|
| 704 |
(define_expand "l<NEON_VCVT:nvrint_pattern><su_optab><VCVTF:mode><v_cmp_result>2" |
| 705 |
[(set (match_operand:<V_cmp_result> 0 "register_operand") |
| 706 |
(FIXUORS:<V_cmp_result> |
| 707 |
(unspec:VCVTF [(match_operand:VCVTF 1 "register_operand")] |
| 708 |
NEON_VCVT)))] |
| 709 |
"TARGET_NEON && TARGET_VFP5 && flag_unsafe_math_optimizations" |
| 710 |
) |
| 711 |
|
| 712 |
(define_insn "neon_vcvt<NEON_VCVT:nvrint_variant><su_optab><VCVTF:mode><v_cmp_result>" |
| 713 |
[(set (match_operand:<V_cmp_result> 0 "register_operand" "=w") |
| 714 |
(FIXUORS:<V_cmp_result> (unspec:VCVTF |
| 715 |
[(match_operand:VCVTF 1 "register_operand" "w")] |
| 716 |
NEON_VCVT)))] |
| 717 |
"TARGET_NEON && TARGET_VFP5" |
| 718 |
"vcvt<nvrint_variant>.<su>32.f32\\t%<V_reg>0, %<V_reg>1" |
| 719 |
[(set_attr "type" "neon_fp_to_int_<V_elem_ch><q>") |
| 720 |
(set_attr "predicable" "no")] |
| 721 |
) |
| 722 |
|
| 723 |
(define_insn "ior<mode>3_neon" |
| 724 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w,w") |
| 725 |
(ior:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0") |
| 726 |
(match_operand:VDQ 2 "neon_logic_op2" "w,Dl")))] |
| 727 |
"TARGET_NEON" |
| 728 |
{ |
| 729 |
switch (which_alternative) |
| 730 |
{ |
| 731 |
case 0: return "vorr\t%<V_reg>0, %<V_reg>1, %<V_reg>2"; |
| 732 |
case 1: return neon_output_logic_immediate ("vorr", &operands[2], |
| 733 |
<MODE>mode, 0, VALID_NEON_QREG_MODE (<MODE>mode)); |
| 734 |
default: gcc_unreachable (); |
| 735 |
} |
| 736 |
} |
| 737 |
[(set_attr "type" "neon_logic<q>")] |
| 738 |
) |
| 739 |
|
| 740 |
;; The concrete forms of the Neon immediate-logic instructions are vbic and |
| 741 |
;; vorr. We support the pseudo-instruction vand instead, because that |
| 742 |
;; corresponds to the canonical form the middle-end expects to use for |
| 743 |
;; immediate bitwise-ANDs. |
| 744 |
|
| 745 |
(define_insn "and<mode>3_neon" |
| 746 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w,w") |
| 747 |
(and:VDQ (match_operand:VDQ 1 "s_register_operand" "w,0") |
| 748 |
(match_operand:VDQ 2 "neon_inv_logic_op2" "w,DL")))] |
| 749 |
"TARGET_NEON" |
| 750 |
{ |
| 751 |
switch (which_alternative) |
| 752 |
{ |
| 753 |
case 0: return "vand\t%<V_reg>0, %<V_reg>1, %<V_reg>2"; |
| 754 |
case 1: return neon_output_logic_immediate ("vand", &operands[2], |
| 755 |
<MODE>mode, 1, VALID_NEON_QREG_MODE (<MODE>mode)); |
| 756 |
default: gcc_unreachable (); |
| 757 |
} |
| 758 |
} |
| 759 |
[(set_attr "type" "neon_logic<q>")] |
| 760 |
) |
| 761 |
|
| 762 |
(define_insn "orn<mode>3_neon" |
| 763 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 764 |
(ior:VDQ (not:VDQ (match_operand:VDQ 2 "s_register_operand" "w")) |
| 765 |
(match_operand:VDQ 1 "s_register_operand" "w")))] |
| 766 |
"TARGET_NEON" |
| 767 |
"vorn\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 768 |
[(set_attr "type" "neon_logic<q>")] |
| 769 |
) |
| 770 |
|
| 771 |
(define_insn "bic<mode>3_neon" |
| 772 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 773 |
(and:VDQ (not:VDQ (match_operand:VDQ 2 "s_register_operand" "w")) |
| 774 |
(match_operand:VDQ 1 "s_register_operand" "w")))] |
| 775 |
"TARGET_NEON" |
| 776 |
"vbic\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 777 |
[(set_attr "type" "neon_logic<q>")] |
| 778 |
) |
| 779 |
|
| 780 |
(define_insn "xor<mode>3_neon" |
| 781 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 782 |
(xor:VDQ (match_operand:VDQ 1 "s_register_operand" "w") |
| 783 |
(match_operand:VDQ 2 "s_register_operand" "w")))] |
| 784 |
"TARGET_NEON" |
| 785 |
"veor\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 786 |
[(set_attr "type" "neon_logic<q>")] |
| 787 |
) |
| 788 |
|
| 789 |
(define_insn "one_cmpl<mode>2_neon" |
| 790 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 791 |
(not:VDQ (match_operand:VDQ 1 "s_register_operand" "w")))] |
| 792 |
"TARGET_NEON" |
| 793 |
"vmvn\t%<V_reg>0, %<V_reg>1" |
| 794 |
[(set_attr "type" "neon_move<q>")] |
| 795 |
) |
| 796 |
|
| 797 |
(define_insn "neon_abs<mode>2" |
| 798 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 799 |
(abs:VDQW (match_operand:VDQW 1 "s_register_operand" "w")))] |
| 800 |
"TARGET_NEON" |
| 801 |
"vabs.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 802 |
[(set (attr "type") |
| 803 |
(if_then_else (match_test "<Is_float_mode>") |
| 804 |
(const_string "neon_fp_abs_s<q>") |
| 805 |
(const_string "neon_abs<q>")))] |
| 806 |
) |
| 807 |
|
| 808 |
(define_insn "neon_neg<mode>2" |
| 809 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 810 |
(neg:VDQW (match_operand:VDQW 1 "s_register_operand" "w")))] |
| 811 |
"TARGET_NEON" |
| 812 |
"vneg.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 813 |
[(set (attr "type") |
| 814 |
(if_then_else (match_test "<Is_float_mode>") |
| 815 |
(const_string "neon_fp_neg_s<q>") |
| 816 |
(const_string "neon_neg<q>")))] |
| 817 |
) |
| 818 |
|
| 819 |
(define_insn "neon_<absneg_str><mode>2" |
| 820 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 821 |
(ABSNEG:VH (match_operand:VH 1 "s_register_operand" "w")))] |
| 822 |
"TARGET_NEON_FP16INST" |
| 823 |
"v<absneg_str>.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 824 |
[(set_attr "type" "neon_abs<q>")] |
| 825 |
) |
| 826 |
|
| 827 |
(define_expand "neon_v<absneg_str><mode>" |
| 828 |
[(set |
| 829 |
(match_operand:VH 0 "s_register_operand") |
| 830 |
(ABSNEG:VH (match_operand:VH 1 "s_register_operand")))] |
| 831 |
"TARGET_NEON_FP16INST" |
| 832 |
{ |
| 833 |
emit_insn (gen_neon_<absneg_str><mode>2 (operands[0], operands[1])); |
| 834 |
DONE; |
| 835 |
}) |
| 836 |
|
| 837 |
(define_insn "neon_v<fp16_rnd_str><mode>" |
| 838 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 839 |
(unspec:VH |
| 840 |
[(match_operand:VH 1 "s_register_operand" "w")] |
| 841 |
FP16_RND))] |
| 842 |
"TARGET_NEON_FP16INST" |
| 843 |
"<fp16_rnd_insn>.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 844 |
[(set_attr "type" "neon_fp_round_s<q>")] |
| 845 |
) |
| 846 |
|
| 847 |
(define_insn "neon_vrsqrte<mode>" |
| 848 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 849 |
(unspec:VH |
| 850 |
[(match_operand:VH 1 "s_register_operand" "w")] |
| 851 |
UNSPEC_VRSQRTE))] |
| 852 |
"TARGET_NEON_FP16INST" |
| 853 |
"vrsqrte.f16\t%<V_reg>0, %<V_reg>1" |
| 854 |
[(set_attr "type" "neon_fp_rsqrte_s<q>")] |
| 855 |
) |
| 856 |
|
| 857 |
(define_insn "*umin<mode>3_neon" |
| 858 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 859 |
(umin:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
| 860 |
(match_operand:VDQIW 2 "s_register_operand" "w")))] |
| 861 |
"TARGET_NEON" |
| 862 |
"vmin.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 863 |
[(set_attr "type" "neon_minmax<q>")] |
| 864 |
) |
| 865 |
|
| 866 |
(define_insn "*umax<mode>3_neon" |
| 867 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 868 |
(umax:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
| 869 |
(match_operand:VDQIW 2 "s_register_operand" "w")))] |
| 870 |
"TARGET_NEON" |
| 871 |
"vmax.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 872 |
[(set_attr "type" "neon_minmax<q>")] |
| 873 |
) |
| 874 |
|
| 875 |
(define_insn "*smin<VDQWH:mode>3_neon" |
| 876 |
[(set (match_operand:VDQWH 0 "s_register_operand" "=w") |
| 877 |
(smin:VDQWH (match_operand:VDQWH 1 "s_register_operand" "w") |
| 878 |
(match_operand:VDQWH 2 "s_register_operand" "w")))] |
| 879 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 880 |
"vmin.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 881 |
[(set (attr "type") |
| 882 |
(if_then_else (match_test "<Is_float_mode>") |
| 883 |
(const_string "neon_fp_minmax_s<q>") |
| 884 |
(const_string "neon_minmax<q>")))] |
| 885 |
) |
| 886 |
|
| 887 |
(define_insn "*smax<VDQWH:mode>3_neon" |
| 888 |
[(set (match_operand:VDQWH 0 "s_register_operand" "=w") |
| 889 |
(smax:VDQWH (match_operand:VDQWH 1 "s_register_operand" "w") |
| 890 |
(match_operand:VDQWH 2 "s_register_operand" "w")))] |
| 891 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 892 |
"vmax.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 893 |
[(set (attr "type") |
| 894 |
(if_then_else (match_test "<Is_float_mode>") |
| 895 |
(const_string "neon_fp_minmax_s<q>") |
| 896 |
(const_string "neon_minmax<q>")))] |
| 897 |
) |
| 898 |
|
| 899 |
; TODO: V2DI shifts are current disabled because there are bugs in the |
| 900 |
; generic vectorizer code. It ends up creating a V2DI constructor with |
| 901 |
; SImode elements. |
| 902 |
|
| 903 |
(define_insn "vashr<mode>3_imm" |
| 904 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 905 |
(ashiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
| 906 |
(match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dm")))] |
| 907 |
"TARGET_NEON" |
| 908 |
{ |
| 909 |
return neon_output_shift_immediate ("vshr", 's', &operands[2], |
| 910 |
<MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode), |
| 911 |
false); |
| 912 |
} |
| 913 |
[(set_attr "type" "neon_shift_imm<q>")] |
| 914 |
) |
| 915 |
|
| 916 |
(define_insn "vlshr<mode>3_imm" |
| 917 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 918 |
(lshiftrt:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
| 919 |
(match_operand:VDQIW 2 "imm_for_neon_rshift_operand" "Dm")))] |
| 920 |
"TARGET_NEON" |
| 921 |
{ |
| 922 |
return neon_output_shift_immediate ("vshr", 'u', &operands[2], |
| 923 |
<MODE>mode, VALID_NEON_QREG_MODE (<MODE>mode), |
| 924 |
false); |
| 925 |
} |
| 926 |
[(set_attr "type" "neon_shift_imm<q>")] |
| 927 |
) |
| 928 |
|
| 929 |
; Used for implementing logical shift-right, which is a left-shift by a negative |
| 930 |
; amount, with signed operands. This is essentially the same as ashl<mode>3 |
| 931 |
; above, but using an unspec in case GCC tries anything tricky with negative |
| 932 |
; shift amounts. |
| 933 |
|
| 934 |
(define_insn "ashl<mode>3_signed" |
| 935 |
[(set (match_operand:VDQI 0 "s_register_operand" "=w") |
| 936 |
(unspec:VDQI [(match_operand:VDQI 1 "s_register_operand" "w") |
| 937 |
(match_operand:VDQI 2 "s_register_operand" "w")] |
| 938 |
UNSPEC_ASHIFT_SIGNED))] |
| 939 |
"TARGET_NEON" |
| 940 |
"vshl.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 941 |
[(set_attr "type" "neon_shift_reg<q>")] |
| 942 |
) |
| 943 |
|
| 944 |
; Used for implementing logical shift-right, which is a left-shift by a negative |
| 945 |
; amount, with unsigned operands. |
| 946 |
|
| 947 |
(define_insn "ashl<mode>3_unsigned" |
| 948 |
[(set (match_operand:VDQI 0 "s_register_operand" "=w") |
| 949 |
(unspec:VDQI [(match_operand:VDQI 1 "s_register_operand" "w") |
| 950 |
(match_operand:VDQI 2 "s_register_operand" "w")] |
| 951 |
UNSPEC_ASHIFT_UNSIGNED))] |
| 952 |
"TARGET_NEON" |
| 953 |
"vshl.<V_u_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 954 |
[(set_attr "type" "neon_shift_reg<q>")] |
| 955 |
) |
| 956 |
|
| 957 |
;; 64-bit shifts |
| 958 |
|
| 959 |
;; This pattern loads a 32-bit shift count into a 64-bit NEON register, |
| 960 |
;; leaving the upper half uninitalized. This is OK since the shift |
| 961 |
;; instruction only looks at the low 8 bits anyway. To avoid confusing |
| 962 |
;; data flow analysis however, we pretend the full register is set |
| 963 |
;; using an unspec. |
| 964 |
(define_insn "neon_load_count" |
| 965 |
[(set (match_operand:DI 0 "s_register_operand" "=w,w") |
| 966 |
(unspec:DI [(match_operand:SI 1 "nonimmediate_operand" "Um,r")] |
| 967 |
UNSPEC_LOAD_COUNT))] |
| 968 |
"TARGET_NEON" |
| 969 |
"@ |
| 970 |
vld1.32\t{%P0[0]}, %A1 |
| 971 |
vmov.32\t%P0[0], %1" |
| 972 |
[(set_attr "type" "neon_load1_1reg,neon_from_gp")] |
| 973 |
) |
| 974 |
|
| 975 |
;; Widening operations |
| 976 |
|
| 977 |
(define_expand "widen_ssum<mode>3" |
| 978 |
[(set (match_operand:<V_double_width> 0 "s_register_operand") |
| 979 |
(plus:<V_double_width> |
| 980 |
(sign_extend:<V_double_width> |
| 981 |
(match_operand:VQI 1 "s_register_operand")) |
| 982 |
(match_operand:<V_double_width> 2 "s_register_operand")))] |
| 983 |
"TARGET_NEON" |
| 984 |
{ |
| 985 |
machine_mode mode = GET_MODE (operands[1]); |
| 986 |
rtx p1, p2; |
| 987 |
|
| 988 |
p1 = arm_simd_vect_par_cnst_half (mode, false); |
| 989 |
p2 = arm_simd_vect_par_cnst_half (mode, true); |
| 990 |
|
| 991 |
if (operands[0] != operands[2]) |
| 992 |
emit_move_insn (operands[0], operands[2]); |
| 993 |
|
| 994 |
emit_insn (gen_vec_sel_widen_ssum_lo<mode><V_half>3 (operands[0], |
| 995 |
operands[1], |
| 996 |
p1, |
| 997 |
operands[0])); |
| 998 |
emit_insn (gen_vec_sel_widen_ssum_hi<mode><V_half>3 (operands[0], |
| 999 |
operands[1], |
| 1000 |
p2, |
| 1001 |
operands[0])); |
| 1002 |
DONE; |
| 1003 |
} |
| 1004 |
) |
| 1005 |
|
| 1006 |
(define_insn "vec_sel_widen_ssum_lo<mode><V_half>3" |
| 1007 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 1008 |
(plus:<V_double_width> |
| 1009 |
(sign_extend:<V_double_width> |
| 1010 |
(vec_select:<V_HALF> |
| 1011 |
(match_operand:VQI 1 "s_register_operand" "%w") |
| 1012 |
(match_operand:VQI 2 "vect_par_constant_low" ""))) |
| 1013 |
(match_operand:<V_double_width> 3 "s_register_operand" "0")))] |
| 1014 |
"TARGET_NEON" |
| 1015 |
{ |
| 1016 |
return BYTES_BIG_ENDIAN ? "vaddw.<V_s_elem>\t%q0, %q3, %f1" : |
| 1017 |
"vaddw.<V_s_elem>\t%q0, %q3, %e1"; |
| 1018 |
} |
| 1019 |
[(set_attr "type" "neon_add_widen")]) |
| 1020 |
|
| 1021 |
(define_insn "vec_sel_widen_ssum_hi<mode><V_half>3" |
| 1022 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 1023 |
(plus:<V_double_width> |
| 1024 |
(sign_extend:<V_double_width> |
| 1025 |
(vec_select:<V_HALF> |
| 1026 |
(match_operand:VQI 1 "s_register_operand" "%w") |
| 1027 |
(match_operand:VQI 2 "vect_par_constant_high" ""))) |
| 1028 |
(match_operand:<V_double_width> 3 "s_register_operand" "0")))] |
| 1029 |
"TARGET_NEON" |
| 1030 |
{ |
| 1031 |
return BYTES_BIG_ENDIAN ? "vaddw.<V_s_elem>\t%q0, %q3, %e1" : |
| 1032 |
"vaddw.<V_s_elem>\t%q0, %q3, %f1"; |
| 1033 |
} |
| 1034 |
[(set_attr "type" "neon_add_widen")]) |
| 1035 |
|
| 1036 |
(define_insn "widen_ssum<mode>3" |
| 1037 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 1038 |
(plus:<V_widen> |
| 1039 |
(sign_extend:<V_widen> |
| 1040 |
(match_operand:VW 1 "s_register_operand" "%w")) |
| 1041 |
(match_operand:<V_widen> 2 "s_register_operand" "w")))] |
| 1042 |
"TARGET_NEON" |
| 1043 |
"vaddw.<V_s_elem>\t%q0, %q2, %P1" |
| 1044 |
[(set_attr "type" "neon_add_widen")] |
| 1045 |
) |
| 1046 |
|
| 1047 |
(define_expand "widen_usum<mode>3" |
| 1048 |
[(set (match_operand:<V_double_width> 0 "s_register_operand") |
| 1049 |
(plus:<V_double_width> |
| 1050 |
(zero_extend:<V_double_width> |
| 1051 |
(match_operand:VQI 1 "s_register_operand")) |
| 1052 |
(match_operand:<V_double_width> 2 "s_register_operand")))] |
| 1053 |
"TARGET_NEON" |
| 1054 |
{ |
| 1055 |
machine_mode mode = GET_MODE (operands[1]); |
| 1056 |
rtx p1, p2; |
| 1057 |
|
| 1058 |
p1 = arm_simd_vect_par_cnst_half (mode, false); |
| 1059 |
p2 = arm_simd_vect_par_cnst_half (mode, true); |
| 1060 |
|
| 1061 |
if (operands[0] != operands[2]) |
| 1062 |
emit_move_insn (operands[0], operands[2]); |
| 1063 |
|
| 1064 |
emit_insn (gen_vec_sel_widen_usum_lo<mode><V_half>3 (operands[0], |
| 1065 |
operands[1], |
| 1066 |
p1, |
| 1067 |
operands[0])); |
| 1068 |
emit_insn (gen_vec_sel_widen_usum_hi<mode><V_half>3 (operands[0], |
| 1069 |
operands[1], |
| 1070 |
p2, |
| 1071 |
operands[0])); |
| 1072 |
DONE; |
| 1073 |
} |
| 1074 |
) |
| 1075 |
|
| 1076 |
(define_insn "vec_sel_widen_usum_lo<mode><V_half>3" |
| 1077 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 1078 |
(plus:<V_double_width> |
| 1079 |
(zero_extend:<V_double_width> |
| 1080 |
(vec_select:<V_HALF> |
| 1081 |
(match_operand:VQI 1 "s_register_operand" "%w") |
| 1082 |
(match_operand:VQI 2 "vect_par_constant_low" ""))) |
| 1083 |
(match_operand:<V_double_width> 3 "s_register_operand" "0")))] |
| 1084 |
"TARGET_NEON" |
| 1085 |
{ |
| 1086 |
return BYTES_BIG_ENDIAN ? "vaddw.<V_u_elem>\t%q0, %q3, %f1" : |
| 1087 |
"vaddw.<V_u_elem>\t%q0, %q3, %e1"; |
| 1088 |
} |
| 1089 |
[(set_attr "type" "neon_add_widen")]) |
| 1090 |
|
| 1091 |
(define_insn "vec_sel_widen_usum_hi<mode><V_half>3" |
| 1092 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 1093 |
(plus:<V_double_width> |
| 1094 |
(zero_extend:<V_double_width> |
| 1095 |
(vec_select:<V_HALF> |
| 1096 |
(match_operand:VQI 1 "s_register_operand" "%w") |
| 1097 |
(match_operand:VQI 2 "vect_par_constant_high" ""))) |
| 1098 |
(match_operand:<V_double_width> 3 "s_register_operand" "0")))] |
| 1099 |
"TARGET_NEON" |
| 1100 |
{ |
| 1101 |
return BYTES_BIG_ENDIAN ? "vaddw.<V_u_elem>\t%q0, %q3, %e1" : |
| 1102 |
"vaddw.<V_u_elem>\t%q0, %q3, %f1"; |
| 1103 |
} |
| 1104 |
[(set_attr "type" "neon_add_widen")]) |
| 1105 |
|
| 1106 |
(define_insn "widen_usum<mode>3" |
| 1107 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 1108 |
(plus:<V_widen> (zero_extend:<V_widen> |
| 1109 |
(match_operand:VW 1 "s_register_operand" "%w")) |
| 1110 |
(match_operand:<V_widen> 2 "s_register_operand" "w")))] |
| 1111 |
"TARGET_NEON" |
| 1112 |
"vaddw.<V_u_elem>\t%q0, %q2, %P1" |
| 1113 |
[(set_attr "type" "neon_add_widen")] |
| 1114 |
) |
| 1115 |
|
| 1116 |
;; Helpers for quad-word reduction operations |
| 1117 |
|
| 1118 |
; Add (or smin, smax...) the low N/2 elements of the N-element vector |
| 1119 |
; operand[1] to the high N/2 elements of same. Put the result in operand[0], an |
| 1120 |
; N/2-element vector. |
| 1121 |
|
| 1122 |
(define_insn "quad_halves_<code>v4si" |
| 1123 |
[(set (match_operand:V2SI 0 "s_register_operand" "=w") |
| 1124 |
(VQH_OPS:V2SI |
| 1125 |
(vec_select:V2SI (match_operand:V4SI 1 "s_register_operand" "w") |
| 1126 |
(parallel [(const_int 0) (const_int 1)])) |
| 1127 |
(vec_select:V2SI (match_dup 1) |
| 1128 |
(parallel [(const_int 2) (const_int 3)]))))] |
| 1129 |
"TARGET_NEON" |
| 1130 |
"<VQH_mnem>.<VQH_sign>32\t%P0, %e1, %f1" |
| 1131 |
[(set_attr "vqh_mnem" "<VQH_mnem>") |
| 1132 |
(set_attr "type" "neon_reduc_<VQH_type>_q")] |
| 1133 |
) |
| 1134 |
|
| 1135 |
(define_insn "quad_halves_<code>v4sf" |
| 1136 |
[(set (match_operand:V2SF 0 "s_register_operand" "=w") |
| 1137 |
(VQHS_OPS:V2SF |
| 1138 |
(vec_select:V2SF (match_operand:V4SF 1 "s_register_operand" "w") |
| 1139 |
(parallel [(const_int 0) (const_int 1)])) |
| 1140 |
(vec_select:V2SF (match_dup 1) |
| 1141 |
(parallel [(const_int 2) (const_int 3)]))))] |
| 1142 |
"ARM_HAVE_NEON_V4SF_ARITH" |
| 1143 |
"<VQH_mnem>.f32\t%P0, %e1, %f1" |
| 1144 |
[(set_attr "vqh_mnem" "<VQH_mnem>") |
| 1145 |
(set_attr "type" "neon_fp_reduc_<VQH_type>_s_q")] |
| 1146 |
) |
| 1147 |
|
| 1148 |
(define_insn "quad_halves_<code>v8hi" |
| 1149 |
[(set (match_operand:V4HI 0 "s_register_operand" "+w") |
| 1150 |
(VQH_OPS:V4HI |
| 1151 |
(vec_select:V4HI (match_operand:V8HI 1 "s_register_operand" "w") |
| 1152 |
(parallel [(const_int 0) (const_int 1) |
| 1153 |
(const_int 2) (const_int 3)])) |
| 1154 |
(vec_select:V4HI (match_dup 1) |
| 1155 |
(parallel [(const_int 4) (const_int 5) |
| 1156 |
(const_int 6) (const_int 7)]))))] |
| 1157 |
"TARGET_NEON" |
| 1158 |
"<VQH_mnem>.<VQH_sign>16\t%P0, %e1, %f1" |
| 1159 |
[(set_attr "vqh_mnem" "<VQH_mnem>") |
| 1160 |
(set_attr "type" "neon_reduc_<VQH_type>_q")] |
| 1161 |
) |
| 1162 |
|
| 1163 |
(define_insn "quad_halves_<code>v16qi" |
| 1164 |
[(set (match_operand:V8QI 0 "s_register_operand" "+w") |
| 1165 |
(VQH_OPS:V8QI |
| 1166 |
(vec_select:V8QI (match_operand:V16QI 1 "s_register_operand" "w") |
| 1167 |
(parallel [(const_int 0) (const_int 1) |
| 1168 |
(const_int 2) (const_int 3) |
| 1169 |
(const_int 4) (const_int 5) |
| 1170 |
(const_int 6) (const_int 7)])) |
| 1171 |
(vec_select:V8QI (match_dup 1) |
| 1172 |
(parallel [(const_int 8) (const_int 9) |
| 1173 |
(const_int 10) (const_int 11) |
| 1174 |
(const_int 12) (const_int 13) |
| 1175 |
(const_int 14) (const_int 15)]))))] |
| 1176 |
"TARGET_NEON" |
| 1177 |
"<VQH_mnem>.<VQH_sign>8\t%P0, %e1, %f1" |
| 1178 |
[(set_attr "vqh_mnem" "<VQH_mnem>") |
| 1179 |
(set_attr "type" "neon_reduc_<VQH_type>_q")] |
| 1180 |
) |
| 1181 |
|
| 1182 |
(define_expand "move_hi_quad_<mode>" |
| 1183 |
[(match_operand:ANY128 0 "s_register_operand") |
| 1184 |
(match_operand:<V_HALF> 1 "s_register_operand")] |
| 1185 |
"TARGET_NEON" |
| 1186 |
{ |
| 1187 |
emit_move_insn (simplify_gen_subreg (<V_HALF>mode, operands[0], <MODE>mode, |
| 1188 |
GET_MODE_SIZE (<V_HALF>mode)), |
| 1189 |
operands[1]); |
| 1190 |
DONE; |
| 1191 |
}) |
| 1192 |
|
| 1193 |
(define_expand "move_lo_quad_<mode>" |
| 1194 |
[(match_operand:ANY128 0 "s_register_operand") |
| 1195 |
(match_operand:<V_HALF> 1 "s_register_operand")] |
| 1196 |
"TARGET_NEON" |
| 1197 |
{ |
| 1198 |
emit_move_insn (simplify_gen_subreg (<V_HALF>mode, operands[0], |
| 1199 |
<MODE>mode, 0), |
| 1200 |
operands[1]); |
| 1201 |
DONE; |
| 1202 |
}) |
| 1203 |
|
| 1204 |
;; Reduction operations |
| 1205 |
|
| 1206 |
(define_expand "reduc_plus_scal_<mode>" |
| 1207 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1208 |
(match_operand:VD 1 "s_register_operand")] |
| 1209 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 1210 |
{ |
| 1211 |
rtx vec = gen_reg_rtx (<MODE>mode); |
| 1212 |
neon_pairwise_reduce (vec, operands[1], <MODE>mode, |
| 1213 |
&gen_neon_vpadd_internal<mode>); |
| 1214 |
/* The same result is actually computed into every element. */ |
| 1215 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], vec, const0_rtx)); |
| 1216 |
DONE; |
| 1217 |
}) |
| 1218 |
|
| 1219 |
(define_expand "reduc_plus_scal_v2di" |
| 1220 |
[(match_operand:DI 0 "nonimmediate_operand") |
| 1221 |
(match_operand:V2DI 1 "s_register_operand")] |
| 1222 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 1223 |
{ |
| 1224 |
rtx vec = gen_reg_rtx (V2DImode); |
| 1225 |
|
| 1226 |
emit_insn (gen_arm_reduc_plus_internal_v2di (vec, operands[1])); |
| 1227 |
emit_insn (gen_vec_extractv2didi (operands[0], vec, const0_rtx)); |
| 1228 |
|
| 1229 |
DONE; |
| 1230 |
}) |
| 1231 |
|
| 1232 |
(define_insn "arm_reduc_plus_internal_v2di" |
| 1233 |
[(set (match_operand:V2DI 0 "s_register_operand" "=w") |
| 1234 |
(unspec:V2DI [(match_operand:V2DI 1 "s_register_operand" "w")] |
| 1235 |
UNSPEC_VPADD))] |
| 1236 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 1237 |
"vadd.i64\t%e0, %e1, %f1" |
| 1238 |
[(set_attr "type" "neon_add_q")] |
| 1239 |
) |
| 1240 |
|
| 1241 |
(define_expand "reduc_smin_scal_<mode>" |
| 1242 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1243 |
(match_operand:VD 1 "s_register_operand")] |
| 1244 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 1245 |
{ |
| 1246 |
rtx vec = gen_reg_rtx (<MODE>mode); |
| 1247 |
|
| 1248 |
neon_pairwise_reduce (vec, operands[1], <MODE>mode, |
| 1249 |
&gen_neon_vpsmin<mode>); |
| 1250 |
/* The result is computed into every element of the vector. */ |
| 1251 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], vec, const0_rtx)); |
| 1252 |
DONE; |
| 1253 |
}) |
| 1254 |
|
| 1255 |
(define_expand "reduc_smin_scal_<mode>" |
| 1256 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1257 |
(match_operand:VQ 1 "s_register_operand")] |
| 1258 |
"ARM_HAVE_NEON_<MODE>_ARITH && !BYTES_BIG_ENDIAN" |
| 1259 |
{ |
| 1260 |
rtx step1 = gen_reg_rtx (<V_HALF>mode); |
| 1261 |
|
| 1262 |
emit_insn (gen_quad_halves_smin<mode> (step1, operands[1])); |
| 1263 |
emit_insn (gen_reduc_smin_scal_<V_half> (operands[0], step1)); |
| 1264 |
|
| 1265 |
DONE; |
| 1266 |
}) |
| 1267 |
|
| 1268 |
(define_expand "reduc_smax_scal_<mode>" |
| 1269 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1270 |
(match_operand:VD 1 "s_register_operand")] |
| 1271 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 1272 |
{ |
| 1273 |
rtx vec = gen_reg_rtx (<MODE>mode); |
| 1274 |
neon_pairwise_reduce (vec, operands[1], <MODE>mode, |
| 1275 |
&gen_neon_vpsmax<mode>); |
| 1276 |
/* The result is computed into every element of the vector. */ |
| 1277 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], vec, const0_rtx)); |
| 1278 |
DONE; |
| 1279 |
}) |
| 1280 |
|
| 1281 |
(define_expand "reduc_smax_scal_<mode>" |
| 1282 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1283 |
(match_operand:VQ 1 "s_register_operand")] |
| 1284 |
"ARM_HAVE_NEON_<MODE>_ARITH && !BYTES_BIG_ENDIAN" |
| 1285 |
{ |
| 1286 |
rtx step1 = gen_reg_rtx (<V_HALF>mode); |
| 1287 |
|
| 1288 |
emit_insn (gen_quad_halves_smax<mode> (step1, operands[1])); |
| 1289 |
emit_insn (gen_reduc_smax_scal_<V_half> (operands[0], step1)); |
| 1290 |
|
| 1291 |
DONE; |
| 1292 |
}) |
| 1293 |
|
| 1294 |
(define_expand "reduc_umin_scal_<mode>" |
| 1295 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1296 |
(match_operand:VDI 1 "s_register_operand")] |
| 1297 |
"TARGET_NEON" |
| 1298 |
{ |
| 1299 |
rtx vec = gen_reg_rtx (<MODE>mode); |
| 1300 |
neon_pairwise_reduce (vec, operands[1], <MODE>mode, |
| 1301 |
&gen_neon_vpumin<mode>); |
| 1302 |
/* The result is computed into every element of the vector. */ |
| 1303 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], vec, const0_rtx)); |
| 1304 |
DONE; |
| 1305 |
}) |
| 1306 |
|
| 1307 |
(define_expand "reduc_umin_scal_<mode>" |
| 1308 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1309 |
(match_operand:VQI 1 "s_register_operand")] |
| 1310 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 1311 |
{ |
| 1312 |
rtx step1 = gen_reg_rtx (<V_HALF>mode); |
| 1313 |
|
| 1314 |
emit_insn (gen_quad_halves_umin<mode> (step1, operands[1])); |
| 1315 |
emit_insn (gen_reduc_umin_scal_<V_half> (operands[0], step1)); |
| 1316 |
|
| 1317 |
DONE; |
| 1318 |
}) |
| 1319 |
|
| 1320 |
(define_expand "reduc_umax_scal_<mode>" |
| 1321 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1322 |
(match_operand:VDI 1 "s_register_operand")] |
| 1323 |
"TARGET_NEON" |
| 1324 |
{ |
| 1325 |
rtx vec = gen_reg_rtx (<MODE>mode); |
| 1326 |
neon_pairwise_reduce (vec, operands[1], <MODE>mode, |
| 1327 |
&gen_neon_vpumax<mode>); |
| 1328 |
/* The result is computed into every element of the vector. */ |
| 1329 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], vec, const0_rtx)); |
| 1330 |
DONE; |
| 1331 |
}) |
| 1332 |
|
| 1333 |
(define_expand "reduc_umax_scal_<mode>" |
| 1334 |
[(match_operand:<V_elem> 0 "nonimmediate_operand") |
| 1335 |
(match_operand:VQI 1 "s_register_operand")] |
| 1336 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 1337 |
{ |
| 1338 |
rtx step1 = gen_reg_rtx (<V_HALF>mode); |
| 1339 |
|
| 1340 |
emit_insn (gen_quad_halves_umax<mode> (step1, operands[1])); |
| 1341 |
emit_insn (gen_reduc_umax_scal_<V_half> (operands[0], step1)); |
| 1342 |
|
| 1343 |
DONE; |
| 1344 |
}) |
| 1345 |
|
| 1346 |
(define_insn "neon_vpadd_internal<mode>" |
| 1347 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1348 |
(unspec:VD [(match_operand:VD 1 "s_register_operand" "w") |
| 1349 |
(match_operand:VD 2 "s_register_operand" "w")] |
| 1350 |
UNSPEC_VPADD))] |
| 1351 |
"TARGET_NEON" |
| 1352 |
"vpadd.<V_if_elem>\t%P0, %P1, %P2" |
| 1353 |
;; Assume this schedules like vadd. |
| 1354 |
[(set (attr "type") |
| 1355 |
(if_then_else (match_test "<Is_float_mode>") |
| 1356 |
(const_string "neon_fp_reduc_add_s<q>") |
| 1357 |
(const_string "neon_reduc_add<q>")))] |
| 1358 |
) |
| 1359 |
|
| 1360 |
(define_insn "neon_vpaddv4hf" |
| 1361 |
[(set |
| 1362 |
(match_operand:V4HF 0 "s_register_operand" "=w") |
| 1363 |
(unspec:V4HF [(match_operand:V4HF 1 "s_register_operand" "w") |
| 1364 |
(match_operand:V4HF 2 "s_register_operand" "w")] |
| 1365 |
UNSPEC_VPADD))] |
| 1366 |
"TARGET_NEON_FP16INST" |
| 1367 |
"vpadd.f16\t%P0, %P1, %P2" |
| 1368 |
[(set_attr "type" "neon_reduc_add")] |
| 1369 |
) |
| 1370 |
|
| 1371 |
(define_insn "neon_vpsmin<mode>" |
| 1372 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1373 |
(unspec:VD [(match_operand:VD 1 "s_register_operand" "w") |
| 1374 |
(match_operand:VD 2 "s_register_operand" "w")] |
| 1375 |
UNSPEC_VPSMIN))] |
| 1376 |
"TARGET_NEON" |
| 1377 |
"vpmin.<V_s_elem>\t%P0, %P1, %P2" |
| 1378 |
[(set (attr "type") |
| 1379 |
(if_then_else (match_test "<Is_float_mode>") |
| 1380 |
(const_string "neon_fp_reduc_minmax_s<q>") |
| 1381 |
(const_string "neon_reduc_minmax<q>")))] |
| 1382 |
) |
| 1383 |
|
| 1384 |
(define_insn "neon_vpsmax<mode>" |
| 1385 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1386 |
(unspec:VD [(match_operand:VD 1 "s_register_operand" "w") |
| 1387 |
(match_operand:VD 2 "s_register_operand" "w")] |
| 1388 |
UNSPEC_VPSMAX))] |
| 1389 |
"TARGET_NEON" |
| 1390 |
"vpmax.<V_s_elem>\t%P0, %P1, %P2" |
| 1391 |
[(set (attr "type") |
| 1392 |
(if_then_else (match_test "<Is_float_mode>") |
| 1393 |
(const_string "neon_fp_reduc_minmax_s<q>") |
| 1394 |
(const_string "neon_reduc_minmax<q>")))] |
| 1395 |
) |
| 1396 |
|
| 1397 |
(define_insn "neon_vpumin<mode>" |
| 1398 |
[(set (match_operand:VDI 0 "s_register_operand" "=w") |
| 1399 |
(unspec:VDI [(match_operand:VDI 1 "s_register_operand" "w") |
| 1400 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 1401 |
UNSPEC_VPUMIN))] |
| 1402 |
"TARGET_NEON" |
| 1403 |
"vpmin.<V_u_elem>\t%P0, %P1, %P2" |
| 1404 |
[(set_attr "type" "neon_reduc_minmax<q>")] |
| 1405 |
) |
| 1406 |
|
| 1407 |
(define_insn "neon_vpumax<mode>" |
| 1408 |
[(set (match_operand:VDI 0 "s_register_operand" "=w") |
| 1409 |
(unspec:VDI [(match_operand:VDI 1 "s_register_operand" "w") |
| 1410 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 1411 |
UNSPEC_VPUMAX))] |
| 1412 |
"TARGET_NEON" |
| 1413 |
"vpmax.<V_u_elem>\t%P0, %P1, %P2" |
| 1414 |
[(set_attr "type" "neon_reduc_minmax<q>")] |
| 1415 |
) |
| 1416 |
|
| 1417 |
;; Saturating arithmetic |
| 1418 |
|
| 1419 |
; NOTE: Neon supports many more saturating variants of instructions than the |
| 1420 |
; following, but these are all GCC currently understands. |
| 1421 |
; FIXME: Actually, GCC doesn't know how to create saturating add/sub by itself |
| 1422 |
; yet either, although these patterns may be used by intrinsics when they're |
| 1423 |
; added. |
| 1424 |
|
| 1425 |
(define_insn "*ss_add<mode>_neon" |
| 1426 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1427 |
(ss_plus:VD (match_operand:VD 1 "s_register_operand" "w") |
| 1428 |
(match_operand:VD 2 "s_register_operand" "w")))] |
| 1429 |
"TARGET_NEON" |
| 1430 |
"vqadd.<V_s_elem>\t%P0, %P1, %P2" |
| 1431 |
[(set_attr "type" "neon_qadd<q>")] |
| 1432 |
) |
| 1433 |
|
| 1434 |
(define_insn "*us_add<mode>_neon" |
| 1435 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1436 |
(us_plus:VD (match_operand:VD 1 "s_register_operand" "w") |
| 1437 |
(match_operand:VD 2 "s_register_operand" "w")))] |
| 1438 |
"TARGET_NEON" |
| 1439 |
"vqadd.<V_u_elem>\t%P0, %P1, %P2" |
| 1440 |
[(set_attr "type" "neon_qadd<q>")] |
| 1441 |
) |
| 1442 |
|
| 1443 |
(define_insn "*ss_sub<mode>_neon" |
| 1444 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1445 |
(ss_minus:VD (match_operand:VD 1 "s_register_operand" "w") |
| 1446 |
(match_operand:VD 2 "s_register_operand" "w")))] |
| 1447 |
"TARGET_NEON" |
| 1448 |
"vqsub.<V_s_elem>\t%P0, %P1, %P2" |
| 1449 |
[(set_attr "type" "neon_qsub<q>")] |
| 1450 |
) |
| 1451 |
|
| 1452 |
(define_insn "*us_sub<mode>_neon" |
| 1453 |
[(set (match_operand:VD 0 "s_register_operand" "=w") |
| 1454 |
(us_minus:VD (match_operand:VD 1 "s_register_operand" "w") |
| 1455 |
(match_operand:VD 2 "s_register_operand" "w")))] |
| 1456 |
"TARGET_NEON" |
| 1457 |
"vqsub.<V_u_elem>\t%P0, %P1, %P2" |
| 1458 |
[(set_attr "type" "neon_qsub<q>")] |
| 1459 |
) |
| 1460 |
|
| 1461 |
(define_expand "vec_cmp<mode><v_cmp_result>" |
| 1462 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand") |
| 1463 |
(match_operator:<V_cmp_result> 1 "comparison_operator" |
| 1464 |
[(match_operand:VDQWH 2 "s_register_operand") |
| 1465 |
(match_operand:VDQWH 3 "reg_or_zero_operand")]))] |
| 1466 |
"TARGET_NEON |
| 1467 |
&& (!<Is_float_mode> || flag_unsafe_math_optimizations)" |
| 1468 |
{ |
| 1469 |
arm_expand_vector_compare (operands[0], GET_CODE (operands[1]), |
| 1470 |
operands[2], operands[3], false); |
| 1471 |
DONE; |
| 1472 |
}) |
| 1473 |
|
| 1474 |
(define_expand "vec_cmpu<mode><mode>" |
| 1475 |
[(set (match_operand:VDQIW 0 "s_register_operand") |
| 1476 |
(match_operator:VDQIW 1 "comparison_operator" |
| 1477 |
[(match_operand:VDQIW 2 "s_register_operand") |
| 1478 |
(match_operand:VDQIW 3 "reg_or_zero_operand")]))] |
| 1479 |
"TARGET_NEON" |
| 1480 |
{ |
| 1481 |
arm_expand_vector_compare (operands[0], GET_CODE (operands[1]), |
| 1482 |
operands[2], operands[3], false); |
| 1483 |
DONE; |
| 1484 |
}) |
| 1485 |
|
| 1486 |
(define_expand "vcond_mask_<mode><v_cmp_result>" |
| 1487 |
[(set (match_operand:VDQWH 0 "s_register_operand") |
| 1488 |
(if_then_else:VDQWH |
| 1489 |
(match_operand:<V_cmp_result> 3 "s_register_operand") |
| 1490 |
(match_operand:VDQWH 1 "s_register_operand") |
| 1491 |
(match_operand:VDQWH 2 "s_register_operand")))] |
| 1492 |
"TARGET_NEON |
| 1493 |
&& (!<Is_float_mode> || flag_unsafe_math_optimizations)" |
| 1494 |
{ |
| 1495 |
emit_insn (gen_neon_vbsl<mode> (operands[0], operands[3], operands[1], |
| 1496 |
operands[2])); |
| 1497 |
DONE; |
| 1498 |
}) |
| 1499 |
|
| 1500 |
;; Patterns for builtins. |
| 1501 |
|
| 1502 |
; good for plain vadd, vaddq. |
| 1503 |
|
| 1504 |
(define_expand "neon_vadd<mode>" |
| 1505 |
[(match_operand:VCVTF 0 "s_register_operand") |
| 1506 |
(match_operand:VCVTF 1 "s_register_operand") |
| 1507 |
(match_operand:VCVTF 2 "s_register_operand")] |
| 1508 |
"TARGET_NEON" |
| 1509 |
{ |
| 1510 |
if (ARM_HAVE_NEON_<MODE>_ARITH) |
| 1511 |
emit_insn (gen_add<mode>3 (operands[0], operands[1], operands[2])); |
| 1512 |
else |
| 1513 |
emit_insn (gen_neon_vadd<mode>_unspec (operands[0], operands[1], |
| 1514 |
operands[2])); |
| 1515 |
DONE; |
| 1516 |
}) |
| 1517 |
|
| 1518 |
(define_expand "neon_vadd<mode>" |
| 1519 |
[(match_operand:VH 0 "s_register_operand") |
| 1520 |
(match_operand:VH 1 "s_register_operand") |
| 1521 |
(match_operand:VH 2 "s_register_operand")] |
| 1522 |
"TARGET_NEON_FP16INST" |
| 1523 |
{ |
| 1524 |
emit_insn (gen_add<mode>3 (operands[0], operands[1], operands[2])); |
| 1525 |
DONE; |
| 1526 |
}) |
| 1527 |
|
| 1528 |
(define_expand "neon_vsub<mode>" |
| 1529 |
[(match_operand:VH 0 "s_register_operand") |
| 1530 |
(match_operand:VH 1 "s_register_operand") |
| 1531 |
(match_operand:VH 2 "s_register_operand")] |
| 1532 |
"TARGET_NEON_FP16INST" |
| 1533 |
{ |
| 1534 |
emit_insn (gen_sub<mode>3 (operands[0], operands[1], operands[2])); |
| 1535 |
DONE; |
| 1536 |
}) |
| 1537 |
|
| 1538 |
; Note that NEON operations don't support the full IEEE 754 standard: in |
| 1539 |
; particular, denormal values are flushed to zero. This means that GCC cannot |
| 1540 |
; use those instructions for autovectorization, etc. unless |
| 1541 |
; -funsafe-math-optimizations is in effect (in which case flush-to-zero |
| 1542 |
; behavior is permissible). Intrinsic operations (provided by the arm_neon.h |
| 1543 |
; header) must work in either case: if -funsafe-math-optimizations is given, |
| 1544 |
; intrinsics expand to "canonical" RTL where possible, otherwise intrinsics |
| 1545 |
; expand to unspecs (which may potentially limit the extent to which they might |
| 1546 |
; be optimized by generic code). |
| 1547 |
|
| 1548 |
; Used for intrinsics when flag_unsafe_math_optimizations is false. |
| 1549 |
|
| 1550 |
(define_insn "neon_vadd<mode>_unspec" |
| 1551 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1552 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 1553 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 1554 |
UNSPEC_VADD))] |
| 1555 |
"TARGET_NEON" |
| 1556 |
"vadd.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 1557 |
[(set (attr "type") |
| 1558 |
(if_then_else (match_test "<Is_float_mode>") |
| 1559 |
(const_string "neon_fp_addsub_s<q>") |
| 1560 |
(const_string "neon_add<q>")))] |
| 1561 |
) |
| 1562 |
|
| 1563 |
(define_insn "neon_vaddl<sup><mode>" |
| 1564 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 1565 |
(unspec:<V_widen> [(match_operand:VDI 1 "s_register_operand" "w") |
| 1566 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 1567 |
VADDL))] |
| 1568 |
"TARGET_NEON" |
| 1569 |
"vaddl.<sup>%#<V_sz_elem>\t%q0, %P1, %P2" |
| 1570 |
[(set_attr "type" "neon_add_long")] |
| 1571 |
) |
| 1572 |
|
| 1573 |
(define_insn "neon_vaddw<sup><mode>" |
| 1574 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 1575 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "w") |
| 1576 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 1577 |
VADDW))] |
| 1578 |
"TARGET_NEON" |
| 1579 |
"vaddw.<sup>%#<V_sz_elem>\t%q0, %q1, %P2" |
| 1580 |
[(set_attr "type" "neon_add_widen")] |
| 1581 |
) |
| 1582 |
|
| 1583 |
; vhadd and vrhadd. |
| 1584 |
|
| 1585 |
(define_insn "@neon_v<r>hadd<sup><mode>" |
| 1586 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 1587 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") |
| 1588 |
(match_operand:VDQIW 2 "s_register_operand" "w")] |
| 1589 |
VHADD))] |
| 1590 |
"TARGET_NEON" |
| 1591 |
"v<r>hadd.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 1592 |
[(set_attr "type" "neon_add_halve_q")] |
| 1593 |
) |
| 1594 |
|
| 1595 |
(define_insn "neon_vqadd<sup><mode>" |
| 1596 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 1597 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 1598 |
(match_operand:VDQIX 2 "s_register_operand" "w")] |
| 1599 |
VQADD))] |
| 1600 |
"TARGET_NEON" |
| 1601 |
"vqadd.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 1602 |
[(set_attr "type" "neon_qadd<q>")] |
| 1603 |
) |
| 1604 |
|
| 1605 |
(define_insn "neon_v<r>addhn<mode>" |
| 1606 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 1607 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w") |
| 1608 |
(match_operand:VN 2 "s_register_operand" "w")] |
| 1609 |
VADDHN))] |
| 1610 |
"TARGET_NEON" |
| 1611 |
"v<r>addhn.<V_if_elem>\t%P0, %q1, %q2" |
| 1612 |
[(set_attr "type" "neon_add_halve_narrow_q")] |
| 1613 |
) |
| 1614 |
|
| 1615 |
;; Polynomial and Float multiplication. |
| 1616 |
(define_insn "neon_vmul<pf><mode>" |
| 1617 |
[(set (match_operand:VPF 0 "s_register_operand" "=w") |
| 1618 |
(unspec:VPF [(match_operand:VPF 1 "s_register_operand" "w") |
| 1619 |
(match_operand:VPF 2 "s_register_operand" "w")] |
| 1620 |
UNSPEC_VMUL))] |
| 1621 |
"TARGET_NEON" |
| 1622 |
"vmul.<pf>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 1623 |
[(set (attr "type") |
| 1624 |
(if_then_else (match_test "<Is_float_mode>") |
| 1625 |
(const_string "neon_fp_mul_s<q>") |
| 1626 |
(const_string "neon_mul_<V_elem_ch><q>")))] |
| 1627 |
) |
| 1628 |
|
| 1629 |
(define_insn "neon_vmulf<mode>" |
| 1630 |
[(set |
| 1631 |
(match_operand:VH 0 "s_register_operand" "=w") |
| 1632 |
(mult:VH |
| 1633 |
(match_operand:VH 1 "s_register_operand" "w") |
| 1634 |
(match_operand:VH 2 "s_register_operand" "w")))] |
| 1635 |
"TARGET_NEON_FP16INST" |
| 1636 |
"vmul.f16\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 1637 |
[(set_attr "type" "neon_mul_<VH_elem_ch><q>")] |
| 1638 |
) |
| 1639 |
|
| 1640 |
(define_expand "neon_vmla<mode>" |
| 1641 |
[(match_operand:VDQW 0 "s_register_operand") |
| 1642 |
(match_operand:VDQW 1 "s_register_operand") |
| 1643 |
(match_operand:VDQW 2 "s_register_operand") |
| 1644 |
(match_operand:VDQW 3 "s_register_operand")] |
| 1645 |
"TARGET_NEON" |
| 1646 |
{ |
| 1647 |
if (ARM_HAVE_NEON_<MODE>_ARITH) |
| 1648 |
emit_insn (gen_mul<mode>3add<mode>_neon (operands[0], operands[1], |
| 1649 |
operands[2], operands[3])); |
| 1650 |
else |
| 1651 |
emit_insn (gen_neon_vmla<mode>_unspec (operands[0], operands[1], |
| 1652 |
operands[2], operands[3])); |
| 1653 |
DONE; |
| 1654 |
}) |
| 1655 |
|
| 1656 |
(define_expand "neon_vfma<VCVTF:mode>" |
| 1657 |
[(match_operand:VCVTF 0 "s_register_operand") |
| 1658 |
(match_operand:VCVTF 1 "s_register_operand") |
| 1659 |
(match_operand:VCVTF 2 "s_register_operand") |
| 1660 |
(match_operand:VCVTF 3 "s_register_operand")] |
| 1661 |
"TARGET_NEON && TARGET_FMA" |
| 1662 |
{ |
| 1663 |
emit_insn (gen_fma<mode>4_intrinsic (operands[0], operands[2], operands[3], |
| 1664 |
operands[1])); |
| 1665 |
DONE; |
| 1666 |
}) |
| 1667 |
|
| 1668 |
(define_expand "neon_vfma<VH:mode>" |
| 1669 |
[(match_operand:VH 0 "s_register_operand") |
| 1670 |
(match_operand:VH 1 "s_register_operand") |
| 1671 |
(match_operand:VH 2 "s_register_operand") |
| 1672 |
(match_operand:VH 3 "s_register_operand")] |
| 1673 |
"TARGET_NEON_FP16INST" |
| 1674 |
{ |
| 1675 |
emit_insn (gen_fma<mode>4 (operands[0], operands[2], operands[3], |
| 1676 |
operands[1])); |
| 1677 |
DONE; |
| 1678 |
}) |
| 1679 |
|
| 1680 |
(define_expand "neon_vfms<VCVTF:mode>" |
| 1681 |
[(match_operand:VCVTF 0 "s_register_operand") |
| 1682 |
(match_operand:VCVTF 1 "s_register_operand") |
| 1683 |
(match_operand:VCVTF 2 "s_register_operand") |
| 1684 |
(match_operand:VCVTF 3 "s_register_operand")] |
| 1685 |
"TARGET_NEON && TARGET_FMA" |
| 1686 |
{ |
| 1687 |
emit_insn (gen_fmsub<mode>4_intrinsic (operands[0], operands[2], operands[3], |
| 1688 |
operands[1])); |
| 1689 |
DONE; |
| 1690 |
}) |
| 1691 |
|
| 1692 |
(define_expand "neon_vfms<VH:mode>" |
| 1693 |
[(match_operand:VH 0 "s_register_operand") |
| 1694 |
(match_operand:VH 1 "s_register_operand") |
| 1695 |
(match_operand:VH 2 "s_register_operand") |
| 1696 |
(match_operand:VH 3 "s_register_operand")] |
| 1697 |
"TARGET_NEON_FP16INST" |
| 1698 |
{ |
| 1699 |
emit_insn (gen_fmsub<mode>4_intrinsic (operands[0], operands[2], operands[3], |
| 1700 |
operands[1])); |
| 1701 |
DONE; |
| 1702 |
}) |
| 1703 |
|
| 1704 |
;; The expand RTL structure here is not important. |
| 1705 |
;; We use the gen_* functions anyway. |
| 1706 |
;; We just need something to wrap the iterators around. |
| 1707 |
|
| 1708 |
(define_expand "neon_vfm<vfml_op>l_<vfml_half><mode>" |
| 1709 |
[(set (match_operand:VCVTF 0 "s_register_operand") |
| 1710 |
(unspec:VCVTF |
| 1711 |
[(match_operand:VCVTF 1 "s_register_operand") |
| 1712 |
(PLUSMINUS:<VFML> |
| 1713 |
(match_operand:<VFML> 2 "s_register_operand") |
| 1714 |
(match_operand:<VFML> 3 "s_register_operand"))] VFMLHALVES))] |
| 1715 |
"TARGET_FP16FML" |
| 1716 |
{ |
| 1717 |
rtx half = arm_simd_vect_par_cnst_half (<VFML>mode, <vfml_half_selector>); |
| 1718 |
emit_insn (gen_vfm<vfml_op>l_<vfml_half><mode>_intrinsic (operands[0], |
| 1719 |
operands[1], |
| 1720 |
operands[2], |
| 1721 |
operands[3], |
| 1722 |
half, half)); |
| 1723 |
DONE; |
| 1724 |
}) |
| 1725 |
|
| 1726 |
(define_insn "vfmal_low<mode>_intrinsic" |
| 1727 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1728 |
(fma:VCVTF |
| 1729 |
(float_extend:VCVTF |
| 1730 |
(vec_select:<VFMLSEL> |
| 1731 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1732 |
(match_operand:<VFML> 4 "vect_par_constant_low" ""))) |
| 1733 |
(float_extend:VCVTF |
| 1734 |
(vec_select:<VFMLSEL> |
| 1735 |
(match_operand:<VFML> 3 "s_register_operand" "<VF_constraint>") |
| 1736 |
(match_operand:<VFML> 5 "vect_par_constant_low" ""))) |
| 1737 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1738 |
"TARGET_FP16FML" |
| 1739 |
"vfmal.f16\\t%<V_reg>0, %<V_lo>2, %<V_lo>3" |
| 1740 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1741 |
) |
| 1742 |
|
| 1743 |
(define_insn "vfmsl_high<mode>_intrinsic" |
| 1744 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1745 |
(fma:VCVTF |
| 1746 |
(float_extend:VCVTF |
| 1747 |
(neg:<VFMLSEL> |
| 1748 |
(vec_select:<VFMLSEL> |
| 1749 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1750 |
(match_operand:<VFML> 4 "vect_par_constant_high" "")))) |
| 1751 |
(float_extend:VCVTF |
| 1752 |
(vec_select:<VFMLSEL> |
| 1753 |
(match_operand:<VFML> 3 "s_register_operand" "<VF_constraint>") |
| 1754 |
(match_operand:<VFML> 5 "vect_par_constant_high" ""))) |
| 1755 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1756 |
"TARGET_FP16FML" |
| 1757 |
"vfmsl.f16\\t%<V_reg>0, %<V_hi>2, %<V_hi>3" |
| 1758 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1759 |
) |
| 1760 |
|
| 1761 |
(define_insn "vfmal_high<mode>_intrinsic" |
| 1762 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1763 |
(fma:VCVTF |
| 1764 |
(float_extend:VCVTF |
| 1765 |
(vec_select:<VFMLSEL> |
| 1766 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1767 |
(match_operand:<VFML> 4 "vect_par_constant_high" ""))) |
| 1768 |
(float_extend:VCVTF |
| 1769 |
(vec_select:<VFMLSEL> |
| 1770 |
(match_operand:<VFML> 3 "s_register_operand" "<VF_constraint>") |
| 1771 |
(match_operand:<VFML> 5 "vect_par_constant_high" ""))) |
| 1772 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1773 |
"TARGET_FP16FML" |
| 1774 |
"vfmal.f16\\t%<V_reg>0, %<V_hi>2, %<V_hi>3" |
| 1775 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1776 |
) |
| 1777 |
|
| 1778 |
(define_insn "vfmsl_low<mode>_intrinsic" |
| 1779 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1780 |
(fma:VCVTF |
| 1781 |
(float_extend:VCVTF |
| 1782 |
(neg:<VFMLSEL> |
| 1783 |
(vec_select:<VFMLSEL> |
| 1784 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1785 |
(match_operand:<VFML> 4 "vect_par_constant_low" "")))) |
| 1786 |
(float_extend:VCVTF |
| 1787 |
(vec_select:<VFMLSEL> |
| 1788 |
(match_operand:<VFML> 3 "s_register_operand" "<VF_constraint>") |
| 1789 |
(match_operand:<VFML> 5 "vect_par_constant_low" ""))) |
| 1790 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1791 |
"TARGET_FP16FML" |
| 1792 |
"vfmsl.f16\\t%<V_reg>0, %<V_lo>2, %<V_lo>3" |
| 1793 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1794 |
) |
| 1795 |
|
| 1796 |
(define_expand "neon_vfm<vfml_op>l_lane_<vfml_half><VCVTF:mode>" |
| 1797 |
[(set:VCVTF (match_operand:VCVTF 0 "s_register_operand") |
| 1798 |
(unspec:VCVTF |
| 1799 |
[(match_operand:VCVTF 1 "s_register_operand") |
| 1800 |
(PLUSMINUS:<VFML> |
| 1801 |
(match_operand:<VFML> 2 "s_register_operand") |
| 1802 |
(match_operand:<VFML> 3 "s_register_operand")) |
| 1803 |
(match_operand:SI 4 "const_int_operand")] VFMLHALVES))] |
| 1804 |
"TARGET_FP16FML" |
| 1805 |
{ |
| 1806 |
rtx lane = GEN_INT (NEON_ENDIAN_LANE_N (<VFML>mode, INTVAL (operands[4]))); |
| 1807 |
rtx half = arm_simd_vect_par_cnst_half (<VFML>mode, <vfml_half_selector>); |
| 1808 |
emit_insn (gen_vfm<vfml_op>l_lane_<vfml_half><mode>_intrinsic |
| 1809 |
(operands[0], operands[1], |
| 1810 |
operands[2], operands[3], |
| 1811 |
half, lane)); |
| 1812 |
DONE; |
| 1813 |
}) |
| 1814 |
|
| 1815 |
(define_insn "vfmal_lane_low<mode>_intrinsic" |
| 1816 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1817 |
(fma:VCVTF |
| 1818 |
(float_extend:VCVTF |
| 1819 |
(vec_select:<VFMLSEL> |
| 1820 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1821 |
(match_operand:<VFML> 4 "vect_par_constant_low" ""))) |
| 1822 |
(float_extend:VCVTF |
| 1823 |
(vec_duplicate:<VFMLSEL> |
| 1824 |
(vec_select:HF |
| 1825 |
(match_operand:<VFML> 3 "s_register_operand" "x") |
| 1826 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 1827 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1828 |
"TARGET_FP16FML" |
| 1829 |
{ |
| 1830 |
int lane = NEON_ENDIAN_LANE_N (<VFML>mode, INTVAL (operands[5])); |
| 1831 |
if (lane > GET_MODE_NUNITS (<VFMLSEL>mode) - 1) |
| 1832 |
{ |
| 1833 |
operands[5] = GEN_INT (lane - GET_MODE_NUNITS (<VFMLSEL>mode)); |
| 1834 |
return "vfmal.f16\\t%<V_reg>0, %<V_lo>2, %<V_hi>3[%c5]"; |
| 1835 |
} |
| 1836 |
else |
| 1837 |
{ |
| 1838 |
operands[5] = GEN_INT (lane); |
| 1839 |
return "vfmal.f16\\t%<V_reg>0, %<V_lo>2, %<V_lo>3[%c5]"; |
| 1840 |
} |
| 1841 |
} |
| 1842 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1843 |
) |
| 1844 |
|
| 1845 |
(define_expand "neon_vfm<vfml_op>l_lane_<vfml_half><vfmlsel2><mode>" |
| 1846 |
[(set:VCVTF (match_operand:VCVTF 0 "s_register_operand") |
| 1847 |
(unspec:VCVTF |
| 1848 |
[(match_operand:VCVTF 1 "s_register_operand") |
| 1849 |
(PLUSMINUS:<VFML> |
| 1850 |
(match_operand:<VFML> 2 "s_register_operand") |
| 1851 |
(match_operand:<VFMLSEL2> 3 "s_register_operand")) |
| 1852 |
(match_operand:SI 4 "const_int_operand")] VFMLHALVES))] |
| 1853 |
"TARGET_FP16FML" |
| 1854 |
{ |
| 1855 |
rtx lane |
| 1856 |
= GEN_INT (NEON_ENDIAN_LANE_N (<VFMLSEL2>mode, INTVAL (operands[4]))); |
| 1857 |
rtx half = arm_simd_vect_par_cnst_half (<VFML>mode, <vfml_half_selector>); |
| 1858 |
emit_insn (gen_vfm<vfml_op>l_lane_<vfml_half><vfmlsel2><mode>_intrinsic |
| 1859 |
(operands[0], operands[1], operands[2], operands[3], |
| 1860 |
half, lane)); |
| 1861 |
DONE; |
| 1862 |
}) |
| 1863 |
|
| 1864 |
;; Used to implement the intrinsics: |
| 1865 |
;; float32x4_t vfmlalq_lane_low_f16 (float32x4_t r, float16x8_t a, float16x4_t b, const int lane) |
| 1866 |
;; float32x2_t vfmlal_laneq_low_f16 (float32x2_t r, float16x4_t a, float16x8_t b, const int lane) |
| 1867 |
;; Needs a bit of care to get the modes of the different sub-expressions right |
| 1868 |
;; due to 'a' and 'b' having different sizes and make sure we use the right |
| 1869 |
;; S or D subregister to select the appropriate lane from. |
| 1870 |
|
| 1871 |
(define_insn "vfmal_lane_low<vfmlsel2><mode>_intrinsic" |
| 1872 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1873 |
(fma:VCVTF |
| 1874 |
(float_extend:VCVTF |
| 1875 |
(vec_select:<VFMLSEL> |
| 1876 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1877 |
(match_operand:<VFML> 4 "vect_par_constant_low" ""))) |
| 1878 |
(float_extend:VCVTF |
| 1879 |
(vec_duplicate:<VFMLSEL> |
| 1880 |
(vec_select:HF |
| 1881 |
(match_operand:<VFMLSEL2> 3 "s_register_operand" "x") |
| 1882 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 1883 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1884 |
"TARGET_FP16FML" |
| 1885 |
{ |
| 1886 |
int lane = NEON_ENDIAN_LANE_N (<VFMLSEL2>mode, INTVAL (operands[5])); |
| 1887 |
int elts_per_reg = GET_MODE_NUNITS (<VFMLSEL>mode); |
| 1888 |
int new_lane = lane % elts_per_reg; |
| 1889 |
int regdiff = lane / elts_per_reg; |
| 1890 |
operands[5] = GEN_INT (new_lane); |
| 1891 |
/* We re-create operands[2] and operands[3] in the halved VFMLSEL modes |
| 1892 |
because we want the print_operand code to print the appropriate |
| 1893 |
S or D register prefix. */ |
| 1894 |
operands[3] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[3]) + regdiff); |
| 1895 |
operands[2] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[2])); |
| 1896 |
return "vfmal.f16\\t%<V_reg>0, %<V_lane_reg>2, %<V_lane_reg>3[%c5]"; |
| 1897 |
} |
| 1898 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1899 |
) |
| 1900 |
|
| 1901 |
;; Used to implement the intrinsics: |
| 1902 |
;; float32x4_t vfmlalq_lane_high_f16 (float32x4_t r, float16x8_t a, float16x4_t b, const int lane) |
| 1903 |
;; float32x2_t vfmlal_laneq_high_f16 (float32x2_t r, float16x4_t a, float16x8_t b, const int lane) |
| 1904 |
;; Needs a bit of care to get the modes of the different sub-expressions right |
| 1905 |
;; due to 'a' and 'b' having different sizes and make sure we use the right |
| 1906 |
;; S or D subregister to select the appropriate lane from. |
| 1907 |
|
| 1908 |
(define_insn "vfmal_lane_high<vfmlsel2><mode>_intrinsic" |
| 1909 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1910 |
(fma:VCVTF |
| 1911 |
(float_extend:VCVTF |
| 1912 |
(vec_select:<VFMLSEL> |
| 1913 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1914 |
(match_operand:<VFML> 4 "vect_par_constant_high" ""))) |
| 1915 |
(float_extend:VCVTF |
| 1916 |
(vec_duplicate:<VFMLSEL> |
| 1917 |
(vec_select:HF |
| 1918 |
(match_operand:<VFMLSEL2> 3 "s_register_operand" "x") |
| 1919 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 1920 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1921 |
"TARGET_FP16FML" |
| 1922 |
{ |
| 1923 |
int lane = NEON_ENDIAN_LANE_N (<VFMLSEL2>mode, INTVAL (operands[5])); |
| 1924 |
int elts_per_reg = GET_MODE_NUNITS (<VFMLSEL>mode); |
| 1925 |
int new_lane = lane % elts_per_reg; |
| 1926 |
int regdiff = lane / elts_per_reg; |
| 1927 |
operands[5] = GEN_INT (new_lane); |
| 1928 |
/* We re-create operands[3] in the halved VFMLSEL mode |
| 1929 |
because we've calculated the correct half-width subreg to extract |
| 1930 |
the lane from and we want to print *that* subreg instead. */ |
| 1931 |
operands[3] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[3]) + regdiff); |
| 1932 |
return "vfmal.f16\\t%<V_reg>0, %<V_hi>2, %<V_lane_reg>3[%c5]"; |
| 1933 |
} |
| 1934 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1935 |
) |
| 1936 |
|
| 1937 |
(define_insn "vfmal_lane_high<mode>_intrinsic" |
| 1938 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1939 |
(fma:VCVTF |
| 1940 |
(float_extend:VCVTF |
| 1941 |
(vec_select:<VFMLSEL> |
| 1942 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1943 |
(match_operand:<VFML> 4 "vect_par_constant_high" ""))) |
| 1944 |
(float_extend:VCVTF |
| 1945 |
(vec_duplicate:<VFMLSEL> |
| 1946 |
(vec_select:HF |
| 1947 |
(match_operand:<VFML> 3 "s_register_operand" "x") |
| 1948 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 1949 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1950 |
"TARGET_FP16FML" |
| 1951 |
{ |
| 1952 |
int lane = NEON_ENDIAN_LANE_N (<VFML>mode, INTVAL (operands[5])); |
| 1953 |
if (lane > GET_MODE_NUNITS (<VFMLSEL>mode) - 1) |
| 1954 |
{ |
| 1955 |
operands[5] = GEN_INT (lane - GET_MODE_NUNITS (<VFMLSEL>mode)); |
| 1956 |
return "vfmal.f16\\t%<V_reg>0, %<V_hi>2, %<V_hi>3[%c5]"; |
| 1957 |
} |
| 1958 |
else |
| 1959 |
{ |
| 1960 |
operands[5] = GEN_INT (lane); |
| 1961 |
return "vfmal.f16\\t%<V_reg>0, %<V_hi>2, %<V_lo>3[%c5]"; |
| 1962 |
} |
| 1963 |
} |
| 1964 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1965 |
) |
| 1966 |
|
| 1967 |
(define_insn "vfmsl_lane_low<mode>_intrinsic" |
| 1968 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 1969 |
(fma:VCVTF |
| 1970 |
(float_extend:VCVTF |
| 1971 |
(neg:<VFMLSEL> |
| 1972 |
(vec_select:<VFMLSEL> |
| 1973 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 1974 |
(match_operand:<VFML> 4 "vect_par_constant_low" "")))) |
| 1975 |
(float_extend:VCVTF |
| 1976 |
(vec_duplicate:<VFMLSEL> |
| 1977 |
(vec_select:HF |
| 1978 |
(match_operand:<VFML> 3 "s_register_operand" "x") |
| 1979 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 1980 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 1981 |
"TARGET_FP16FML" |
| 1982 |
{ |
| 1983 |
int lane = NEON_ENDIAN_LANE_N (<VFML>mode, INTVAL (operands[5])); |
| 1984 |
if (lane > GET_MODE_NUNITS (<VFMLSEL>mode) - 1) |
| 1985 |
{ |
| 1986 |
operands[5] = GEN_INT (lane - GET_MODE_NUNITS (<VFMLSEL>mode)); |
| 1987 |
return "vfmsl.f16\\t%<V_reg>0, %<V_lo>2, %<V_hi>3[%c5]"; |
| 1988 |
} |
| 1989 |
else |
| 1990 |
{ |
| 1991 |
operands[5] = GEN_INT (lane); |
| 1992 |
return "vfmsl.f16\\t%<V_reg>0, %<V_lo>2, %<V_lo>3[%c5]"; |
| 1993 |
} |
| 1994 |
} |
| 1995 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 1996 |
) |
| 1997 |
|
| 1998 |
;; Used to implement the intrinsics: |
| 1999 |
;; float32x4_t vfmlslq_lane_low_f16 (float32x4_t r, float16x8_t a, float16x4_t b, const int lane) |
| 2000 |
;; float32x2_t vfmlsl_laneq_low_f16 (float32x2_t r, float16x4_t a, float16x8_t b, const int lane) |
| 2001 |
;; Needs a bit of care to get the modes of the different sub-expressions right |
| 2002 |
;; due to 'a' and 'b' having different sizes and make sure we use the right |
| 2003 |
;; S or D subregister to select the appropriate lane from. |
| 2004 |
|
| 2005 |
(define_insn "vfmsl_lane_low<vfmlsel2><mode>_intrinsic" |
| 2006 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2007 |
(fma:VCVTF |
| 2008 |
(float_extend:VCVTF |
| 2009 |
(neg:<VFMLSEL> |
| 2010 |
(vec_select:<VFMLSEL> |
| 2011 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 2012 |
(match_operand:<VFML> 4 "vect_par_constant_low" "")))) |
| 2013 |
(float_extend:VCVTF |
| 2014 |
(vec_duplicate:<VFMLSEL> |
| 2015 |
(vec_select:HF |
| 2016 |
(match_operand:<VFMLSEL2> 3 "s_register_operand" "x") |
| 2017 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 2018 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 2019 |
"TARGET_FP16FML" |
| 2020 |
{ |
| 2021 |
int lane = NEON_ENDIAN_LANE_N (<VFMLSEL2>mode, INTVAL (operands[5])); |
| 2022 |
int elts_per_reg = GET_MODE_NUNITS (<VFMLSEL>mode); |
| 2023 |
int new_lane = lane % elts_per_reg; |
| 2024 |
int regdiff = lane / elts_per_reg; |
| 2025 |
operands[5] = GEN_INT (new_lane); |
| 2026 |
/* We re-create operands[2] and operands[3] in the halved VFMLSEL modes |
| 2027 |
because we want the print_operand code to print the appropriate |
| 2028 |
S or D register prefix. */ |
| 2029 |
operands[3] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[3]) + regdiff); |
| 2030 |
operands[2] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[2])); |
| 2031 |
return "vfmsl.f16\\t%<V_reg>0, %<V_lane_reg>2, %<V_lane_reg>3[%c5]"; |
| 2032 |
} |
| 2033 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 2034 |
) |
| 2035 |
|
| 2036 |
;; Used to implement the intrinsics: |
| 2037 |
;; float32x4_t vfmlslq_lane_high_f16 (float32x4_t r, float16x8_t a, float16x4_t b, const int lane) |
| 2038 |
;; float32x2_t vfmlsl_laneq_high_f16 (float32x2_t r, float16x4_t a, float16x8_t b, const int lane) |
| 2039 |
;; Needs a bit of care to get the modes of the different sub-expressions right |
| 2040 |
;; due to 'a' and 'b' having different sizes and make sure we use the right |
| 2041 |
;; S or D subregister to select the appropriate lane from. |
| 2042 |
|
| 2043 |
(define_insn "vfmsl_lane_high<vfmlsel2><mode>_intrinsic" |
| 2044 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2045 |
(fma:VCVTF |
| 2046 |
(float_extend:VCVTF |
| 2047 |
(neg:<VFMLSEL> |
| 2048 |
(vec_select:<VFMLSEL> |
| 2049 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 2050 |
(match_operand:<VFML> 4 "vect_par_constant_high" "")))) |
| 2051 |
(float_extend:VCVTF |
| 2052 |
(vec_duplicate:<VFMLSEL> |
| 2053 |
(vec_select:HF |
| 2054 |
(match_operand:<VFMLSEL2> 3 "s_register_operand" "x") |
| 2055 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 2056 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 2057 |
"TARGET_FP16FML" |
| 2058 |
{ |
| 2059 |
int lane = NEON_ENDIAN_LANE_N (<VFMLSEL2>mode, INTVAL (operands[5])); |
| 2060 |
int elts_per_reg = GET_MODE_NUNITS (<VFMLSEL>mode); |
| 2061 |
int new_lane = lane % elts_per_reg; |
| 2062 |
int regdiff = lane / elts_per_reg; |
| 2063 |
operands[5] = GEN_INT (new_lane); |
| 2064 |
/* We re-create operands[3] in the halved VFMLSEL mode |
| 2065 |
because we've calculated the correct half-width subreg to extract |
| 2066 |
the lane from and we want to print *that* subreg instead. */ |
| 2067 |
operands[3] = gen_rtx_REG (<VFMLSEL>mode, REGNO (operands[3]) + regdiff); |
| 2068 |
return "vfmsl.f16\\t%<V_reg>0, %<V_hi>2, %<V_lane_reg>3[%c5]"; |
| 2069 |
} |
| 2070 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 2071 |
) |
| 2072 |
|
| 2073 |
(define_insn "vfmsl_lane_high<mode>_intrinsic" |
| 2074 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2075 |
(fma:VCVTF |
| 2076 |
(float_extend:VCVTF |
| 2077 |
(neg:<VFMLSEL> |
| 2078 |
(vec_select:<VFMLSEL> |
| 2079 |
(match_operand:<VFML> 2 "s_register_operand" "<VF_constraint>") |
| 2080 |
(match_operand:<VFML> 4 "vect_par_constant_high" "")))) |
| 2081 |
(float_extend:VCVTF |
| 2082 |
(vec_duplicate:<VFMLSEL> |
| 2083 |
(vec_select:HF |
| 2084 |
(match_operand:<VFML> 3 "s_register_operand" "x") |
| 2085 |
(parallel [(match_operand:SI 5 "const_int_operand" "n")])))) |
| 2086 |
(match_operand:VCVTF 1 "s_register_operand" "0")))] |
| 2087 |
"TARGET_FP16FML" |
| 2088 |
{ |
| 2089 |
int lane = NEON_ENDIAN_LANE_N (<VFML>mode, INTVAL (operands[5])); |
| 2090 |
if (lane > GET_MODE_NUNITS (<VFMLSEL>mode) - 1) |
| 2091 |
{ |
| 2092 |
operands[5] = GEN_INT (lane - GET_MODE_NUNITS (<VFMLSEL>mode)); |
| 2093 |
return "vfmsl.f16\\t%<V_reg>0, %<V_hi>2, %<V_hi>3[%c5]"; |
| 2094 |
} |
| 2095 |
else |
| 2096 |
{ |
| 2097 |
operands[5] = GEN_INT (lane); |
| 2098 |
return "vfmsl.f16\\t%<V_reg>0, %<V_hi>2, %<V_lo>3[%c5]"; |
| 2099 |
} |
| 2100 |
} |
| 2101 |
[(set_attr "type" "neon_fp_mla_s<q>")] |
| 2102 |
) |
| 2103 |
|
| 2104 |
; Used for intrinsics when flag_unsafe_math_optimizations is false. |
| 2105 |
|
| 2106 |
(define_insn "neon_vmla<mode>_unspec" |
| 2107 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 2108 |
(unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0") |
| 2109 |
(match_operand:VDQW 2 "s_register_operand" "w") |
| 2110 |
(match_operand:VDQW 3 "s_register_operand" "w")] |
| 2111 |
UNSPEC_VMLA))] |
| 2112 |
"TARGET_NEON" |
| 2113 |
"vmla.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 2114 |
[(set (attr "type") |
| 2115 |
(if_then_else (match_test "<Is_float_mode>") |
| 2116 |
(const_string "neon_fp_mla_s<q>") |
| 2117 |
(const_string "neon_mla_<V_elem_ch><q>")))] |
| 2118 |
) |
| 2119 |
|
| 2120 |
(define_insn "neon_vmlal<sup><mode>" |
| 2121 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2122 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 2123 |
(match_operand:VW 2 "s_register_operand" "w") |
| 2124 |
(match_operand:VW 3 "s_register_operand" "w")] |
| 2125 |
VMLAL))] |
| 2126 |
"TARGET_NEON" |
| 2127 |
"vmlal.<sup>%#<V_sz_elem>\t%q0, %P2, %P3" |
| 2128 |
[(set_attr "type" "neon_mla_<V_elem_ch>_long")] |
| 2129 |
) |
| 2130 |
|
| 2131 |
(define_expand "neon_vmls<mode>" |
| 2132 |
[(match_operand:VDQW 0 "s_register_operand") |
| 2133 |
(match_operand:VDQW 1 "s_register_operand") |
| 2134 |
(match_operand:VDQW 2 "s_register_operand") |
| 2135 |
(match_operand:VDQW 3 "s_register_operand")] |
| 2136 |
"TARGET_NEON" |
| 2137 |
{ |
| 2138 |
if (ARM_HAVE_NEON_<MODE>_ARITH) |
| 2139 |
emit_insn (gen_mul<mode>3neg<mode>add<mode>_neon (operands[0], |
| 2140 |
operands[1], operands[2], operands[3])); |
| 2141 |
else |
| 2142 |
emit_insn (gen_neon_vmls<mode>_unspec (operands[0], operands[1], |
| 2143 |
operands[2], operands[3])); |
| 2144 |
DONE; |
| 2145 |
}) |
| 2146 |
|
| 2147 |
; Used for intrinsics when flag_unsafe_math_optimizations is false. |
| 2148 |
|
| 2149 |
(define_insn "neon_vmls<mode>_unspec" |
| 2150 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 2151 |
(unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0") |
| 2152 |
(match_operand:VDQW 2 "s_register_operand" "w") |
| 2153 |
(match_operand:VDQW 3 "s_register_operand" "w")] |
| 2154 |
UNSPEC_VMLS))] |
| 2155 |
"TARGET_NEON" |
| 2156 |
"vmls.<V_if_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 2157 |
[(set (attr "type") |
| 2158 |
(if_then_else (match_test "<Is_float_mode>") |
| 2159 |
(const_string "neon_fp_mla_s<q>") |
| 2160 |
(const_string "neon_mla_<V_elem_ch><q>")))] |
| 2161 |
) |
| 2162 |
|
| 2163 |
(define_insn "neon_vmlsl<sup><mode>" |
| 2164 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2165 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 2166 |
(match_operand:VW 2 "s_register_operand" "w") |
| 2167 |
(match_operand:VW 3 "s_register_operand" "w")] |
| 2168 |
VMLSL))] |
| 2169 |
"TARGET_NEON" |
| 2170 |
"vmlsl.<sup>%#<V_sz_elem>\t%q0, %P2, %P3" |
| 2171 |
[(set_attr "type" "neon_mla_<V_elem_ch>_long")] |
| 2172 |
) |
| 2173 |
|
| 2174 |
;; vqdmulh, vqrdmulh |
| 2175 |
(define_insn "neon_vq<r>dmulh<mode>" |
| 2176 |
[(set (match_operand:VMDQI 0 "s_register_operand" "=w") |
| 2177 |
(unspec:VMDQI [(match_operand:VMDQI 1 "s_register_operand" "w") |
| 2178 |
(match_operand:VMDQI 2 "s_register_operand" "w")] |
| 2179 |
VQDMULH))] |
| 2180 |
"TARGET_NEON" |
| 2181 |
"vq<r>dmulh.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2182 |
[(set_attr "type" "neon_sat_mul_<V_elem_ch><q>")] |
| 2183 |
) |
| 2184 |
|
| 2185 |
;; vqrdmlah, vqrdmlsh |
| 2186 |
(define_insn "neon_vqrdml<VQRDMLH_AS:neon_rdma_as>h<mode>" |
| 2187 |
[(set (match_operand:VMDQI 0 "s_register_operand" "=w") |
| 2188 |
(unspec:VMDQI [(match_operand:VMDQI 1 "s_register_operand" "0") |
| 2189 |
(match_operand:VMDQI 2 "s_register_operand" "w") |
| 2190 |
(match_operand:VMDQI 3 "s_register_operand" "w")] |
| 2191 |
VQRDMLH_AS))] |
| 2192 |
"TARGET_NEON_RDMA" |
| 2193 |
"vqrdml<VQRDMLH_AS:neon_rdma_as>h.<V_s_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 2194 |
[(set_attr "type" "neon_sat_mla_<V_elem_ch>_long")] |
| 2195 |
) |
| 2196 |
|
| 2197 |
(define_insn "neon_vqdmlal<mode>" |
| 2198 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2199 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 2200 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 2201 |
(match_operand:VMDI 3 "s_register_operand" "w")] |
| 2202 |
UNSPEC_VQDMLAL))] |
| 2203 |
"TARGET_NEON" |
| 2204 |
"vqdmlal.<V_s_elem>\t%q0, %P2, %P3" |
| 2205 |
[(set_attr "type" "neon_sat_mla_<V_elem_ch>_long")] |
| 2206 |
) |
| 2207 |
|
| 2208 |
(define_insn "neon_vqdmlsl<mode>" |
| 2209 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2210 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 2211 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 2212 |
(match_operand:VMDI 3 "s_register_operand" "w")] |
| 2213 |
UNSPEC_VQDMLSL))] |
| 2214 |
"TARGET_NEON" |
| 2215 |
"vqdmlsl.<V_s_elem>\t%q0, %P2, %P3" |
| 2216 |
[(set_attr "type" "neon_sat_mla_<V_elem_ch>_long")] |
| 2217 |
) |
| 2218 |
|
| 2219 |
(define_insn "neon_vmull<sup><mode>" |
| 2220 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2221 |
(unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w") |
| 2222 |
(match_operand:VW 2 "s_register_operand" "w")] |
| 2223 |
VMULL))] |
| 2224 |
"TARGET_NEON" |
| 2225 |
"vmull.<sup>%#<V_sz_elem>\t%q0, %P1, %P2" |
| 2226 |
[(set_attr "type" "neon_mul_<V_elem_ch>_long")] |
| 2227 |
) |
| 2228 |
|
| 2229 |
(define_insn "neon_vqdmull<mode>" |
| 2230 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2231 |
(unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w") |
| 2232 |
(match_operand:VMDI 2 "s_register_operand" "w")] |
| 2233 |
UNSPEC_VQDMULL))] |
| 2234 |
"TARGET_NEON" |
| 2235 |
"vqdmull.<V_s_elem>\t%q0, %P1, %P2" |
| 2236 |
[(set_attr "type" "neon_sat_mul_<V_elem_ch>_long")] |
| 2237 |
) |
| 2238 |
|
| 2239 |
(define_expand "neon_vsub<mode>" |
| 2240 |
[(match_operand:VCVTF 0 "s_register_operand") |
| 2241 |
(match_operand:VCVTF 1 "s_register_operand") |
| 2242 |
(match_operand:VCVTF 2 "s_register_operand")] |
| 2243 |
"TARGET_NEON" |
| 2244 |
{ |
| 2245 |
if (ARM_HAVE_NEON_<MODE>_ARITH) |
| 2246 |
emit_insn (gen_sub<mode>3 (operands[0], operands[1], operands[2])); |
| 2247 |
else |
| 2248 |
emit_insn (gen_neon_vsub<mode>_unspec (operands[0], operands[1], |
| 2249 |
operands[2])); |
| 2250 |
DONE; |
| 2251 |
}) |
| 2252 |
|
| 2253 |
; Used for intrinsics when flag_unsafe_math_optimizations is false. |
| 2254 |
|
| 2255 |
(define_insn "neon_vsub<mode>_unspec" |
| 2256 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2257 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2258 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2259 |
UNSPEC_VSUB))] |
| 2260 |
"TARGET_NEON" |
| 2261 |
"vsub.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2262 |
[(set (attr "type") |
| 2263 |
(if_then_else (match_test "<Is_float_mode>") |
| 2264 |
(const_string "neon_fp_addsub_s<q>") |
| 2265 |
(const_string "neon_sub<q>")))] |
| 2266 |
) |
| 2267 |
|
| 2268 |
(define_insn "neon_vsubl<sup><mode>" |
| 2269 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2270 |
(unspec:<V_widen> [(match_operand:VDI 1 "s_register_operand" "w") |
| 2271 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 2272 |
VSUBL))] |
| 2273 |
"TARGET_NEON" |
| 2274 |
"vsubl.<sup>%#<V_sz_elem>\t%q0, %P1, %P2" |
| 2275 |
[(set_attr "type" "neon_sub_long")] |
| 2276 |
) |
| 2277 |
|
| 2278 |
(define_insn "neon_vsubw<sup><mode>" |
| 2279 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2280 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "w") |
| 2281 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 2282 |
VSUBW))] |
| 2283 |
"TARGET_NEON" |
| 2284 |
"vsubw.<sup>%#<V_sz_elem>\t%q0, %q1, %P2" |
| 2285 |
[(set_attr "type" "neon_sub_widen")] |
| 2286 |
) |
| 2287 |
|
| 2288 |
(define_insn "neon_vqsub<sup><mode>" |
| 2289 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 2290 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 2291 |
(match_operand:VDQIX 2 "s_register_operand" "w")] |
| 2292 |
VQSUB))] |
| 2293 |
"TARGET_NEON" |
| 2294 |
"vqsub.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2295 |
[(set_attr "type" "neon_qsub<q>")] |
| 2296 |
) |
| 2297 |
|
| 2298 |
(define_insn "neon_vhsub<sup><mode>" |
| 2299 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2300 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") |
| 2301 |
(match_operand:VDQIW 2 "s_register_operand" "w")] |
| 2302 |
VHSUB))] |
| 2303 |
"TARGET_NEON" |
| 2304 |
"vhsub.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2305 |
[(set_attr "type" "neon_sub_halve<q>")] |
| 2306 |
) |
| 2307 |
|
| 2308 |
(define_insn "neon_v<r>subhn<mode>" |
| 2309 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 2310 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w") |
| 2311 |
(match_operand:VN 2 "s_register_operand" "w")] |
| 2312 |
VSUBHN))] |
| 2313 |
"TARGET_NEON" |
| 2314 |
"v<r>subhn.<V_if_elem>\t%P0, %q1, %q2" |
| 2315 |
[(set_attr "type" "neon_sub_halve_narrow_q")] |
| 2316 |
) |
| 2317 |
|
| 2318 |
;; These may expand to an UNSPEC pattern when a floating point mode is used |
| 2319 |
;; without unsafe math optimizations. |
| 2320 |
(define_expand "@neon_vc<cmp_op><mode>" |
| 2321 |
[(match_operand:<V_cmp_result> 0 "s_register_operand") |
| 2322 |
(neg:<V_cmp_result> |
| 2323 |
(COMPARISONS:VDQW (match_operand:VDQW 1 "s_register_operand") |
| 2324 |
(match_operand:VDQW 2 "reg_or_zero_operand")))] |
| 2325 |
"TARGET_NEON" |
| 2326 |
{ |
| 2327 |
/* For FP comparisons use UNSPECS unless -funsafe-math-optimizations |
| 2328 |
are enabled. */ |
| 2329 |
if (GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2330 |
&& !flag_unsafe_math_optimizations) |
| 2331 |
{ |
| 2332 |
/* We don't just emit a gen_neon_vc<cmp_op><mode>_insn_unspec because |
| 2333 |
we define gen_neon_vceq<mode>_insn_unspec only for float modes |
| 2334 |
whereas this expander iterates over the integer modes as well, |
| 2335 |
but we will never expand to UNSPECs for the integer comparisons. */ |
| 2336 |
switch (<MODE>mode) |
| 2337 |
{ |
| 2338 |
case E_V2SFmode: |
| 2339 |
emit_insn (gen_neon_vc<cmp_op>v2sf_insn_unspec (operands[0], |
| 2340 |
operands[1], |
| 2341 |
operands[2])); |
| 2342 |
break; |
| 2343 |
case E_V4SFmode: |
| 2344 |
emit_insn (gen_neon_vc<cmp_op>v4sf_insn_unspec (operands[0], |
| 2345 |
operands[1], |
| 2346 |
operands[2])); |
| 2347 |
break; |
| 2348 |
default: |
| 2349 |
gcc_unreachable (); |
| 2350 |
} |
| 2351 |
} |
| 2352 |
else |
| 2353 |
emit_insn (gen_neon_vc<cmp_op><mode>_insn (operands[0], |
| 2354 |
operands[1], |
| 2355 |
operands[2])); |
| 2356 |
DONE; |
| 2357 |
} |
| 2358 |
) |
| 2359 |
|
| 2360 |
(define_insn "@neon_vc<cmp_op><mode>_insn" |
| 2361 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w") |
| 2362 |
(neg:<V_cmp_result> |
| 2363 |
(COMPARISONS:<V_cmp_result> |
| 2364 |
(match_operand:VDQW 1 "s_register_operand" "w,w") |
| 2365 |
(match_operand:VDQW 2 "reg_or_zero_operand" "w,Dz"))))] |
| 2366 |
"TARGET_NEON && !(GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2367 |
&& !flag_unsafe_math_optimizations)" |
| 2368 |
{ |
| 2369 |
char pattern[100]; |
| 2370 |
sprintf (pattern, "vc<cmp_op>.%s%%#<V_sz_elem>\t%%<V_reg>0," |
| 2371 |
" %%<V_reg>1, %s", |
| 2372 |
GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2373 |
? "f" : "<cmp_type>", |
| 2374 |
which_alternative == 0 |
| 2375 |
? "%<V_reg>2" : "#0"); |
| 2376 |
output_asm_insn (pattern, operands); |
| 2377 |
return ""; |
| 2378 |
} |
| 2379 |
[(set (attr "type") |
| 2380 |
(if_then_else (match_operand 2 "zero_operand") |
| 2381 |
(const_string "neon_compare_zero<q>") |
| 2382 |
(const_string "neon_compare<q>")))] |
| 2383 |
) |
| 2384 |
|
| 2385 |
(define_insn "neon_vc<cmp_op_unsp><mode>_insn_unspec" |
| 2386 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w") |
| 2387 |
(unspec:<V_cmp_result> |
| 2388 |
[(match_operand:VCVTF 1 "s_register_operand" "w,w") |
| 2389 |
(match_operand:VCVTF 2 "reg_or_zero_operand" "w,Dz")] |
| 2390 |
NEON_VCMP))] |
| 2391 |
"TARGET_NEON" |
| 2392 |
{ |
| 2393 |
char pattern[100]; |
| 2394 |
sprintf (pattern, "vc<cmp_op_unsp>.f%%#<V_sz_elem>\t%%<V_reg>0," |
| 2395 |
" %%<V_reg>1, %s", |
| 2396 |
which_alternative == 0 |
| 2397 |
? "%<V_reg>2" : "#0"); |
| 2398 |
output_asm_insn (pattern, operands); |
| 2399 |
return ""; |
| 2400 |
} |
| 2401 |
[(set_attr "type" "neon_fp_compare_s<q>")] |
| 2402 |
) |
| 2403 |
|
| 2404 |
(define_expand "@neon_vc<cmp_op><mode>" |
| 2405 |
[(match_operand:<V_cmp_result> 0 "s_register_operand") |
| 2406 |
(neg:<V_cmp_result> |
| 2407 |
(COMPARISONS:VH |
| 2408 |
(match_operand:VH 1 "s_register_operand") |
| 2409 |
(match_operand:VH 2 "reg_or_zero_operand")))] |
| 2410 |
"TARGET_NEON_FP16INST" |
| 2411 |
{ |
| 2412 |
/* For FP comparisons use UNSPECS unless -funsafe-math-optimizations |
| 2413 |
are enabled. */ |
| 2414 |
if (GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2415 |
&& !flag_unsafe_math_optimizations) |
| 2416 |
emit_insn |
| 2417 |
(gen_neon_vc<cmp_op><mode>_fp16insn_unspec |
| 2418 |
(operands[0], operands[1], operands[2])); |
| 2419 |
else |
| 2420 |
emit_insn |
| 2421 |
(gen_neon_vc<cmp_op><mode>_fp16insn |
| 2422 |
(operands[0], operands[1], operands[2])); |
| 2423 |
DONE; |
| 2424 |
}) |
| 2425 |
|
| 2426 |
(define_insn "neon_vc<cmp_op><mode>_fp16insn" |
| 2427 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w") |
| 2428 |
(neg:<V_cmp_result> |
| 2429 |
(COMPARISONS:<V_cmp_result> |
| 2430 |
(match_operand:VH 1 "s_register_operand" "w,w") |
| 2431 |
(match_operand:VH 2 "reg_or_zero_operand" "w,Dz"))))] |
| 2432 |
"TARGET_NEON_FP16INST |
| 2433 |
&& !(GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2434 |
&& !flag_unsafe_math_optimizations)" |
| 2435 |
{ |
| 2436 |
char pattern[100]; |
| 2437 |
sprintf (pattern, "vc<cmp_op>.%s%%#<V_sz_elem>\t%%<V_reg>0," |
| 2438 |
" %%<V_reg>1, %s", |
| 2439 |
GET_MODE_CLASS (<MODE>mode) == MODE_VECTOR_FLOAT |
| 2440 |
? "f" : "<cmp_type>", |
| 2441 |
which_alternative == 0 |
| 2442 |
? "%<V_reg>2" : "#0"); |
| 2443 |
output_asm_insn (pattern, operands); |
| 2444 |
return ""; |
| 2445 |
} |
| 2446 |
[(set (attr "type") |
| 2447 |
(if_then_else (match_operand 2 "zero_operand") |
| 2448 |
(const_string "neon_compare_zero<q>") |
| 2449 |
(const_string "neon_compare<q>")))]) |
| 2450 |
|
| 2451 |
(define_insn "neon_vc<cmp_op_unsp><mode>_fp16insn_unspec" |
| 2452 |
[(set |
| 2453 |
(match_operand:<V_cmp_result> 0 "s_register_operand" "=w,w") |
| 2454 |
(unspec:<V_cmp_result> |
| 2455 |
[(match_operand:VH 1 "s_register_operand" "w,w") |
| 2456 |
(match_operand:VH 2 "reg_or_zero_operand" "w,Dz")] |
| 2457 |
NEON_VCMP))] |
| 2458 |
"TARGET_NEON_FP16INST" |
| 2459 |
{ |
| 2460 |
char pattern[100]; |
| 2461 |
sprintf (pattern, "vc<cmp_op_unsp>.f%%#<V_sz_elem>\t%%<V_reg>0," |
| 2462 |
" %%<V_reg>1, %s", |
| 2463 |
which_alternative == 0 |
| 2464 |
? "%<V_reg>2" : "#0"); |
| 2465 |
output_asm_insn (pattern, operands); |
| 2466 |
return ""; |
| 2467 |
} |
| 2468 |
[(set_attr "type" "neon_fp_compare_s<q>")]) |
| 2469 |
|
| 2470 |
(define_insn "@neon_vc<code><mode>" |
| 2471 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w") |
| 2472 |
(neg:<V_cmp_result> |
| 2473 |
(GTUGEU:<V_cmp_result> |
| 2474 |
(match_operand:VDQIW 1 "s_register_operand" "w") |
| 2475 |
(match_operand:VDQIW 2 "s_register_operand" "w"))))] |
| 2476 |
"TARGET_NEON" |
| 2477 |
"vc<cmp_op>.u%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2478 |
[(set_attr "type" "neon_compare<q>")] |
| 2479 |
) |
| 2480 |
|
| 2481 |
(define_expand "neon_vca<cmp_op><mode>" |
| 2482 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand") |
| 2483 |
(neg:<V_cmp_result> |
| 2484 |
(GLTE:<V_cmp_result> |
| 2485 |
(abs:VCVTF (match_operand:VCVTF 1 "s_register_operand")) |
| 2486 |
(abs:VCVTF (match_operand:VCVTF 2 "s_register_operand")))))] |
| 2487 |
"TARGET_NEON" |
| 2488 |
{ |
| 2489 |
if (flag_unsafe_math_optimizations) |
| 2490 |
emit_insn (gen_neon_vca<cmp_op><mode>_insn (operands[0], operands[1], |
| 2491 |
operands[2])); |
| 2492 |
else |
| 2493 |
emit_insn (gen_neon_vca<cmp_op><mode>_insn_unspec (operands[0], |
| 2494 |
operands[1], |
| 2495 |
operands[2])); |
| 2496 |
DONE; |
| 2497 |
} |
| 2498 |
) |
| 2499 |
|
| 2500 |
(define_insn "neon_vca<cmp_op><mode>_insn" |
| 2501 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w") |
| 2502 |
(neg:<V_cmp_result> |
| 2503 |
(GLTE:<V_cmp_result> |
| 2504 |
(abs:VCVTF (match_operand:VCVTF 1 "s_register_operand" "w")) |
| 2505 |
(abs:VCVTF (match_operand:VCVTF 2 "s_register_operand" "w")))))] |
| 2506 |
"TARGET_NEON && flag_unsafe_math_optimizations" |
| 2507 |
"vac<cmp_op>.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2508 |
[(set_attr "type" "neon_fp_compare_s<q>")] |
| 2509 |
) |
| 2510 |
|
| 2511 |
(define_insn "neon_vca<cmp_op_unsp><mode>_insn_unspec" |
| 2512 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w") |
| 2513 |
(unspec:<V_cmp_result> [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2514 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2515 |
NEON_VAGLTE))] |
| 2516 |
"TARGET_NEON" |
| 2517 |
"vac<cmp_op_unsp>.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2518 |
[(set_attr "type" "neon_fp_compare_s<q>")] |
| 2519 |
) |
| 2520 |
|
| 2521 |
(define_expand "neon_vca<cmp_op><mode>" |
| 2522 |
[(set |
| 2523 |
(match_operand:<V_cmp_result> 0 "s_register_operand") |
| 2524 |
(neg:<V_cmp_result> |
| 2525 |
(GLTE:<V_cmp_result> |
| 2526 |
(abs:VH (match_operand:VH 1 "s_register_operand")) |
| 2527 |
(abs:VH (match_operand:VH 2 "s_register_operand")))))] |
| 2528 |
"TARGET_NEON_FP16INST" |
| 2529 |
{ |
| 2530 |
if (flag_unsafe_math_optimizations) |
| 2531 |
emit_insn (gen_neon_vca<cmp_op><mode>_fp16insn |
| 2532 |
(operands[0], operands[1], operands[2])); |
| 2533 |
else |
| 2534 |
emit_insn (gen_neon_vca<cmp_op><mode>_fp16insn_unspec |
| 2535 |
(operands[0], operands[1], operands[2])); |
| 2536 |
DONE; |
| 2537 |
}) |
| 2538 |
|
| 2539 |
(define_insn "neon_vca<cmp_op><mode>_fp16insn" |
| 2540 |
[(set |
| 2541 |
(match_operand:<V_cmp_result> 0 "s_register_operand" "=w") |
| 2542 |
(neg:<V_cmp_result> |
| 2543 |
(GLTE:<V_cmp_result> |
| 2544 |
(abs:VH (match_operand:VH 1 "s_register_operand" "w")) |
| 2545 |
(abs:VH (match_operand:VH 2 "s_register_operand" "w")))))] |
| 2546 |
"TARGET_NEON_FP16INST && flag_unsafe_math_optimizations" |
| 2547 |
"vac<cmp_op>.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2548 |
[(set_attr "type" "neon_fp_compare_s<q>")] |
| 2549 |
) |
| 2550 |
|
| 2551 |
(define_insn "neon_vca<cmp_op_unsp><mode>_fp16insn_unspec" |
| 2552 |
[(set (match_operand:<V_cmp_result> 0 "s_register_operand" "=w") |
| 2553 |
(unspec:<V_cmp_result> |
| 2554 |
[(match_operand:VH 1 "s_register_operand" "w") |
| 2555 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2556 |
NEON_VAGLTE))] |
| 2557 |
"TARGET_NEON" |
| 2558 |
"vac<cmp_op_unsp>.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2559 |
[(set_attr "type" "neon_fp_compare_s<q>")] |
| 2560 |
) |
| 2561 |
|
| 2562 |
(define_expand "neon_vc<cmp_op>z<mode>" |
| 2563 |
[(set |
| 2564 |
(match_operand:<V_cmp_result> 0 "s_register_operand") |
| 2565 |
(COMPARISONS:<V_cmp_result> |
| 2566 |
(match_operand:VH 1 "s_register_operand") |
| 2567 |
(const_int 0)))] |
| 2568 |
"TARGET_NEON_FP16INST" |
| 2569 |
{ |
| 2570 |
emit_insn (gen_neon_vc<cmp_op><mode> (operands[0], operands[1], |
| 2571 |
CONST0_RTX (<MODE>mode))); |
| 2572 |
DONE; |
| 2573 |
}) |
| 2574 |
|
| 2575 |
(define_insn "neon_vtst_combine<mode>" |
| 2576 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2577 |
(plus:VDQIW |
| 2578 |
(eq:VDQIW |
| 2579 |
(and:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w") |
| 2580 |
(match_operand:VDQIW 2 "s_register_operand" "w")) |
| 2581 |
(match_operand:VDQIW 3 "zero_operand" "i")) |
| 2582 |
(match_operand:VDQIW 4 "minus_one_operand" "i")))] |
| 2583 |
"TARGET_NEON" |
| 2584 |
"vtst.<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2585 |
[(set_attr "type" "neon_tst<q>")] |
| 2586 |
) |
| 2587 |
|
| 2588 |
(define_insn "neon_vabd<sup><mode>" |
| 2589 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2590 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") |
| 2591 |
(match_operand:VDQIW 2 "s_register_operand" "w")] |
| 2592 |
VABD))] |
| 2593 |
"TARGET_NEON" |
| 2594 |
"vabd.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2595 |
[(set_attr "type" "neon_abd<q>")] |
| 2596 |
) |
| 2597 |
|
| 2598 |
(define_insn "neon_vabd<mode>" |
| 2599 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 2600 |
(unspec:VH [(match_operand:VH 1 "s_register_operand" "w") |
| 2601 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2602 |
UNSPEC_VABD_F))] |
| 2603 |
"TARGET_NEON_FP16INST" |
| 2604 |
"vabd.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2605 |
[(set_attr "type" "neon_abd<q>")] |
| 2606 |
) |
| 2607 |
|
| 2608 |
(define_insn "neon_vabdf<mode>" |
| 2609 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2610 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2611 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2612 |
UNSPEC_VABD_F))] |
| 2613 |
"TARGET_NEON" |
| 2614 |
"vabd.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2615 |
[(set_attr "type" "neon_fp_abd_s<q>")] |
| 2616 |
) |
| 2617 |
|
| 2618 |
(define_insn "neon_vabdl<sup><mode>" |
| 2619 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2620 |
(unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w") |
| 2621 |
(match_operand:VW 2 "s_register_operand" "w")] |
| 2622 |
VABDL))] |
| 2623 |
"TARGET_NEON" |
| 2624 |
"vabdl.<sup>%#<V_sz_elem>\t%q0, %P1, %P2" |
| 2625 |
[(set_attr "type" "neon_abd_long")] |
| 2626 |
) |
| 2627 |
|
| 2628 |
(define_insn "neon_vaba<sup><mode>" |
| 2629 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2630 |
(plus:VDQIW (unspec:VDQIW [(match_operand:VDQIW 2 "s_register_operand" "w") |
| 2631 |
(match_operand:VDQIW 3 "s_register_operand" "w")] |
| 2632 |
VABD) |
| 2633 |
(match_operand:VDQIW 1 "s_register_operand" "0")))] |
| 2634 |
"TARGET_NEON" |
| 2635 |
"vaba.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 2636 |
[(set_attr "type" "neon_arith_acc<q>")] |
| 2637 |
) |
| 2638 |
|
| 2639 |
(define_insn "neon_vabal<sup><mode>" |
| 2640 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 2641 |
(plus:<V_widen> (unspec:<V_widen> [(match_operand:VW 2 "s_register_operand" "w") |
| 2642 |
(match_operand:VW 3 "s_register_operand" "w")] |
| 2643 |
VABDL) |
| 2644 |
(match_operand:<V_widen> 1 "s_register_operand" "0")))] |
| 2645 |
"TARGET_NEON" |
| 2646 |
"vabal.<sup>%#<V_sz_elem>\t%q0, %P2, %P3" |
| 2647 |
[(set_attr "type" "neon_arith_acc<q>")] |
| 2648 |
) |
| 2649 |
|
| 2650 |
(define_expand "<sup>sadv16qi" |
| 2651 |
[(use (match_operand:V4SI 0 "register_operand")) |
| 2652 |
(unspec:V16QI [(use (match_operand:V16QI 1 "register_operand")) |
| 2653 |
(use (match_operand:V16QI 2 "register_operand"))] VABAL) |
| 2654 |
(use (match_operand:V4SI 3 "register_operand"))] |
| 2655 |
"TARGET_NEON" |
| 2656 |
{ |
| 2657 |
rtx reduc = gen_reg_rtx (V8HImode); |
| 2658 |
rtx op1_highpart = gen_reg_rtx (V8QImode); |
| 2659 |
rtx op2_highpart = gen_reg_rtx (V8QImode); |
| 2660 |
|
| 2661 |
emit_insn (gen_neon_vabdl<sup>v8qi (reduc, |
| 2662 |
gen_lowpart (V8QImode, operands[1]), |
| 2663 |
gen_lowpart (V8QImode, operands[2]))); |
| 2664 |
|
| 2665 |
emit_insn (gen_neon_vget_highv16qi (op1_highpart, operands[1])); |
| 2666 |
emit_insn (gen_neon_vget_highv16qi (op2_highpart, operands[2])); |
| 2667 |
emit_insn (gen_neon_vabal<sup>v8qi (reduc, reduc, |
| 2668 |
op1_highpart, op2_highpart)); |
| 2669 |
emit_insn (gen_neon_vpadal<sup>v8hi (operands[3], operands[3], reduc)); |
| 2670 |
|
| 2671 |
emit_move_insn (operands[0], operands[3]); |
| 2672 |
DONE; |
| 2673 |
} |
| 2674 |
) |
| 2675 |
|
| 2676 |
(define_insn "neon_v<maxmin><sup><mode>" |
| 2677 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2678 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w") |
| 2679 |
(match_operand:VDQIW 2 "s_register_operand" "w")] |
| 2680 |
VMAXMIN))] |
| 2681 |
"TARGET_NEON" |
| 2682 |
"v<maxmin>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2683 |
[(set_attr "type" "neon_minmax<q>")] |
| 2684 |
) |
| 2685 |
|
| 2686 |
(define_insn "neon_v<maxmin>f<mode>" |
| 2687 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2688 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2689 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2690 |
VMAXMINF))] |
| 2691 |
"TARGET_NEON" |
| 2692 |
"v<maxmin>.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2693 |
[(set_attr "type" "neon_fp_minmax_s<q>")] |
| 2694 |
) |
| 2695 |
|
| 2696 |
(define_insn "neon_v<maxmin>f<mode>" |
| 2697 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 2698 |
(unspec:VH |
| 2699 |
[(match_operand:VH 1 "s_register_operand" "w") |
| 2700 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2701 |
VMAXMINF))] |
| 2702 |
"TARGET_NEON_FP16INST" |
| 2703 |
"v<maxmin>.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2704 |
[(set_attr "type" "neon_fp_minmax_s<q>")] |
| 2705 |
) |
| 2706 |
|
| 2707 |
(define_insn "neon_vp<maxmin>fv4hf" |
| 2708 |
[(set (match_operand:V4HF 0 "s_register_operand" "=w") |
| 2709 |
(unspec:V4HF |
| 2710 |
[(match_operand:V4HF 1 "s_register_operand" "w") |
| 2711 |
(match_operand:V4HF 2 "s_register_operand" "w")] |
| 2712 |
VPMAXMINF))] |
| 2713 |
"TARGET_NEON_FP16INST" |
| 2714 |
"vp<maxmin>.f16\t%P0, %P1, %P2" |
| 2715 |
[(set_attr "type" "neon_reduc_minmax")] |
| 2716 |
) |
| 2717 |
|
| 2718 |
(define_insn "neon_<fmaxmin_op><mode>" |
| 2719 |
[(set |
| 2720 |
(match_operand:VH 0 "s_register_operand" "=w") |
| 2721 |
(unspec:VH |
| 2722 |
[(match_operand:VH 1 "s_register_operand" "w") |
| 2723 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2724 |
VMAXMINFNM))] |
| 2725 |
"TARGET_NEON_FP16INST" |
| 2726 |
"<fmaxmin_op>.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2727 |
[(set_attr "type" "neon_fp_minmax_s<q>")] |
| 2728 |
) |
| 2729 |
|
| 2730 |
;; v<maxmin>nm intrinsics. |
| 2731 |
(define_insn "neon_<fmaxmin_op><mode>" |
| 2732 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2733 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2734 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2735 |
VMAXMINFNM))] |
| 2736 |
"TARGET_NEON && TARGET_VFP5" |
| 2737 |
"<fmaxmin_op>.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2738 |
[(set_attr "type" "neon_fp_minmax_s<q>")] |
| 2739 |
) |
| 2740 |
|
| 2741 |
(define_expand "neon_vpadd<mode>" |
| 2742 |
[(match_operand:VD 0 "s_register_operand") |
| 2743 |
(match_operand:VD 1 "s_register_operand") |
| 2744 |
(match_operand:VD 2 "s_register_operand")] |
| 2745 |
"TARGET_NEON" |
| 2746 |
{ |
| 2747 |
emit_insn (gen_neon_vpadd_internal<mode> (operands[0], operands[1], |
| 2748 |
operands[2])); |
| 2749 |
DONE; |
| 2750 |
}) |
| 2751 |
|
| 2752 |
(define_insn "neon_vpaddl<sup><mode>" |
| 2753 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 2754 |
(unspec:<V_double_width> [(match_operand:VDQIW 1 "s_register_operand" "w")] |
| 2755 |
VPADDL))] |
| 2756 |
"TARGET_NEON" |
| 2757 |
"vpaddl.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1" |
| 2758 |
[(set_attr "type" "neon_reduc_add_long")] |
| 2759 |
) |
| 2760 |
|
| 2761 |
(define_insn "neon_vpadal<sup><mode>" |
| 2762 |
[(set (match_operand:<V_double_width> 0 "s_register_operand" "=w") |
| 2763 |
(unspec:<V_double_width> [(match_operand:<V_double_width> 1 "s_register_operand" "0") |
| 2764 |
(match_operand:VDQIW 2 "s_register_operand" "w")] |
| 2765 |
VPADAL))] |
| 2766 |
"TARGET_NEON" |
| 2767 |
"vpadal.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2" |
| 2768 |
[(set_attr "type" "neon_reduc_add_acc")] |
| 2769 |
) |
| 2770 |
|
| 2771 |
(define_insn "neon_vp<maxmin><sup><mode>" |
| 2772 |
[(set (match_operand:VDI 0 "s_register_operand" "=w") |
| 2773 |
(unspec:VDI [(match_operand:VDI 1 "s_register_operand" "w") |
| 2774 |
(match_operand:VDI 2 "s_register_operand" "w")] |
| 2775 |
VPMAXMIN))] |
| 2776 |
"TARGET_NEON" |
| 2777 |
"vp<maxmin>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2778 |
[(set_attr "type" "neon_reduc_minmax<q>")] |
| 2779 |
) |
| 2780 |
|
| 2781 |
(define_insn "neon_vp<maxmin>f<mode>" |
| 2782 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2783 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2784 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2785 |
VPMAXMINF))] |
| 2786 |
"TARGET_NEON" |
| 2787 |
"vp<maxmin>.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2788 |
[(set_attr "type" "neon_fp_reduc_minmax_s<q>")] |
| 2789 |
) |
| 2790 |
|
| 2791 |
(define_insn "neon_vrecps<mode>" |
| 2792 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2793 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2794 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2795 |
UNSPEC_VRECPS))] |
| 2796 |
"TARGET_NEON" |
| 2797 |
"vrecps.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2798 |
[(set_attr "type" "neon_fp_recps_s<q>")] |
| 2799 |
) |
| 2800 |
|
| 2801 |
(define_insn "neon_vrecps<mode>" |
| 2802 |
[(set |
| 2803 |
(match_operand:VH 0 "s_register_operand" "=w") |
| 2804 |
(unspec:VH [(match_operand:VH 1 "s_register_operand" "w") |
| 2805 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2806 |
UNSPEC_VRECPS))] |
| 2807 |
"TARGET_NEON_FP16INST" |
| 2808 |
"vrecps.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2809 |
[(set_attr "type" "neon_fp_recps_s<q>")] |
| 2810 |
) |
| 2811 |
|
| 2812 |
(define_insn "neon_vrsqrts<mode>" |
| 2813 |
[(set (match_operand:VCVTF 0 "s_register_operand" "=w") |
| 2814 |
(unspec:VCVTF [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 2815 |
(match_operand:VCVTF 2 "s_register_operand" "w")] |
| 2816 |
UNSPEC_VRSQRTS))] |
| 2817 |
"TARGET_NEON" |
| 2818 |
"vrsqrts.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2819 |
[(set_attr "type" "neon_fp_rsqrts_s<q>")] |
| 2820 |
) |
| 2821 |
|
| 2822 |
(define_insn "neon_vrsqrts<mode>" |
| 2823 |
[(set |
| 2824 |
(match_operand:VH 0 "s_register_operand" "=w") |
| 2825 |
(unspec:VH [(match_operand:VH 1 "s_register_operand" "w") |
| 2826 |
(match_operand:VH 2 "s_register_operand" "w")] |
| 2827 |
UNSPEC_VRSQRTS))] |
| 2828 |
"TARGET_NEON_FP16INST" |
| 2829 |
"vrsqrts.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2830 |
[(set_attr "type" "neon_fp_rsqrts_s<q>")] |
| 2831 |
) |
| 2832 |
|
| 2833 |
(define_expand "neon_vabs<mode>" |
| 2834 |
[(match_operand:VDQW 0 "s_register_operand") |
| 2835 |
(match_operand:VDQW 1 "s_register_operand")] |
| 2836 |
"TARGET_NEON" |
| 2837 |
{ |
| 2838 |
emit_insn (gen_abs<mode>2 (operands[0], operands[1])); |
| 2839 |
DONE; |
| 2840 |
}) |
| 2841 |
|
| 2842 |
(define_insn "neon_vqabs<mode>" |
| 2843 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 2844 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")] |
| 2845 |
UNSPEC_VQABS))] |
| 2846 |
"TARGET_NEON" |
| 2847 |
"vqabs.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 2848 |
[(set_attr "type" "neon_qabs<q>")] |
| 2849 |
) |
| 2850 |
|
| 2851 |
(define_insn "neon_bswap<mode>" |
| 2852 |
[(set (match_operand:VDQHSD 0 "register_operand" "=w") |
| 2853 |
(bswap:VDQHSD (match_operand:VDQHSD 1 "register_operand" "w")))] |
| 2854 |
"TARGET_NEON" |
| 2855 |
"vrev<V_sz_elem>.8\\t%<V_reg>0, %<V_reg>1" |
| 2856 |
[(set_attr "type" "neon_rev<q>")] |
| 2857 |
) |
| 2858 |
|
| 2859 |
(define_expand "neon_vneg<mode>" |
| 2860 |
[(match_operand:VDQW 0 "s_register_operand") |
| 2861 |
(match_operand:VDQW 1 "s_register_operand")] |
| 2862 |
"TARGET_NEON" |
| 2863 |
{ |
| 2864 |
emit_insn (gen_neon_neg<mode>2 (operands[0], operands[1])); |
| 2865 |
DONE; |
| 2866 |
}) |
| 2867 |
|
| 2868 |
|
| 2869 |
;; The vcadd and vcmla patterns are made UNSPEC for the explicitly due to the |
| 2870 |
;; fact that their usage need to guarantee that the source vectors are |
| 2871 |
;; contiguous. It would be wrong to describe the operation without being able |
| 2872 |
;; to describe the permute that is also required, but even if that is done |
| 2873 |
;; the permute would have been created as a LOAD_LANES which means the values |
| 2874 |
;; in the registers are in the wrong order. |
| 2875 |
(define_insn "neon_vcadd<rot><mode>" |
| 2876 |
[(set (match_operand:VF 0 "register_operand" "=w") |
| 2877 |
(unspec:VF [(match_operand:VF 1 "register_operand" "w") |
| 2878 |
(match_operand:VF 2 "register_operand" "w")] |
| 2879 |
VCADD))] |
| 2880 |
"TARGET_COMPLEX" |
| 2881 |
"vcadd.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2, #<rot>" |
| 2882 |
[(set_attr "type" "neon_fcadd")] |
| 2883 |
) |
| 2884 |
|
| 2885 |
(define_insn "neon_vcmla<rot><mode>" |
| 2886 |
[(set (match_operand:VF 0 "register_operand" "=w") |
| 2887 |
(plus:VF (match_operand:VF 1 "register_operand" "0") |
| 2888 |
(unspec:VF [(match_operand:VF 2 "register_operand" "w") |
| 2889 |
(match_operand:VF 3 "register_operand" "w")] |
| 2890 |
VCMLA)))] |
| 2891 |
"TARGET_COMPLEX" |
| 2892 |
"vcmla.<V_s_elem>\t%<V_reg>0, %<V_reg>2, %<V_reg>3, #<rot>" |
| 2893 |
[(set_attr "type" "neon_fcmla")] |
| 2894 |
) |
| 2895 |
|
| 2896 |
(define_insn "neon_vcmla_lane<rot><mode>" |
| 2897 |
[(set (match_operand:VF 0 "s_register_operand" "=w") |
| 2898 |
(plus:VF (match_operand:VF 1 "s_register_operand" "0") |
| 2899 |
(unspec:VF [(match_operand:VF 2 "s_register_operand" "w") |
| 2900 |
(match_operand:VF 3 "s_register_operand" "<VF_constraint>") |
| 2901 |
(match_operand:SI 4 "const_int_operand" "n")] |
| 2902 |
VCMLA)))] |
| 2903 |
"TARGET_COMPLEX" |
| 2904 |
{ |
| 2905 |
operands = neon_vcmla_lane_prepare_operands (operands); |
| 2906 |
return "vcmla.<V_s_elem>\t%<V_reg>0, %<V_reg>2, d%c3[%c4], #<rot>"; |
| 2907 |
} |
| 2908 |
[(set_attr "type" "neon_fcmla")] |
| 2909 |
) |
| 2910 |
|
| 2911 |
(define_insn "neon_vcmla_laneq<rot><mode>" |
| 2912 |
[(set (match_operand:VDF 0 "s_register_operand" "=w") |
| 2913 |
(plus:VDF (match_operand:VDF 1 "s_register_operand" "0") |
| 2914 |
(unspec:VDF [(match_operand:VDF 2 "s_register_operand" "w") |
| 2915 |
(match_operand:<V_DOUBLE> 3 "s_register_operand" "<VF_constraint>") |
| 2916 |
(match_operand:SI 4 "const_int_operand" "n")] |
| 2917 |
VCMLA)))] |
| 2918 |
"TARGET_COMPLEX" |
| 2919 |
{ |
| 2920 |
operands = neon_vcmla_lane_prepare_operands (operands); |
| 2921 |
return "vcmla.<V_s_elem>\t%<V_reg>0, %<V_reg>2, d%c3[%c4], #<rot>"; |
| 2922 |
} |
| 2923 |
[(set_attr "type" "neon_fcmla")] |
| 2924 |
) |
| 2925 |
|
| 2926 |
(define_insn "neon_vcmlaq_lane<rot><mode>" |
| 2927 |
[(set (match_operand:VQ_HSF 0 "s_register_operand" "=w") |
| 2928 |
(plus:VQ_HSF (match_operand:VQ_HSF 1 "s_register_operand" "0") |
| 2929 |
(unspec:VQ_HSF [(match_operand:VQ_HSF 2 "s_register_operand" "w") |
| 2930 |
(match_operand:<V_HALF> 3 "s_register_operand" "<VF_constraint>") |
| 2931 |
(match_operand:SI 4 "const_int_operand" "n")] |
| 2932 |
VCMLA)))] |
| 2933 |
"TARGET_COMPLEX" |
| 2934 |
{ |
| 2935 |
operands = neon_vcmla_lane_prepare_operands (operands); |
| 2936 |
return "vcmla.<V_s_elem>\t%<V_reg>0, %<V_reg>2, d%c3[%c4], #<rot>"; |
| 2937 |
} |
| 2938 |
[(set_attr "type" "neon_fcmla")] |
| 2939 |
) |
| 2940 |
|
| 2941 |
;; The complex mul operations always need to expand to two instructions. |
| 2942 |
;; The first operation does half the computation and the second does the |
| 2943 |
;; remainder. Because of this, expand early. |
| 2944 |
(define_expand "cmul<conj_op><mode>3" |
| 2945 |
[(set (match_operand:VDF 0 "register_operand") |
| 2946 |
(unspec:VDF [(match_operand:VDF 1 "register_operand") |
| 2947 |
(match_operand:VDF 2 "register_operand")] |
| 2948 |
VCMUL_OP))] |
| 2949 |
"TARGET_COMPLEX && !BYTES_BIG_ENDIAN" |
| 2950 |
{ |
| 2951 |
rtx res1 = gen_reg_rtx (<MODE>mode); |
| 2952 |
rtx tmp = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode)); |
| 2953 |
emit_insn (gen_neon_vcmla<rotsplit1><mode> (res1, tmp, |
| 2954 |
operands[2], operands[1])); |
| 2955 |
emit_insn (gen_neon_vcmla<rotsplit2><mode> (operands[0], res1, |
| 2956 |
operands[2], operands[1])); |
| 2957 |
DONE; |
| 2958 |
}) |
| 2959 |
|
| 2960 |
|
| 2961 |
;; These map to the auto-vectorizer Dot Product optab. |
| 2962 |
;; The auto-vectorizer expects a dot product builtin that also does an |
| 2963 |
;; accumulation into the provided register. |
| 2964 |
;; Given the following pattern |
| 2965 |
;; |
| 2966 |
;; for (i=0; i<len; i++) { |
| 2967 |
;; c = a[i] * b[i]; |
| 2968 |
;; r += c; |
| 2969 |
;; } |
| 2970 |
;; return result; |
| 2971 |
;; |
| 2972 |
;; This can be auto-vectorized to |
| 2973 |
;; r = a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3]; |
| 2974 |
;; |
| 2975 |
;; given enough iterations. However the vectorizer can keep unrolling the loop |
| 2976 |
;; r += a[4]*b[4] + a[5]*b[5] + a[6]*b[6] + a[7]*b[7]; |
| 2977 |
;; r += a[8]*b[8] + a[9]*b[9] + a[10]*b[10] + a[11]*b[11]; |
| 2978 |
;; ... |
| 2979 |
;; |
| 2980 |
;; and so the vectorizer provides r, in which the result has to be accumulated. |
| 2981 |
(define_insn "<sup>dot_prod<mode><vsi2qi>" |
| 2982 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 2983 |
(plus:VCVTI |
| 2984 |
(unspec:VCVTI [(match_operand:<VSI2QI> 1 "register_operand" "w") |
| 2985 |
(match_operand:<VSI2QI> 2 "register_operand" "w")] |
| 2986 |
DOTPROD) |
| 2987 |
(match_operand:VCVTI 3 "register_operand" "0")))] |
| 2988 |
"TARGET_DOTPROD" |
| 2989 |
"v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 2990 |
[(set_attr "type" "neon_dot<q>")] |
| 2991 |
) |
| 2992 |
|
| 2993 |
;; These instructions map to the __builtins for the Dot Product operations |
| 2994 |
(define_expand "neon_<sup>dot<mode><vsi2qi>" |
| 2995 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 2996 |
(plus:VCVTI |
| 2997 |
(unspec:VCVTI [(match_operand:<VSI2QI> 2 "register_operand") |
| 2998 |
(match_operand:<VSI2QI> 3 "register_operand")] |
| 2999 |
DOTPROD) |
| 3000 |
(match_operand:VCVTI 1 "register_operand")))] |
| 3001 |
"TARGET_DOTPROD" |
| 3002 |
) |
| 3003 |
|
| 3004 |
;; These instructions map to the __builtins for the Dot Product operations. |
| 3005 |
(define_insn "neon_usdot<mode><vsi2qi>" |
| 3006 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 3007 |
(plus:VCVTI |
| 3008 |
(unspec:VCVTI |
| 3009 |
[(match_operand:<VSI2QI> 2 "register_operand" "w") |
| 3010 |
(match_operand:<VSI2QI> 3 "register_operand" "w")] |
| 3011 |
UNSPEC_DOT_US) |
| 3012 |
(match_operand:VCVTI 1 "register_operand" "0")))] |
| 3013 |
"TARGET_I8MM" |
| 3014 |
"vusdot.s8\\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 3015 |
[(set_attr "type" "neon_dot<q>")] |
| 3016 |
) |
| 3017 |
|
| 3018 |
;; These instructions map to the __builtins for the Dot Product |
| 3019 |
;; indexed operations. |
| 3020 |
(define_insn "neon_<sup>dot_lane<vsi2qi>" |
| 3021 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 3022 |
(plus:VCVTI |
| 3023 |
(unspec:VCVTI [(match_operand:<VSI2QI> 2 "register_operand" "w") |
| 3024 |
(match_operand:V8QI 3 "register_operand" "t") |
| 3025 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3026 |
DOTPROD) |
| 3027 |
(match_operand:VCVTI 1 "register_operand" "0")))] |
| 3028 |
"TARGET_DOTPROD" |
| 3029 |
"v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %P3[%c4]"; |
| 3030 |
[(set_attr "type" "neon_dot<q>")] |
| 3031 |
) |
| 3032 |
|
| 3033 |
;; These instructions map to the __builtins for the Dot Product |
| 3034 |
;; indexed operations. |
| 3035 |
(define_insn "neon_<sup>dot_laneq<vsi2qi>" |
| 3036 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 3037 |
(plus:VCVTI |
| 3038 |
(unspec:VCVTI [(match_operand:<VSI2QI> 2 "register_operand" "w") |
| 3039 |
(match_operand:V16QI 3 "register_operand" "t") |
| 3040 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3041 |
DOTPROD) |
| 3042 |
(match_operand:VCVTI 1 "register_operand" "0")))] |
| 3043 |
"TARGET_DOTPROD" |
| 3044 |
{ |
| 3045 |
int lane = INTVAL (operands[4]); |
| 3046 |
if (lane > GET_MODE_NUNITS (V2SImode) - 1) |
| 3047 |
{ |
| 3048 |
operands[4] = GEN_INT (lane - GET_MODE_NUNITS (V2SImode)); |
| 3049 |
return "v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %f3[%c4]"; |
| 3050 |
} |
| 3051 |
else |
| 3052 |
{ |
| 3053 |
operands[4] = GEN_INT (lane); |
| 3054 |
return "v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %e3[%c4]"; |
| 3055 |
} |
| 3056 |
} |
| 3057 |
[(set_attr "type" "neon_dot<q>")] |
| 3058 |
) |
| 3059 |
|
| 3060 |
;; These instructions map to the __builtins for the Dot Product |
| 3061 |
;; indexed operations in the v8.6 I8MM extension. |
| 3062 |
(define_insn "neon_<sup>dot_lane<vsi2qi>" |
| 3063 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 3064 |
(plus:VCVTI |
| 3065 |
(unspec:VCVTI |
| 3066 |
[(match_operand:<VSI2QI> 2 "register_operand" "w") |
| 3067 |
(match_operand:V8QI 3 "register_operand" "t") |
| 3068 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3069 |
DOTPROD_I8MM) |
| 3070 |
(match_operand:VCVTI 1 "register_operand" "0")))] |
| 3071 |
"TARGET_I8MM" |
| 3072 |
"v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %P3[%c4]" |
| 3073 |
[(set_attr "type" "neon_dot<q>")] |
| 3074 |
) |
| 3075 |
|
| 3076 |
;; These instructions map to the __builtins for the Dot Product |
| 3077 |
;; indexed operations in the v8.6 I8MM extension. |
| 3078 |
(define_insn "neon_<sup>dot_laneq<vsi2qi>" |
| 3079 |
[(set (match_operand:VCVTI 0 "register_operand" "=w") |
| 3080 |
(plus:VCVTI |
| 3081 |
(unspec:VCVTI [(match_operand:<VSI2QI> 2 "register_operand" "w") |
| 3082 |
(match_operand:V16QI 3 "register_operand" "t") |
| 3083 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3084 |
DOTPROD_I8MM) |
| 3085 |
(match_operand:VCVTI 1 "register_operand" "0")))] |
| 3086 |
"TARGET_I8MM" |
| 3087 |
{ |
| 3088 |
int lane = INTVAL (operands[4]); |
| 3089 |
if (lane > GET_MODE_NUNITS (V2SImode) - 1) |
| 3090 |
{ |
| 3091 |
operands[4] = GEN_INT (lane - GET_MODE_NUNITS (V2SImode)); |
| 3092 |
return "v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %f3[%c4]"; |
| 3093 |
} |
| 3094 |
else |
| 3095 |
{ |
| 3096 |
operands[4] = GEN_INT (lane); |
| 3097 |
return "v<sup>dot.<opsuffix>\\t%<V_reg>0, %<V_reg>2, %e3[%c4]"; |
| 3098 |
} |
| 3099 |
} |
| 3100 |
[(set_attr "type" "neon_dot<q>")] |
| 3101 |
) |
| 3102 |
|
| 3103 |
;; Auto-vectorizer pattern for usdot |
| 3104 |
(define_expand "usdot_prod<mode><vsi2qi>" |
| 3105 |
[(set (match_operand:VCVTI 0 "register_operand") |
| 3106 |
(plus:VCVTI (unspec:VCVTI [(match_operand:<VSI2QI> 1 |
| 3107 |
"register_operand") |
| 3108 |
(match_operand:<VSI2QI> 2 |
| 3109 |
"register_operand")] |
| 3110 |
UNSPEC_DOT_US) |
| 3111 |
(match_operand:VCVTI 3 "register_operand")))] |
| 3112 |
"TARGET_I8MM" |
| 3113 |
) |
| 3114 |
|
| 3115 |
(define_expand "copysign<mode>3" |
| 3116 |
[(match_operand:VCVTF 0 "register_operand") |
| 3117 |
(match_operand:VCVTF 1 "register_operand") |
| 3118 |
(match_operand:VCVTF 2 "register_operand")] |
| 3119 |
"TARGET_NEON" |
| 3120 |
"{ |
| 3121 |
rtx v_bitmask_cast; |
| 3122 |
rtx v_bitmask = gen_reg_rtx (<VCVTF:V_cmp_result>mode); |
| 3123 |
rtx c = gen_int_mode (0x80000000, SImode); |
| 3124 |
|
| 3125 |
emit_move_insn (v_bitmask, |
| 3126 |
gen_const_vec_duplicate (<VCVTF:V_cmp_result>mode, c)); |
| 3127 |
emit_move_insn (operands[0], operands[2]); |
| 3128 |
v_bitmask_cast = simplify_gen_subreg (<MODE>mode, v_bitmask, |
| 3129 |
<VCVTF:V_cmp_result>mode, 0); |
| 3130 |
emit_insn (gen_neon_vbsl<mode> (operands[0], v_bitmask_cast, operands[0], |
| 3131 |
operands[1])); |
| 3132 |
|
| 3133 |
DONE; |
| 3134 |
}" |
| 3135 |
) |
| 3136 |
|
| 3137 |
(define_insn "neon_vqneg<mode>" |
| 3138 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 3139 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")] |
| 3140 |
UNSPEC_VQNEG))] |
| 3141 |
"TARGET_NEON" |
| 3142 |
"vqneg.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 3143 |
[(set_attr "type" "neon_qneg<q>")] |
| 3144 |
) |
| 3145 |
|
| 3146 |
(define_insn "neon_vcls<mode>" |
| 3147 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 3148 |
(unspec:VDQIW [(match_operand:VDQIW 1 "s_register_operand" "w")] |
| 3149 |
UNSPEC_VCLS))] |
| 3150 |
"TARGET_NEON" |
| 3151 |
"vcls.<V_s_elem>\t%<V_reg>0, %<V_reg>1" |
| 3152 |
[(set_attr "type" "neon_cls<q>")] |
| 3153 |
) |
| 3154 |
|
| 3155 |
(define_insn "neon_vclz<mode>" |
| 3156 |
[(set (match_operand:VDQIW 0 "s_register_operand" "=w") |
| 3157 |
(clz:VDQIW (match_operand:VDQIW 1 "s_register_operand" "w")))] |
| 3158 |
"TARGET_NEON" |
| 3159 |
"vclz.<V_if_elem>\t%<V_reg>0, %<V_reg>1" |
| 3160 |
[(set_attr "type" "neon_cnt<q>")] |
| 3161 |
) |
| 3162 |
|
| 3163 |
(define_insn "popcount<mode>2" |
| 3164 |
[(set (match_operand:VE 0 "s_register_operand" "=w") |
| 3165 |
(popcount:VE (match_operand:VE 1 "s_register_operand" "w")))] |
| 3166 |
"TARGET_NEON" |
| 3167 |
"vcnt.<V_sz_elem>\t%<V_reg>0, %<V_reg>1" |
| 3168 |
[(set_attr "type" "neon_cnt<q>")] |
| 3169 |
) |
| 3170 |
|
| 3171 |
(define_expand "neon_vcnt<mode>" |
| 3172 |
[(match_operand:VE 0 "s_register_operand") |
| 3173 |
(match_operand:VE 1 "s_register_operand")] |
| 3174 |
"TARGET_NEON" |
| 3175 |
{ |
| 3176 |
emit_insn (gen_popcount<mode>2 (operands[0], operands[1])); |
| 3177 |
DONE; |
| 3178 |
}) |
| 3179 |
|
| 3180 |
(define_insn "neon_vrecpe<mode>" |
| 3181 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 3182 |
(unspec:VH [(match_operand:VH 1 "s_register_operand" "w")] |
| 3183 |
UNSPEC_VRECPE))] |
| 3184 |
"TARGET_NEON_FP16INST" |
| 3185 |
"vrecpe.f16\t%<V_reg>0, %<V_reg>1" |
| 3186 |
[(set_attr "type" "neon_fp_recpe_s<q>")] |
| 3187 |
) |
| 3188 |
|
| 3189 |
(define_insn "neon_vrecpe<mode>" |
| 3190 |
[(set (match_operand:V32 0 "s_register_operand" "=w") |
| 3191 |
(unspec:V32 [(match_operand:V32 1 "s_register_operand" "w")] |
| 3192 |
UNSPEC_VRECPE))] |
| 3193 |
"TARGET_NEON" |
| 3194 |
"vrecpe.<V_u_elem>\t%<V_reg>0, %<V_reg>1" |
| 3195 |
[(set_attr "type" "neon_fp_recpe_s<q>")] |
| 3196 |
) |
| 3197 |
|
| 3198 |
(define_insn "neon_vrsqrte<mode>" |
| 3199 |
[(set (match_operand:V32 0 "s_register_operand" "=w") |
| 3200 |
(unspec:V32 [(match_operand:V32 1 "s_register_operand" "w")] |
| 3201 |
UNSPEC_VRSQRTE))] |
| 3202 |
"TARGET_NEON" |
| 3203 |
"vrsqrte.<V_u_elem>\t%<V_reg>0, %<V_reg>1" |
| 3204 |
[(set_attr "type" "neon_fp_rsqrte_s<q>")] |
| 3205 |
) |
| 3206 |
|
| 3207 |
(define_expand "neon_vmvn<mode>" |
| 3208 |
[(match_operand:VDQIW 0 "s_register_operand") |
| 3209 |
(match_operand:VDQIW 1 "s_register_operand")] |
| 3210 |
"TARGET_NEON" |
| 3211 |
{ |
| 3212 |
emit_insn (gen_one_cmpl<mode>2_neon (operands[0], operands[1])); |
| 3213 |
DONE; |
| 3214 |
}) |
| 3215 |
|
| 3216 |
(define_insn "neon_vget_lane<mode>_sext_internal" |
| 3217 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3218 |
(sign_extend:SI |
| 3219 |
(vec_select:<V_elem> |
| 3220 |
(match_operand:VD 1 "s_register_operand" "w") |
| 3221 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3222 |
"TARGET_NEON" |
| 3223 |
{ |
| 3224 |
if (BYTES_BIG_ENDIAN) |
| 3225 |
{ |
| 3226 |
int elt = INTVAL (operands[2]); |
| 3227 |
elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt; |
| 3228 |
operands[2] = GEN_INT (elt); |
| 3229 |
} |
| 3230 |
return "vmov.s<V_sz_elem>\t%0, %P1[%c2]"; |
| 3231 |
} |
| 3232 |
[(set_attr "type" "neon_to_gp")] |
| 3233 |
) |
| 3234 |
|
| 3235 |
(define_insn "neon_vget_lane<mode>_zext_internal" |
| 3236 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3237 |
(zero_extend:SI |
| 3238 |
(vec_select:<V_elem> |
| 3239 |
(match_operand:VD 1 "s_register_operand" "w") |
| 3240 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3241 |
"TARGET_NEON" |
| 3242 |
{ |
| 3243 |
if (BYTES_BIG_ENDIAN) |
| 3244 |
{ |
| 3245 |
int elt = INTVAL (operands[2]); |
| 3246 |
elt = GET_MODE_NUNITS (<MODE>mode) - 1 - elt; |
| 3247 |
operands[2] = GEN_INT (elt); |
| 3248 |
} |
| 3249 |
return "vmov.u<V_sz_elem>\t%0, %P1[%c2]"; |
| 3250 |
} |
| 3251 |
[(set_attr "type" "neon_to_gp")] |
| 3252 |
) |
| 3253 |
|
| 3254 |
(define_insn "neon_vget_lane<mode>_sext_internal" |
| 3255 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3256 |
(sign_extend:SI |
| 3257 |
(vec_select:<V_elem> |
| 3258 |
(match_operand:VQ2 1 "s_register_operand" "w") |
| 3259 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3260 |
"TARGET_NEON" |
| 3261 |
{ |
| 3262 |
rtx ops[3]; |
| 3263 |
int regno = REGNO (operands[1]); |
| 3264 |
unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2; |
| 3265 |
unsigned int elt = INTVAL (operands[2]); |
| 3266 |
unsigned int elt_adj = elt % halfelts; |
| 3267 |
|
| 3268 |
if (BYTES_BIG_ENDIAN) |
| 3269 |
elt_adj = halfelts - 1 - elt_adj; |
| 3270 |
|
| 3271 |
ops[0] = operands[0]; |
| 3272 |
ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts)); |
| 3273 |
ops[2] = GEN_INT (elt_adj); |
| 3274 |
output_asm_insn ("vmov.s<V_sz_elem>\t%0, %P1[%c2]", ops); |
| 3275 |
|
| 3276 |
return ""; |
| 3277 |
} |
| 3278 |
[(set_attr "type" "neon_to_gp_q")] |
| 3279 |
) |
| 3280 |
|
| 3281 |
(define_insn "neon_vget_lane<mode>_zext_internal" |
| 3282 |
[(set (match_operand:SI 0 "s_register_operand" "=r") |
| 3283 |
(zero_extend:SI |
| 3284 |
(vec_select:<V_elem> |
| 3285 |
(match_operand:VQ2 1 "s_register_operand" "w") |
| 3286 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3287 |
"TARGET_NEON" |
| 3288 |
{ |
| 3289 |
rtx ops[3]; |
| 3290 |
int regno = REGNO (operands[1]); |
| 3291 |
unsigned int halfelts = GET_MODE_NUNITS (<MODE>mode) / 2; |
| 3292 |
unsigned int elt = INTVAL (operands[2]); |
| 3293 |
unsigned int elt_adj = elt % halfelts; |
| 3294 |
|
| 3295 |
if (BYTES_BIG_ENDIAN) |
| 3296 |
elt_adj = halfelts - 1 - elt_adj; |
| 3297 |
|
| 3298 |
ops[0] = operands[0]; |
| 3299 |
ops[1] = gen_rtx_REG (<V_HALF>mode, regno + 2 * (elt / halfelts)); |
| 3300 |
ops[2] = GEN_INT (elt_adj); |
| 3301 |
output_asm_insn ("vmov.u<V_sz_elem>\t%0, %P1[%c2]", ops); |
| 3302 |
|
| 3303 |
return ""; |
| 3304 |
} |
| 3305 |
[(set_attr "type" "neon_to_gp_q")] |
| 3306 |
) |
| 3307 |
|
| 3308 |
(define_expand "neon_vget_lane<mode>" |
| 3309 |
[(match_operand:<V_ext> 0 "s_register_operand") |
| 3310 |
(match_operand:VDQW 1 "s_register_operand") |
| 3311 |
(match_operand:SI 2 "immediate_operand")] |
| 3312 |
"TARGET_NEON" |
| 3313 |
{ |
| 3314 |
if (BYTES_BIG_ENDIAN) |
| 3315 |
{ |
| 3316 |
/* The intrinsics are defined in terms of a model where the |
| 3317 |
element ordering in memory is vldm order, whereas the generic |
| 3318 |
RTL is defined in terms of a model where the element ordering |
| 3319 |
in memory is array order. Convert the lane number to conform |
| 3320 |
to this model. */ |
| 3321 |
unsigned int elt = INTVAL (operands[2]); |
| 3322 |
unsigned int reg_nelts |
| 3323 |
= 64 / GET_MODE_UNIT_BITSIZE (<MODE>mode); |
| 3324 |
elt ^= reg_nelts - 1; |
| 3325 |
operands[2] = GEN_INT (elt); |
| 3326 |
} |
| 3327 |
|
| 3328 |
if (GET_MODE_UNIT_BITSIZE (<MODE>mode) == 32) |
| 3329 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], operands[1], |
| 3330 |
operands[2])); |
| 3331 |
else |
| 3332 |
emit_insn (gen_neon_vget_lane<mode>_sext_internal (operands[0], |
| 3333 |
operands[1], |
| 3334 |
operands[2])); |
| 3335 |
DONE; |
| 3336 |
}) |
| 3337 |
|
| 3338 |
(define_expand "neon_vget_laneu<mode>" |
| 3339 |
[(match_operand:<V_ext> 0 "s_register_operand") |
| 3340 |
(match_operand:VDQIW 1 "s_register_operand") |
| 3341 |
(match_operand:SI 2 "immediate_operand")] |
| 3342 |
"TARGET_NEON" |
| 3343 |
{ |
| 3344 |
if (BYTES_BIG_ENDIAN) |
| 3345 |
{ |
| 3346 |
/* The intrinsics are defined in terms of a model where the |
| 3347 |
element ordering in memory is vldm order, whereas the generic |
| 3348 |
RTL is defined in terms of a model where the element ordering |
| 3349 |
in memory is array order. Convert the lane number to conform |
| 3350 |
to this model. */ |
| 3351 |
unsigned int elt = INTVAL (operands[2]); |
| 3352 |
unsigned int reg_nelts |
| 3353 |
= 64 / GET_MODE_UNIT_BITSIZE (<MODE>mode); |
| 3354 |
elt ^= reg_nelts - 1; |
| 3355 |
operands[2] = GEN_INT (elt); |
| 3356 |
} |
| 3357 |
|
| 3358 |
if (GET_MODE_UNIT_BITSIZE (<MODE>mode) == 32) |
| 3359 |
emit_insn (gen_vec_extract<mode><V_elem_l> (operands[0], operands[1], |
| 3360 |
operands[2])); |
| 3361 |
else |
| 3362 |
emit_insn (gen_neon_vget_lane<mode>_zext_internal (operands[0], |
| 3363 |
operands[1], |
| 3364 |
operands[2])); |
| 3365 |
DONE; |
| 3366 |
}) |
| 3367 |
|
| 3368 |
(define_expand "neon_vget_lanedi" |
| 3369 |
[(match_operand:DI 0 "s_register_operand") |
| 3370 |
(match_operand:DI 1 "s_register_operand") |
| 3371 |
(match_operand:SI 2 "immediate_operand")] |
| 3372 |
"TARGET_NEON" |
| 3373 |
{ |
| 3374 |
emit_move_insn (operands[0], operands[1]); |
| 3375 |
DONE; |
| 3376 |
}) |
| 3377 |
|
| 3378 |
(define_expand "neon_vget_lanev2di" |
| 3379 |
[(match_operand:DI 0 "s_register_operand") |
| 3380 |
(match_operand:V2DI 1 "s_register_operand") |
| 3381 |
(match_operand:SI 2 "immediate_operand")] |
| 3382 |
"TARGET_NEON" |
| 3383 |
{ |
| 3384 |
int lane; |
| 3385 |
|
| 3386 |
if (BYTES_BIG_ENDIAN) |
| 3387 |
{ |
| 3388 |
/* The intrinsics are defined in terms of a model where the |
| 3389 |
element ordering in memory is vldm order, whereas the generic |
| 3390 |
RTL is defined in terms of a model where the element ordering |
| 3391 |
in memory is array order. Convert the lane number to conform |
| 3392 |
to this model. */ |
| 3393 |
unsigned int elt = INTVAL (operands[2]); |
| 3394 |
unsigned int reg_nelts = 2; |
| 3395 |
elt ^= reg_nelts - 1; |
| 3396 |
operands[2] = GEN_INT (elt); |
| 3397 |
} |
| 3398 |
|
| 3399 |
lane = INTVAL (operands[2]); |
| 3400 |
gcc_assert ((lane ==0) || (lane == 1)); |
| 3401 |
emit_move_insn (operands[0], lane == 0 |
| 3402 |
? gen_lowpart (DImode, operands[1]) |
| 3403 |
: gen_highpart (DImode, operands[1])); |
| 3404 |
DONE; |
| 3405 |
}) |
| 3406 |
|
| 3407 |
(define_expand "neon_vset_lane<mode>" |
| 3408 |
[(match_operand:VDQ 0 "s_register_operand") |
| 3409 |
(match_operand:<V_elem> 1 "s_register_operand") |
| 3410 |
(match_operand:VDQ 2 "s_register_operand") |
| 3411 |
(match_operand:SI 3 "immediate_operand")] |
| 3412 |
"TARGET_NEON" |
| 3413 |
{ |
| 3414 |
unsigned int elt = INTVAL (operands[3]); |
| 3415 |
|
| 3416 |
if (BYTES_BIG_ENDIAN) |
| 3417 |
{ |
| 3418 |
unsigned int reg_nelts |
| 3419 |
= 64 / GET_MODE_UNIT_BITSIZE (<MODE>mode); |
| 3420 |
elt ^= reg_nelts - 1; |
| 3421 |
} |
| 3422 |
|
| 3423 |
emit_insn (gen_vec_set<mode>_internal (operands[0], operands[1], |
| 3424 |
GEN_INT (1 << elt), operands[2])); |
| 3425 |
DONE; |
| 3426 |
}) |
| 3427 |
|
| 3428 |
; See neon_vget_lanedi comment for reasons operands 2 & 3 are ignored. |
| 3429 |
|
| 3430 |
(define_expand "neon_vset_lanedi" |
| 3431 |
[(match_operand:DI 0 "s_register_operand") |
| 3432 |
(match_operand:DI 1 "s_register_operand") |
| 3433 |
(match_operand:DI 2 "s_register_operand") |
| 3434 |
(match_operand:SI 3 "immediate_operand")] |
| 3435 |
"TARGET_NEON" |
| 3436 |
{ |
| 3437 |
emit_move_insn (operands[0], operands[1]); |
| 3438 |
DONE; |
| 3439 |
}) |
| 3440 |
|
| 3441 |
(define_expand "neon_vcreate<mode>" |
| 3442 |
[(match_operand:VD_RE 0 "s_register_operand") |
| 3443 |
(match_operand:DI 1 "general_operand")] |
| 3444 |
"TARGET_NEON" |
| 3445 |
{ |
| 3446 |
rtx src = gen_lowpart (<MODE>mode, operands[1]); |
| 3447 |
emit_move_insn (operands[0], src); |
| 3448 |
DONE; |
| 3449 |
}) |
| 3450 |
|
| 3451 |
(define_insn "neon_vdup_n<mode>" |
| 3452 |
[(set (match_operand:VX 0 "s_register_operand" "=w") |
| 3453 |
(vec_duplicate:VX (match_operand:<V_elem> 1 "s_register_operand" "r")))] |
| 3454 |
"TARGET_NEON" |
| 3455 |
"vdup.<V_sz_elem>\t%<V_reg>0, %1" |
| 3456 |
[(set_attr "type" "neon_from_gp<q>")] |
| 3457 |
) |
| 3458 |
|
| 3459 |
(define_insn "neon_vdup_nv4hf" |
| 3460 |
[(set (match_operand:V4HF 0 "s_register_operand" "=w") |
| 3461 |
(vec_duplicate:V4HF (match_operand:HF 1 "s_register_operand" "r")))] |
| 3462 |
"TARGET_NEON" |
| 3463 |
"vdup.16\t%P0, %1" |
| 3464 |
[(set_attr "type" "neon_from_gp")] |
| 3465 |
) |
| 3466 |
|
| 3467 |
(define_insn "neon_vdup_nv8hf" |
| 3468 |
[(set (match_operand:V8HF 0 "s_register_operand" "=w") |
| 3469 |
(vec_duplicate:V8HF (match_operand:HF 1 "s_register_operand" "r")))] |
| 3470 |
"TARGET_NEON" |
| 3471 |
"vdup.16\t%q0, %1" |
| 3472 |
[(set_attr "type" "neon_from_gp_q")] |
| 3473 |
) |
| 3474 |
|
| 3475 |
(define_insn "neon_vdup_nv4bf" |
| 3476 |
[(set (match_operand:V4BF 0 "s_register_operand" "=w") |
| 3477 |
(vec_duplicate:V4BF (match_operand:BF 1 "s_register_operand" "r")))] |
| 3478 |
"TARGET_NEON" |
| 3479 |
"vdup.16\t%P0, %1" |
| 3480 |
[(set_attr "type" "neon_from_gp")] |
| 3481 |
) |
| 3482 |
|
| 3483 |
(define_insn "neon_vdup_nv8bf" |
| 3484 |
[(set (match_operand:V8BF 0 "s_register_operand" "=w") |
| 3485 |
(vec_duplicate:V8BF (match_operand:BF 1 "s_register_operand" "r")))] |
| 3486 |
"TARGET_NEON" |
| 3487 |
"vdup.16\t%q0, %1" |
| 3488 |
[(set_attr "type" "neon_from_gp_q")] |
| 3489 |
) |
| 3490 |
|
| 3491 |
(define_insn "neon_vdup_n<mode>" |
| 3492 |
[(set (match_operand:V32 0 "s_register_operand" "=w,w") |
| 3493 |
(vec_duplicate:V32 (match_operand:<V_elem> 1 "s_register_operand" "r,t")))] |
| 3494 |
"TARGET_NEON" |
| 3495 |
"@ |
| 3496 |
vdup.<V_sz_elem>\t%<V_reg>0, %1 |
| 3497 |
vdup.<V_sz_elem>\t%<V_reg>0, %y1" |
| 3498 |
[(set_attr "type" "neon_from_gp<q>,neon_dup<q>")] |
| 3499 |
) |
| 3500 |
|
| 3501 |
(define_expand "neon_vdup_ndi" |
| 3502 |
[(match_operand:DI 0 "s_register_operand") |
| 3503 |
(match_operand:DI 1 "s_register_operand")] |
| 3504 |
"TARGET_NEON" |
| 3505 |
{ |
| 3506 |
emit_move_insn (operands[0], operands[1]); |
| 3507 |
DONE; |
| 3508 |
} |
| 3509 |
) |
| 3510 |
|
| 3511 |
(define_insn "neon_vdup_nv2di" |
| 3512 |
[(set (match_operand:V2DI 0 "s_register_operand" "=w,w") |
| 3513 |
(vec_duplicate:V2DI (match_operand:DI 1 "s_register_operand" "r,w")))] |
| 3514 |
"TARGET_NEON" |
| 3515 |
"@ |
| 3516 |
vmov\t%e0, %Q1, %R1\;vmov\t%f0, %Q1, %R1 |
| 3517 |
vmov\t%e0, %P1\;vmov\t%f0, %P1" |
| 3518 |
[(set_attr "length" "8") |
| 3519 |
(set_attr "type" "multiple")] |
| 3520 |
) |
| 3521 |
|
| 3522 |
(define_insn "neon_vdup_lane<mode>_internal" |
| 3523 |
[(set (match_operand:VDQW 0 "s_register_operand" "=w") |
| 3524 |
(vec_duplicate:VDQW |
| 3525 |
(vec_select:<V_elem> |
| 3526 |
(match_operand:<V_double_vector_mode> 1 "s_register_operand" "w") |
| 3527 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3528 |
"TARGET_NEON" |
| 3529 |
{ |
| 3530 |
if (BYTES_BIG_ENDIAN) |
| 3531 |
{ |
| 3532 |
int elt = INTVAL (operands[2]); |
| 3533 |
elt = GET_MODE_NUNITS (<V_double_vector_mode>mode) - 1 - elt; |
| 3534 |
operands[2] = GEN_INT (elt); |
| 3535 |
} |
| 3536 |
if (<Is_d_reg>) |
| 3537 |
return "vdup.<V_sz_elem>\t%P0, %P1[%c2]"; |
| 3538 |
else |
| 3539 |
return "vdup.<V_sz_elem>\t%q0, %P1[%c2]"; |
| 3540 |
} |
| 3541 |
[(set_attr "type" "neon_dup<q>")] |
| 3542 |
) |
| 3543 |
|
| 3544 |
(define_insn "neon_vdup_lane<mode>_internal" |
| 3545 |
[(set (match_operand:VHFBF 0 "s_register_operand" "=w") |
| 3546 |
(vec_duplicate:VHFBF |
| 3547 |
(vec_select:<V_elem> |
| 3548 |
(match_operand:<V_double_vector_mode> 1 "s_register_operand" "w") |
| 3549 |
(parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] |
| 3550 |
"TARGET_NEON && (TARGET_FP16 || TARGET_BF16_SIMD)" |
| 3551 |
{ |
| 3552 |
if (BYTES_BIG_ENDIAN) |
| 3553 |
{ |
| 3554 |
int elt = INTVAL (operands[2]); |
| 3555 |
elt = GET_MODE_NUNITS (<V_double_vector_mode>mode) - 1 - elt; |
| 3556 |
operands[2] = GEN_INT (elt); |
| 3557 |
} |
| 3558 |
if (<Is_d_reg>) |
| 3559 |
return "vdup.<V_sz_elem>\t%P0, %P1[%c2]"; |
| 3560 |
else |
| 3561 |
return "vdup.<V_sz_elem>\t%q0, %P1[%c2]"; |
| 3562 |
} |
| 3563 |
[(set_attr "type" "neon_dup<q>")] |
| 3564 |
) |
| 3565 |
|
| 3566 |
(define_expand "neon_vdup_lane<mode>" |
| 3567 |
[(match_operand:VDQW 0 "s_register_operand") |
| 3568 |
(match_operand:<V_double_vector_mode> 1 "s_register_operand") |
| 3569 |
(match_operand:SI 2 "immediate_operand")] |
| 3570 |
"TARGET_NEON" |
| 3571 |
{ |
| 3572 |
if (BYTES_BIG_ENDIAN) |
| 3573 |
{ |
| 3574 |
unsigned int elt = INTVAL (operands[2]); |
| 3575 |
unsigned int reg_nelts |
| 3576 |
= 64 / GET_MODE_UNIT_BITSIZE (<V_double_vector_mode>mode); |
| 3577 |
elt ^= reg_nelts - 1; |
| 3578 |
operands[2] = GEN_INT (elt); |
| 3579 |
} |
| 3580 |
emit_insn (gen_neon_vdup_lane<mode>_internal (operands[0], operands[1], |
| 3581 |
operands[2])); |
| 3582 |
DONE; |
| 3583 |
}) |
| 3584 |
|
| 3585 |
(define_expand "neon_vdup_lane<mode>" |
| 3586 |
[(match_operand:VHFBF 0 "s_register_operand") |
| 3587 |
(match_operand:<V_double_vector_mode> 1 "s_register_operand") |
| 3588 |
(match_operand:SI 2 "immediate_operand")] |
| 3589 |
"TARGET_NEON && (TARGET_FP16 || TARGET_BF16_SIMD)" |
| 3590 |
{ |
| 3591 |
if (BYTES_BIG_ENDIAN) |
| 3592 |
{ |
| 3593 |
unsigned int elt = INTVAL (operands[2]); |
| 3594 |
unsigned int reg_nelts |
| 3595 |
= 64 / GET_MODE_UNIT_BITSIZE (<V_double_vector_mode>mode); |
| 3596 |
elt ^= reg_nelts - 1; |
| 3597 |
operands[2] = GEN_INT (elt); |
| 3598 |
} |
| 3599 |
emit_insn (gen_neon_vdup_lane<mode>_internal (operands[0], operands[1], |
| 3600 |
operands[2])); |
| 3601 |
DONE; |
| 3602 |
}) |
| 3603 |
|
| 3604 |
; Scalar index is ignored, since only zero is valid here. |
| 3605 |
(define_expand "neon_vdup_lanedi" |
| 3606 |
[(match_operand:DI 0 "s_register_operand") |
| 3607 |
(match_operand:DI 1 "s_register_operand") |
| 3608 |
(match_operand:SI 2 "immediate_operand")] |
| 3609 |
"TARGET_NEON" |
| 3610 |
{ |
| 3611 |
emit_move_insn (operands[0], operands[1]); |
| 3612 |
DONE; |
| 3613 |
}) |
| 3614 |
|
| 3615 |
; Likewise for v2di, as the DImode second operand has only a single element. |
| 3616 |
(define_expand "neon_vdup_lanev2di" |
| 3617 |
[(match_operand:V2DI 0 "s_register_operand") |
| 3618 |
(match_operand:DI 1 "s_register_operand") |
| 3619 |
(match_operand:SI 2 "immediate_operand")] |
| 3620 |
"TARGET_NEON" |
| 3621 |
{ |
| 3622 |
emit_insn (gen_neon_vdup_nv2di (operands[0], operands[1])); |
| 3623 |
DONE; |
| 3624 |
}) |
| 3625 |
|
| 3626 |
; Disabled before reload because we don't want combine doing something silly, |
| 3627 |
; but used by the post-reload expansion of neon_vcombine. |
| 3628 |
(define_insn "*neon_vswp<mode>" |
| 3629 |
[(set (match_operand:VDQX 0 "s_register_operand" "+w") |
| 3630 |
(match_operand:VDQX 1 "s_register_operand" "+w")) |
| 3631 |
(set (match_dup 1) (match_dup 0))] |
| 3632 |
"TARGET_NEON && reload_completed" |
| 3633 |
"vswp\t%<V_reg>0, %<V_reg>1" |
| 3634 |
[(set_attr "type" "neon_permute<q>")] |
| 3635 |
) |
| 3636 |
|
| 3637 |
;; In this insn, operand 1 should be low, and operand 2 the high part of the |
| 3638 |
;; dest vector. |
| 3639 |
;; FIXME: A different implementation of this builtin could make it much |
| 3640 |
;; more likely that we wouldn't actually need to output anything (we could make |
| 3641 |
;; it so that the reg allocator puts things in the right places magically |
| 3642 |
;; instead). Lack of subregs for vectors makes that tricky though, I think. |
| 3643 |
|
| 3644 |
(define_insn_and_split "neon_vcombine<mode>" |
| 3645 |
[(set (match_operand:<V_DOUBLE> 0 "s_register_operand" "=w") |
| 3646 |
(vec_concat:<V_DOUBLE> |
| 3647 |
(match_operand:VDX 1 "s_register_operand" "w") |
| 3648 |
(match_operand:VDX 2 "s_register_operand" "w")))] |
| 3649 |
"TARGET_NEON" |
| 3650 |
"#" |
| 3651 |
"&& reload_completed" |
| 3652 |
[(const_int 0)] |
| 3653 |
{ |
| 3654 |
neon_split_vcombine (operands); |
| 3655 |
DONE; |
| 3656 |
} |
| 3657 |
[(set_attr "type" "multiple")] |
| 3658 |
) |
| 3659 |
|
| 3660 |
(define_expand "neon_vget_high<mode>" |
| 3661 |
[(match_operand:<V_HALF> 0 "s_register_operand") |
| 3662 |
(match_operand:VQXBF 1 "s_register_operand")] |
| 3663 |
"TARGET_NEON" |
| 3664 |
{ |
| 3665 |
emit_move_insn (operands[0], |
| 3666 |
simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode, |
| 3667 |
GET_MODE_SIZE (<V_HALF>mode))); |
| 3668 |
DONE; |
| 3669 |
}) |
| 3670 |
|
| 3671 |
(define_expand "neon_vget_low<mode>" |
| 3672 |
[(match_operand:<V_HALF> 0 "s_register_operand") |
| 3673 |
(match_operand:VQX 1 "s_register_operand")] |
| 3674 |
"TARGET_NEON" |
| 3675 |
{ |
| 3676 |
emit_move_insn (operands[0], |
| 3677 |
simplify_gen_subreg (<V_HALF>mode, operands[1], |
| 3678 |
<MODE>mode, 0)); |
| 3679 |
DONE; |
| 3680 |
}) |
| 3681 |
|
| 3682 |
(define_insn "float<mode><V_cvtto>2" |
| 3683 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3684 |
(float:<V_CVTTO> (match_operand:VCVTI 1 "s_register_operand" "w")))] |
| 3685 |
"TARGET_NEON && !flag_rounding_math" |
| 3686 |
"vcvt.f32.s32\t%<V_reg>0, %<V_reg>1" |
| 3687 |
[(set_attr "type" "neon_int_to_fp_<V_elem_ch><q>")] |
| 3688 |
) |
| 3689 |
|
| 3690 |
(define_insn "floatuns<mode><V_cvtto>2" |
| 3691 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3692 |
(unsigned_float:<V_CVTTO> (match_operand:VCVTI 1 "s_register_operand" "w")))] |
| 3693 |
"TARGET_NEON && !flag_rounding_math" |
| 3694 |
"vcvt.f32.u32\t%<V_reg>0, %<V_reg>1" |
| 3695 |
[(set_attr "type" "neon_int_to_fp_<V_elem_ch><q>")] |
| 3696 |
) |
| 3697 |
|
| 3698 |
(define_insn "fix_trunc<mode><V_cvtto>2" |
| 3699 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3700 |
(fix:<V_CVTTO> (match_operand:VCVTF 1 "s_register_operand" "w")))] |
| 3701 |
"TARGET_NEON" |
| 3702 |
"vcvt.s32.f32\t%<V_reg>0, %<V_reg>1" |
| 3703 |
[(set_attr "type" "neon_fp_to_int_<V_elem_ch><q>")] |
| 3704 |
) |
| 3705 |
|
| 3706 |
(define_insn "fixuns_trunc<mode><V_cvtto>2" |
| 3707 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3708 |
(unsigned_fix:<V_CVTTO> (match_operand:VCVTF 1 "s_register_operand" "w")))] |
| 3709 |
"TARGET_NEON" |
| 3710 |
"vcvt.u32.f32\t%<V_reg>0, %<V_reg>1" |
| 3711 |
[(set_attr "type" "neon_fp_to_int_<V_elem_ch><q>")] |
| 3712 |
) |
| 3713 |
|
| 3714 |
(define_insn "neon_vcvt<sup><mode>" |
| 3715 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3716 |
(unspec:<V_CVTTO> [(match_operand:VCVTF 1 "s_register_operand" "w")] |
| 3717 |
VCVT_US))] |
| 3718 |
"TARGET_NEON" |
| 3719 |
"vcvt.<sup>%#32.f32\t%<V_reg>0, %<V_reg>1" |
| 3720 |
[(set_attr "type" "neon_fp_to_int_<V_elem_ch><q>")] |
| 3721 |
) |
| 3722 |
|
| 3723 |
(define_insn "neon_vcvt<sup><mode>" |
| 3724 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3725 |
(unspec:<V_CVTTO> [(match_operand:VCVTI 1 "s_register_operand" "w")] |
| 3726 |
VCVT_US))] |
| 3727 |
"TARGET_NEON" |
| 3728 |
"vcvt.f32.<sup>%#32\t%<V_reg>0, %<V_reg>1" |
| 3729 |
[(set_attr "type" "neon_int_to_fp_<V_elem_ch><q>")] |
| 3730 |
) |
| 3731 |
|
| 3732 |
(define_insn "neon_vcvtv4sfv4hf" |
| 3733 |
[(set (match_operand:V4SF 0 "s_register_operand" "=w") |
| 3734 |
(unspec:V4SF [(match_operand:V4HF 1 "s_register_operand" "w")] |
| 3735 |
UNSPEC_VCVT))] |
| 3736 |
"TARGET_NEON && TARGET_FP16" |
| 3737 |
"vcvt.f32.f16\t%q0, %P1" |
| 3738 |
[(set_attr "type" "neon_fp_cvt_widen_h")] |
| 3739 |
) |
| 3740 |
|
| 3741 |
(define_insn "neon_vcvtv4hfv4sf" |
| 3742 |
[(set (match_operand:V4HF 0 "s_register_operand" "=w") |
| 3743 |
(unspec:V4HF [(match_operand:V4SF 1 "s_register_operand" "w")] |
| 3744 |
UNSPEC_VCVT))] |
| 3745 |
"TARGET_NEON && TARGET_FP16" |
| 3746 |
"vcvt.f16.f32\t%P0, %q1" |
| 3747 |
[(set_attr "type" "neon_fp_cvt_narrow_s_q")] |
| 3748 |
) |
| 3749 |
|
| 3750 |
(define_insn "neon_vcvt<sup><mode>" |
| 3751 |
[(set |
| 3752 |
(match_operand:<VH_CVTTO> 0 "s_register_operand" "=w") |
| 3753 |
(unspec:<VH_CVTTO> |
| 3754 |
[(match_operand:VCVTHI 1 "s_register_operand" "w")] |
| 3755 |
VCVT_US))] |
| 3756 |
"TARGET_NEON_FP16INST" |
| 3757 |
"vcvt.f16.<sup>%#16\t%<V_reg>0, %<V_reg>1" |
| 3758 |
[(set_attr "type" "neon_int_to_fp_<VH_elem_ch><q>")] |
| 3759 |
) |
| 3760 |
|
| 3761 |
(define_insn "neon_vcvt<sup><mode>" |
| 3762 |
[(set |
| 3763 |
(match_operand:<VH_CVTTO> 0 "s_register_operand" "=w") |
| 3764 |
(unspec:<VH_CVTTO> |
| 3765 |
[(match_operand:VH 1 "s_register_operand" "w")] |
| 3766 |
VCVT_US))] |
| 3767 |
"TARGET_NEON_FP16INST" |
| 3768 |
"vcvt.<sup>%#16.f16\t%<V_reg>0, %<V_reg>1" |
| 3769 |
[(set_attr "type" "neon_fp_to_int_<VH_elem_ch><q>")] |
| 3770 |
) |
| 3771 |
|
| 3772 |
(define_insn "neon_vcvt<sup>_n<mode>" |
| 3773 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3774 |
(unspec:<V_CVTTO> [(match_operand:VCVTF 1 "s_register_operand" "w") |
| 3775 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 3776 |
VCVT_US_N))] |
| 3777 |
"TARGET_NEON" |
| 3778 |
{ |
| 3779 |
arm_const_bounds (operands[2], 1, 33); |
| 3780 |
return "vcvt.<sup>%#32.f32\t%<V_reg>0, %<V_reg>1, %2"; |
| 3781 |
} |
| 3782 |
[(set_attr "type" "neon_fp_to_int_<V_elem_ch><q>")] |
| 3783 |
) |
| 3784 |
|
| 3785 |
(define_insn "neon_vcvt<sup>_n<mode>" |
| 3786 |
[(set (match_operand:<VH_CVTTO> 0 "s_register_operand" "=w") |
| 3787 |
(unspec:<VH_CVTTO> |
| 3788 |
[(match_operand:VH 1 "s_register_operand" "w") |
| 3789 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 3790 |
VCVT_US_N))] |
| 3791 |
"TARGET_NEON_FP16INST" |
| 3792 |
{ |
| 3793 |
arm_const_bounds (operands[2], 0, 17); |
| 3794 |
return "vcvt.<sup>%#16.f16\t%<V_reg>0, %<V_reg>1, %2"; |
| 3795 |
} |
| 3796 |
[(set_attr "type" "neon_fp_to_int_<VH_elem_ch><q>")] |
| 3797 |
) |
| 3798 |
|
| 3799 |
(define_insn "neon_vcvt<sup>_n<mode>" |
| 3800 |
[(set (match_operand:<V_CVTTO> 0 "s_register_operand" "=w") |
| 3801 |
(unspec:<V_CVTTO> [(match_operand:VCVTI 1 "s_register_operand" "w") |
| 3802 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 3803 |
VCVT_US_N))] |
| 3804 |
"TARGET_NEON" |
| 3805 |
{ |
| 3806 |
arm_const_bounds (operands[2], 1, 33); |
| 3807 |
return "vcvt.f32.<sup>%#32\t%<V_reg>0, %<V_reg>1, %2"; |
| 3808 |
} |
| 3809 |
[(set_attr "type" "neon_int_to_fp_<V_elem_ch><q>")] |
| 3810 |
) |
| 3811 |
|
| 3812 |
(define_insn "neon_vcvt<sup>_n<mode>" |
| 3813 |
[(set (match_operand:<VH_CVTTO> 0 "s_register_operand" "=w") |
| 3814 |
(unspec:<VH_CVTTO> |
| 3815 |
[(match_operand:VCVTHI 1 "s_register_operand" "w") |
| 3816 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 3817 |
VCVT_US_N))] |
| 3818 |
"TARGET_NEON_FP16INST" |
| 3819 |
{ |
| 3820 |
arm_const_bounds (operands[2], 0, 17); |
| 3821 |
return "vcvt.f16.<sup>%#16\t%<V_reg>0, %<V_reg>1, %2"; |
| 3822 |
} |
| 3823 |
[(set_attr "type" "neon_int_to_fp_<VH_elem_ch><q>")] |
| 3824 |
) |
| 3825 |
|
| 3826 |
(define_insn "neon_vcvt<vcvth_op><sup><mode>" |
| 3827 |
[(set |
| 3828 |
(match_operand:<VH_CVTTO> 0 "s_register_operand" "=w") |
| 3829 |
(unspec:<VH_CVTTO> |
| 3830 |
[(match_operand:VH 1 "s_register_operand" "w")] |
| 3831 |
VCVT_HF_US))] |
| 3832 |
"TARGET_NEON_FP16INST" |
| 3833 |
"vcvt<vcvth_op>.<sup>%#16.f16\t%<V_reg>0, %<V_reg>1" |
| 3834 |
[(set_attr "type" "neon_fp_to_int_<VH_elem_ch><q>")] |
| 3835 |
) |
| 3836 |
|
| 3837 |
(define_insn "neon_vmovn<mode>" |
| 3838 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 3839 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")] |
| 3840 |
UNSPEC_VMOVN))] |
| 3841 |
"TARGET_NEON" |
| 3842 |
"vmovn.<V_if_elem>\t%P0, %q1" |
| 3843 |
[(set_attr "type" "neon_shift_imm_narrow_q")] |
| 3844 |
) |
| 3845 |
|
| 3846 |
(define_insn "neon_vqmovn<sup><mode>" |
| 3847 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 3848 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")] |
| 3849 |
VQMOVN))] |
| 3850 |
"TARGET_NEON" |
| 3851 |
"vqmovn.<sup>%#<V_sz_elem>\t%P0, %q1" |
| 3852 |
[(set_attr "type" "neon_sat_shift_imm_narrow_q")] |
| 3853 |
) |
| 3854 |
|
| 3855 |
(define_insn "neon_vqmovun<mode>" |
| 3856 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 3857 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w")] |
| 3858 |
UNSPEC_VQMOVUN))] |
| 3859 |
"TARGET_NEON" |
| 3860 |
"vqmovun.<V_s_elem>\t%P0, %q1" |
| 3861 |
[(set_attr "type" "neon_sat_shift_imm_narrow_q")] |
| 3862 |
) |
| 3863 |
|
| 3864 |
(define_insn "neon_vmovl<sup><mode>" |
| 3865 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 3866 |
(unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w")] |
| 3867 |
VMOVL))] |
| 3868 |
"TARGET_NEON" |
| 3869 |
"vmovl.<sup>%#<V_sz_elem>\t%q0, %P1" |
| 3870 |
[(set_attr "type" "neon_shift_imm_long")] |
| 3871 |
) |
| 3872 |
|
| 3873 |
(define_insn "neon_vmul_lane<mode>" |
| 3874 |
[(set (match_operand:VMD 0 "s_register_operand" "=w") |
| 3875 |
(unspec:VMD [(match_operand:VMD 1 "s_register_operand" "w") |
| 3876 |
(match_operand:VMD 2 "s_register_operand" |
| 3877 |
"<scalar_mul_constraint>") |
| 3878 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3879 |
UNSPEC_VMUL_LANE))] |
| 3880 |
"TARGET_NEON" |
| 3881 |
{ |
| 3882 |
return "vmul.<V_if_elem>\t%P0, %P1, %P2[%c3]"; |
| 3883 |
} |
| 3884 |
[(set (attr "type") |
| 3885 |
(if_then_else (match_test "<Is_float_mode>") |
| 3886 |
(const_string "neon_fp_mul_s_scalar<q>") |
| 3887 |
(const_string "neon_mul_<V_elem_ch>_scalar<q>")))] |
| 3888 |
) |
| 3889 |
|
| 3890 |
(define_insn "neon_vmul_lane<mode>" |
| 3891 |
[(set (match_operand:VMQ 0 "s_register_operand" "=w") |
| 3892 |
(unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "w") |
| 3893 |
(match_operand:<V_HALF> 2 "s_register_operand" |
| 3894 |
"<scalar_mul_constraint>") |
| 3895 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3896 |
UNSPEC_VMUL_LANE))] |
| 3897 |
"TARGET_NEON" |
| 3898 |
{ |
| 3899 |
return "vmul.<V_if_elem>\t%q0, %q1, %P2[%c3]"; |
| 3900 |
} |
| 3901 |
[(set (attr "type") |
| 3902 |
(if_then_else (match_test "<Is_float_mode>") |
| 3903 |
(const_string "neon_fp_mul_s_scalar<q>") |
| 3904 |
(const_string "neon_mul_<V_elem_ch>_scalar<q>")))] |
| 3905 |
) |
| 3906 |
|
| 3907 |
(define_insn "neon_vmul_lane<mode>" |
| 3908 |
[(set (match_operand:VH 0 "s_register_operand" "=w") |
| 3909 |
(unspec:VH [(match_operand:VH 1 "s_register_operand" "w") |
| 3910 |
(match_operand:V4HF 2 "s_register_operand" |
| 3911 |
"<scalar_mul_constraint>") |
| 3912 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3913 |
UNSPEC_VMUL_LANE))] |
| 3914 |
"TARGET_NEON_FP16INST" |
| 3915 |
"vmul.f16\t%<V_reg>0, %<V_reg>1, %P2[%c3]" |
| 3916 |
[(set_attr "type" "neon_fp_mul_s_scalar<q>")] |
| 3917 |
) |
| 3918 |
|
| 3919 |
(define_insn "neon_vmull<sup>_lane<mode>" |
| 3920 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 3921 |
(unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w") |
| 3922 |
(match_operand:VMDI 2 "s_register_operand" |
| 3923 |
"<scalar_mul_constraint>") |
| 3924 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3925 |
VMULL_LANE))] |
| 3926 |
"TARGET_NEON" |
| 3927 |
{ |
| 3928 |
return "vmull.<sup>%#<V_sz_elem>\t%q0, %P1, %P2[%c3]"; |
| 3929 |
} |
| 3930 |
[(set_attr "type" "neon_mul_<V_elem_ch>_scalar_long")] |
| 3931 |
) |
| 3932 |
|
| 3933 |
(define_insn "neon_vqdmull_lane<mode>" |
| 3934 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 3935 |
(unspec:<V_widen> [(match_operand:VMDI 1 "s_register_operand" "w") |
| 3936 |
(match_operand:VMDI 2 "s_register_operand" |
| 3937 |
"<scalar_mul_constraint>") |
| 3938 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3939 |
UNSPEC_VQDMULL_LANE))] |
| 3940 |
"TARGET_NEON" |
| 3941 |
{ |
| 3942 |
return "vqdmull.<V_s_elem>\t%q0, %P1, %P2[%c3]"; |
| 3943 |
} |
| 3944 |
[(set_attr "type" "neon_sat_mul_<V_elem_ch>_scalar_long")] |
| 3945 |
) |
| 3946 |
|
| 3947 |
(define_insn "neon_vq<r>dmulh_lane<mode>" |
| 3948 |
[(set (match_operand:VMQI 0 "s_register_operand" "=w") |
| 3949 |
(unspec:VMQI [(match_operand:VMQI 1 "s_register_operand" "w") |
| 3950 |
(match_operand:<V_HALF> 2 "s_register_operand" |
| 3951 |
"<scalar_mul_constraint>") |
| 3952 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3953 |
VQDMULH_LANE))] |
| 3954 |
"TARGET_NEON" |
| 3955 |
{ |
| 3956 |
return "vq<r>dmulh.<V_s_elem>\t%q0, %q1, %P2[%c3]"; |
| 3957 |
} |
| 3958 |
[(set_attr "type" "neon_sat_mul_<V_elem_ch>_scalar_q")] |
| 3959 |
) |
| 3960 |
|
| 3961 |
(define_insn "neon_vq<r>dmulh_lane<mode>" |
| 3962 |
[(set (match_operand:VMDI 0 "s_register_operand" "=w") |
| 3963 |
(unspec:VMDI [(match_operand:VMDI 1 "s_register_operand" "w") |
| 3964 |
(match_operand:VMDI 2 "s_register_operand" |
| 3965 |
"<scalar_mul_constraint>") |
| 3966 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 3967 |
VQDMULH_LANE))] |
| 3968 |
"TARGET_NEON" |
| 3969 |
{ |
| 3970 |
return "vq<r>dmulh.<V_s_elem>\t%P0, %P1, %P2[%c3]"; |
| 3971 |
} |
| 3972 |
[(set_attr "type" "neon_sat_mul_<V_elem_ch>_scalar_q")] |
| 3973 |
) |
| 3974 |
|
| 3975 |
;; vqrdmlah_lane, vqrdmlsh_lane |
| 3976 |
(define_insn "neon_vqrdml<VQRDMLH_AS:neon_rdma_as>h_lane<mode>" |
| 3977 |
[(set (match_operand:VMQI 0 "s_register_operand" "=w") |
| 3978 |
(unspec:VMQI [(match_operand:VMQI 1 "s_register_operand" "0") |
| 3979 |
(match_operand:VMQI 2 "s_register_operand" "w") |
| 3980 |
(match_operand:<V_HALF> 3 "s_register_operand" |
| 3981 |
"<scalar_mul_constraint>") |
| 3982 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3983 |
VQRDMLH_AS))] |
| 3984 |
"TARGET_NEON_RDMA" |
| 3985 |
{ |
| 3986 |
return |
| 3987 |
"vqrdml<VQRDMLH_AS:neon_rdma_as>h.<V_s_elem>\t%q0, %q2, %P3[%c4]"; |
| 3988 |
} |
| 3989 |
[(set_attr "type" "neon_mla_<V_elem_ch>_scalar<q>")] |
| 3990 |
) |
| 3991 |
|
| 3992 |
(define_insn "neon_vqrdml<VQRDMLH_AS:neon_rdma_as>h_lane<mode>" |
| 3993 |
[(set (match_operand:VMDI 0 "s_register_operand" "=w") |
| 3994 |
(unspec:VMDI [(match_operand:VMDI 1 "s_register_operand" "0") |
| 3995 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 3996 |
(match_operand:VMDI 3 "s_register_operand" |
| 3997 |
"<scalar_mul_constraint>") |
| 3998 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 3999 |
VQRDMLH_AS))] |
| 4000 |
"TARGET_NEON_RDMA" |
| 4001 |
{ |
| 4002 |
return |
| 4003 |
"vqrdml<VQRDMLH_AS:neon_rdma_as>h.<V_s_elem>\t%P0, %P2, %P3[%c4]"; |
| 4004 |
} |
| 4005 |
[(set_attr "type" "neon_mla_<V_elem_ch>_scalar")] |
| 4006 |
) |
| 4007 |
|
| 4008 |
(define_insn "neon_vmla_lane<mode>" |
| 4009 |
[(set (match_operand:VMD 0 "s_register_operand" "=w") |
| 4010 |
(unspec:VMD [(match_operand:VMD 1 "s_register_operand" "0") |
| 4011 |
(match_operand:VMD 2 "s_register_operand" "w") |
| 4012 |
(match_operand:VMD 3 "s_register_operand" |
| 4013 |
"<scalar_mul_constraint>") |
| 4014 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4015 |
UNSPEC_VMLA_LANE))] |
| 4016 |
"TARGET_NEON" |
| 4017 |
{ |
| 4018 |
return "vmla.<V_if_elem>\t%P0, %P2, %P3[%c4]"; |
| 4019 |
} |
| 4020 |
[(set (attr "type") |
| 4021 |
(if_then_else (match_test "<Is_float_mode>") |
| 4022 |
(const_string "neon_fp_mla_s_scalar<q>") |
| 4023 |
(const_string "neon_mla_<V_elem_ch>_scalar<q>")))] |
| 4024 |
) |
| 4025 |
|
| 4026 |
(define_insn "neon_vmla_lane<mode>" |
| 4027 |
[(set (match_operand:VMQ 0 "s_register_operand" "=w") |
| 4028 |
(unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "0") |
| 4029 |
(match_operand:VMQ 2 "s_register_operand" "w") |
| 4030 |
(match_operand:<V_HALF> 3 "s_register_operand" |
| 4031 |
"<scalar_mul_constraint>") |
| 4032 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4033 |
UNSPEC_VMLA_LANE))] |
| 4034 |
"TARGET_NEON" |
| 4035 |
{ |
| 4036 |
return "vmla.<V_if_elem>\t%q0, %q2, %P3[%c4]"; |
| 4037 |
} |
| 4038 |
[(set (attr "type") |
| 4039 |
(if_then_else (match_test "<Is_float_mode>") |
| 4040 |
(const_string "neon_fp_mla_s_scalar<q>") |
| 4041 |
(const_string "neon_mla_<V_elem_ch>_scalar<q>")))] |
| 4042 |
) |
| 4043 |
|
| 4044 |
(define_insn "neon_vmlal<sup>_lane<mode>" |
| 4045 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 4046 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 4047 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 4048 |
(match_operand:VMDI 3 "s_register_operand" |
| 4049 |
"<scalar_mul_constraint>") |
| 4050 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4051 |
VMLAL_LANE))] |
| 4052 |
"TARGET_NEON" |
| 4053 |
{ |
| 4054 |
return "vmlal.<sup>%#<V_sz_elem>\t%q0, %P2, %P3[%c4]"; |
| 4055 |
} |
| 4056 |
[(set_attr "type" "neon_mla_<V_elem_ch>_scalar_long")] |
| 4057 |
) |
| 4058 |
|
| 4059 |
(define_insn "neon_vqdmlal_lane<mode>" |
| 4060 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 4061 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 4062 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 4063 |
(match_operand:VMDI 3 "s_register_operand" |
| 4064 |
"<scalar_mul_constraint>") |
| 4065 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4066 |
UNSPEC_VQDMLAL_LANE))] |
| 4067 |
"TARGET_NEON" |
| 4068 |
{ |
| 4069 |
return "vqdmlal.<V_s_elem>\t%q0, %P2, %P3[%c4]"; |
| 4070 |
} |
| 4071 |
[(set_attr "type" "neon_sat_mla_<V_elem_ch>_scalar_long")] |
| 4072 |
) |
| 4073 |
|
| 4074 |
(define_insn "neon_vmls_lane<mode>" |
| 4075 |
[(set (match_operand:VMD 0 "s_register_operand" "=w") |
| 4076 |
(unspec:VMD [(match_operand:VMD 1 "s_register_operand" "0") |
| 4077 |
(match_operand:VMD 2 "s_register_operand" "w") |
| 4078 |
(match_operand:VMD 3 "s_register_operand" |
| 4079 |
"<scalar_mul_constraint>") |
| 4080 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4081 |
UNSPEC_VMLS_LANE))] |
| 4082 |
"TARGET_NEON" |
| 4083 |
{ |
| 4084 |
return "vmls.<V_if_elem>\t%P0, %P2, %P3[%c4]"; |
| 4085 |
} |
| 4086 |
[(set (attr "type") |
| 4087 |
(if_then_else (match_test "<Is_float_mode>") |
| 4088 |
(const_string "neon_fp_mla_s_scalar<q>") |
| 4089 |
(const_string "neon_mla_<V_elem_ch>_scalar<q>")))] |
| 4090 |
) |
| 4091 |
|
| 4092 |
(define_insn "neon_vmls_lane<mode>" |
| 4093 |
[(set (match_operand:VMQ 0 "s_register_operand" "=w") |
| 4094 |
(unspec:VMQ [(match_operand:VMQ 1 "s_register_operand" "0") |
| 4095 |
(match_operand:VMQ 2 "s_register_operand" "w") |
| 4096 |
(match_operand:<V_HALF> 3 "s_register_operand" |
| 4097 |
"<scalar_mul_constraint>") |
| 4098 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4099 |
UNSPEC_VMLS_LANE))] |
| 4100 |
"TARGET_NEON" |
| 4101 |
{ |
| 4102 |
return "vmls.<V_if_elem>\t%q0, %q2, %P3[%c4]"; |
| 4103 |
} |
| 4104 |
[(set (attr "type") |
| 4105 |
(if_then_else (match_test "<Is_float_mode>") |
| 4106 |
(const_string "neon_fp_mla_s_scalar<q>") |
| 4107 |
(const_string "neon_mla_<V_elem_ch>_scalar<q>")))] |
| 4108 |
) |
| 4109 |
|
| 4110 |
(define_insn "neon_vmlsl<sup>_lane<mode>" |
| 4111 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 4112 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 4113 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 4114 |
(match_operand:VMDI 3 "s_register_operand" |
| 4115 |
"<scalar_mul_constraint>") |
| 4116 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4117 |
VMLSL_LANE))] |
| 4118 |
"TARGET_NEON" |
| 4119 |
{ |
| 4120 |
return "vmlsl.<sup>%#<V_sz_elem>\t%q0, %P2, %P3[%c4]"; |
| 4121 |
} |
| 4122 |
[(set_attr "type" "neon_mla_<V_elem_ch>_scalar_long")] |
| 4123 |
) |
| 4124 |
|
| 4125 |
(define_insn "neon_vqdmlsl_lane<mode>" |
| 4126 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 4127 |
(unspec:<V_widen> [(match_operand:<V_widen> 1 "s_register_operand" "0") |
| 4128 |
(match_operand:VMDI 2 "s_register_operand" "w") |
| 4129 |
(match_operand:VMDI 3 "s_register_operand" |
| 4130 |
"<scalar_mul_constraint>") |
| 4131 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 4132 |
UNSPEC_VQDMLSL_LANE))] |
| 4133 |
"TARGET_NEON" |
| 4134 |
{ |
| 4135 |
return "vqdmlsl.<V_s_elem>\t%q0, %P2, %P3[%c4]"; |
| 4136 |
} |
| 4137 |
[(set_attr "type" "neon_sat_mla_<V_elem_ch>_scalar_long")] |
| 4138 |
) |
| 4139 |
|
| 4140 |
; FIXME: For the "_n" multiply/multiply-accumulate insns, we copy a value in a |
| 4141 |
; core register into a temp register, then use a scalar taken from that. This |
| 4142 |
; isn't an optimal solution if e.g. the scalar has just been read from memory |
| 4143 |
; or extracted from another vector. The latter case it's currently better to |
| 4144 |
; use the "_lane" variant, and the former case can probably be implemented |
| 4145 |
; using vld1_lane, but that hasn't been done yet. |
| 4146 |
|
| 4147 |
(define_expand "neon_vmul_n<mode>" |
| 4148 |
[(match_operand:VMD 0 "s_register_operand") |
| 4149 |
(match_operand:VMD 1 "s_register_operand") |
| 4150 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4151 |
"TARGET_NEON" |
| 4152 |
{ |
| 4153 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4154 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4155 |
emit_insn (gen_neon_vmul_lane<mode> (operands[0], operands[1], tmp, |
| 4156 |
const0_rtx)); |
| 4157 |
DONE; |
| 4158 |
}) |
| 4159 |
|
| 4160 |
(define_expand "neon_vmul_n<mode>" |
| 4161 |
[(match_operand:VMQ 0 "s_register_operand") |
| 4162 |
(match_operand:VMQ 1 "s_register_operand") |
| 4163 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4164 |
"TARGET_NEON" |
| 4165 |
{ |
| 4166 |
rtx tmp = gen_reg_rtx (<V_HALF>mode); |
| 4167 |
emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[2], tmp, const0_rtx)); |
| 4168 |
emit_insn (gen_neon_vmul_lane<mode> (operands[0], operands[1], tmp, |
| 4169 |
const0_rtx)); |
| 4170 |
DONE; |
| 4171 |
}) |
| 4172 |
|
| 4173 |
(define_expand "neon_vmul_n<mode>" |
| 4174 |
[(match_operand:VH 0 "s_register_operand") |
| 4175 |
(match_operand:VH 1 "s_register_operand") |
| 4176 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4177 |
"TARGET_NEON_FP16INST" |
| 4178 |
{ |
| 4179 |
rtx tmp = gen_reg_rtx (V4HFmode); |
| 4180 |
emit_insn (gen_neon_vset_lanev4hf (tmp, operands[2], tmp, const0_rtx)); |
| 4181 |
emit_insn (gen_neon_vmul_lane<mode> (operands[0], operands[1], tmp, |
| 4182 |
const0_rtx)); |
| 4183 |
DONE; |
| 4184 |
}) |
| 4185 |
|
| 4186 |
(define_expand "neon_vmulls_n<mode>" |
| 4187 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4188 |
(match_operand:VMDI 1 "s_register_operand") |
| 4189 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4190 |
"TARGET_NEON" |
| 4191 |
{ |
| 4192 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4193 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4194 |
emit_insn (gen_neon_vmulls_lane<mode> (operands[0], operands[1], tmp, |
| 4195 |
const0_rtx)); |
| 4196 |
DONE; |
| 4197 |
}) |
| 4198 |
|
| 4199 |
(define_expand "neon_vmullu_n<mode>" |
| 4200 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4201 |
(match_operand:VMDI 1 "s_register_operand") |
| 4202 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4203 |
"TARGET_NEON" |
| 4204 |
{ |
| 4205 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4206 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4207 |
emit_insn (gen_neon_vmullu_lane<mode> (operands[0], operands[1], tmp, |
| 4208 |
const0_rtx)); |
| 4209 |
DONE; |
| 4210 |
}) |
| 4211 |
|
| 4212 |
(define_expand "neon_vqdmull_n<mode>" |
| 4213 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4214 |
(match_operand:VMDI 1 "s_register_operand") |
| 4215 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4216 |
"TARGET_NEON" |
| 4217 |
{ |
| 4218 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4219 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4220 |
emit_insn (gen_neon_vqdmull_lane<mode> (operands[0], operands[1], tmp, |
| 4221 |
const0_rtx)); |
| 4222 |
DONE; |
| 4223 |
}) |
| 4224 |
|
| 4225 |
(define_expand "neon_vqdmulh_n<mode>" |
| 4226 |
[(match_operand:VMDI 0 "s_register_operand") |
| 4227 |
(match_operand:VMDI 1 "s_register_operand") |
| 4228 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4229 |
"TARGET_NEON" |
| 4230 |
{ |
| 4231 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4232 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4233 |
emit_insn (gen_neon_vqdmulh_lane<mode> (operands[0], operands[1], tmp, |
| 4234 |
const0_rtx)); |
| 4235 |
DONE; |
| 4236 |
}) |
| 4237 |
|
| 4238 |
(define_expand "neon_vqrdmulh_n<mode>" |
| 4239 |
[(match_operand:VMDI 0 "s_register_operand") |
| 4240 |
(match_operand:VMDI 1 "s_register_operand") |
| 4241 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4242 |
"TARGET_NEON" |
| 4243 |
{ |
| 4244 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4245 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[2], tmp, const0_rtx)); |
| 4246 |
emit_insn (gen_neon_vqrdmulh_lane<mode> (operands[0], operands[1], tmp, |
| 4247 |
const0_rtx)); |
| 4248 |
DONE; |
| 4249 |
}) |
| 4250 |
|
| 4251 |
(define_expand "neon_vqdmulh_n<mode>" |
| 4252 |
[(match_operand:VMQI 0 "s_register_operand") |
| 4253 |
(match_operand:VMQI 1 "s_register_operand") |
| 4254 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4255 |
"TARGET_NEON" |
| 4256 |
{ |
| 4257 |
rtx tmp = gen_reg_rtx (<V_HALF>mode); |
| 4258 |
emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[2], tmp, const0_rtx)); |
| 4259 |
emit_insn (gen_neon_vqdmulh_lane<mode> (operands[0], operands[1], tmp, |
| 4260 |
const0_rtx)); |
| 4261 |
DONE; |
| 4262 |
}) |
| 4263 |
|
| 4264 |
(define_expand "neon_vqrdmulh_n<mode>" |
| 4265 |
[(match_operand:VMQI 0 "s_register_operand") |
| 4266 |
(match_operand:VMQI 1 "s_register_operand") |
| 4267 |
(match_operand:<V_elem> 2 "s_register_operand")] |
| 4268 |
"TARGET_NEON" |
| 4269 |
{ |
| 4270 |
rtx tmp = gen_reg_rtx (<V_HALF>mode); |
| 4271 |
emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[2], tmp, const0_rtx)); |
| 4272 |
emit_insn (gen_neon_vqrdmulh_lane<mode> (operands[0], operands[1], tmp, |
| 4273 |
const0_rtx)); |
| 4274 |
DONE; |
| 4275 |
}) |
| 4276 |
|
| 4277 |
(define_expand "neon_vmla_n<mode>" |
| 4278 |
[(match_operand:VMD 0 "s_register_operand") |
| 4279 |
(match_operand:VMD 1 "s_register_operand") |
| 4280 |
(match_operand:VMD 2 "s_register_operand") |
| 4281 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4282 |
"TARGET_NEON" |
| 4283 |
{ |
| 4284 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4285 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4286 |
emit_insn (gen_neon_vmla_lane<mode> (operands[0], operands[1], operands[2], |
| 4287 |
tmp, const0_rtx)); |
| 4288 |
DONE; |
| 4289 |
}) |
| 4290 |
|
| 4291 |
(define_expand "neon_vmla_n<mode>" |
| 4292 |
[(match_operand:VMQ 0 "s_register_operand") |
| 4293 |
(match_operand:VMQ 1 "s_register_operand") |
| 4294 |
(match_operand:VMQ 2 "s_register_operand") |
| 4295 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4296 |
"TARGET_NEON" |
| 4297 |
{ |
| 4298 |
rtx tmp = gen_reg_rtx (<V_HALF>mode); |
| 4299 |
emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[3], tmp, const0_rtx)); |
| 4300 |
emit_insn (gen_neon_vmla_lane<mode> (operands[0], operands[1], operands[2], |
| 4301 |
tmp, const0_rtx)); |
| 4302 |
DONE; |
| 4303 |
}) |
| 4304 |
|
| 4305 |
(define_expand "neon_vmlals_n<mode>" |
| 4306 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4307 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4308 |
(match_operand:VMDI 2 "s_register_operand") |
| 4309 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4310 |
"TARGET_NEON" |
| 4311 |
{ |
| 4312 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4313 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4314 |
emit_insn (gen_neon_vmlals_lane<mode> (operands[0], operands[1], operands[2], |
| 4315 |
tmp, const0_rtx)); |
| 4316 |
DONE; |
| 4317 |
}) |
| 4318 |
|
| 4319 |
(define_expand "neon_vmlalu_n<mode>" |
| 4320 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4321 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4322 |
(match_operand:VMDI 2 "s_register_operand") |
| 4323 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4324 |
"TARGET_NEON" |
| 4325 |
{ |
| 4326 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4327 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4328 |
emit_insn (gen_neon_vmlalu_lane<mode> (operands[0], operands[1], operands[2], |
| 4329 |
tmp, const0_rtx)); |
| 4330 |
DONE; |
| 4331 |
}) |
| 4332 |
|
| 4333 |
(define_expand "neon_vqdmlal_n<mode>" |
| 4334 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4335 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4336 |
(match_operand:VMDI 2 "s_register_operand") |
| 4337 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4338 |
"TARGET_NEON" |
| 4339 |
{ |
| 4340 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4341 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4342 |
emit_insn (gen_neon_vqdmlal_lane<mode> (operands[0], operands[1], operands[2], |
| 4343 |
tmp, const0_rtx)); |
| 4344 |
DONE; |
| 4345 |
}) |
| 4346 |
|
| 4347 |
(define_expand "neon_vmls_n<mode>" |
| 4348 |
[(match_operand:VMD 0 "s_register_operand") |
| 4349 |
(match_operand:VMD 1 "s_register_operand") |
| 4350 |
(match_operand:VMD 2 "s_register_operand") |
| 4351 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4352 |
"TARGET_NEON" |
| 4353 |
{ |
| 4354 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4355 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4356 |
emit_insn (gen_neon_vmls_lane<mode> (operands[0], operands[1], operands[2], |
| 4357 |
tmp, const0_rtx)); |
| 4358 |
DONE; |
| 4359 |
}) |
| 4360 |
|
| 4361 |
(define_expand "neon_vmls_n<mode>" |
| 4362 |
[(match_operand:VMQ 0 "s_register_operand") |
| 4363 |
(match_operand:VMQ 1 "s_register_operand") |
| 4364 |
(match_operand:VMQ 2 "s_register_operand") |
| 4365 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4366 |
"TARGET_NEON" |
| 4367 |
{ |
| 4368 |
rtx tmp = gen_reg_rtx (<V_HALF>mode); |
| 4369 |
emit_insn (gen_neon_vset_lane<V_half> (tmp, operands[3], tmp, const0_rtx)); |
| 4370 |
emit_insn (gen_neon_vmls_lane<mode> (operands[0], operands[1], operands[2], |
| 4371 |
tmp, const0_rtx)); |
| 4372 |
DONE; |
| 4373 |
}) |
| 4374 |
|
| 4375 |
(define_expand "neon_vmlsls_n<mode>" |
| 4376 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4377 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4378 |
(match_operand:VMDI 2 "s_register_operand") |
| 4379 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4380 |
"TARGET_NEON" |
| 4381 |
{ |
| 4382 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4383 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4384 |
emit_insn (gen_neon_vmlsls_lane<mode> (operands[0], operands[1], operands[2], |
| 4385 |
tmp, const0_rtx)); |
| 4386 |
DONE; |
| 4387 |
}) |
| 4388 |
|
| 4389 |
(define_expand "neon_vmlslu_n<mode>" |
| 4390 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4391 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4392 |
(match_operand:VMDI 2 "s_register_operand") |
| 4393 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4394 |
"TARGET_NEON" |
| 4395 |
{ |
| 4396 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4397 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4398 |
emit_insn (gen_neon_vmlslu_lane<mode> (operands[0], operands[1], operands[2], |
| 4399 |
tmp, const0_rtx)); |
| 4400 |
DONE; |
| 4401 |
}) |
| 4402 |
|
| 4403 |
(define_expand "neon_vqdmlsl_n<mode>" |
| 4404 |
[(match_operand:<V_widen> 0 "s_register_operand") |
| 4405 |
(match_operand:<V_widen> 1 "s_register_operand") |
| 4406 |
(match_operand:VMDI 2 "s_register_operand") |
| 4407 |
(match_operand:<V_elem> 3 "s_register_operand")] |
| 4408 |
"TARGET_NEON" |
| 4409 |
{ |
| 4410 |
rtx tmp = gen_reg_rtx (<MODE>mode); |
| 4411 |
emit_insn (gen_neon_vset_lane<mode> (tmp, operands[3], tmp, const0_rtx)); |
| 4412 |
emit_insn (gen_neon_vqdmlsl_lane<mode> (operands[0], operands[1], operands[2], |
| 4413 |
tmp, const0_rtx)); |
| 4414 |
DONE; |
| 4415 |
}) |
| 4416 |
|
| 4417 |
(define_insn "@neon_vext<mode>" |
| 4418 |
[(set (match_operand:VDQX 0 "s_register_operand" "=w") |
| 4419 |
(unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w") |
| 4420 |
(match_operand:VDQX 2 "s_register_operand" "w") |
| 4421 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 4422 |
UNSPEC_VEXT))] |
| 4423 |
"TARGET_NEON" |
| 4424 |
{ |
| 4425 |
arm_const_bounds (operands[3], 0, GET_MODE_NUNITS (<MODE>mode)); |
| 4426 |
return "vext.<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2, %3"; |
| 4427 |
} |
| 4428 |
[(set_attr "type" "neon_ext<q>")] |
| 4429 |
) |
| 4430 |
|
| 4431 |
(define_insn "@neon_vrev64<mode>" |
| 4432 |
[(set (match_operand:VDQ 0 "s_register_operand" "=w") |
| 4433 |
(unspec:VDQ [(match_operand:VDQ 1 "s_register_operand" "w")] |
| 4434 |
UNSPEC_VREV64))] |
| 4435 |
"TARGET_NEON" |
| 4436 |
"vrev64.<V_sz_elem>\t%<V_reg>0, %<V_reg>1" |
| 4437 |
[(set_attr "type" "neon_rev<q>")] |
| 4438 |
) |
| 4439 |
|
| 4440 |
(define_insn "@neon_vrev32<mode>" |
| 4441 |
[(set (match_operand:VX 0 "s_register_operand" "=w") |
| 4442 |
(unspec:VX [(match_operand:VX 1 "s_register_operand" "w")] |
| 4443 |
UNSPEC_VREV32))] |
| 4444 |
"TARGET_NEON" |
| 4445 |
"vrev32.<V_sz_elem>\t%<V_reg>0, %<V_reg>1" |
| 4446 |
[(set_attr "type" "neon_rev<q>")] |
| 4447 |
) |
| 4448 |
|
| 4449 |
(define_insn "@neon_vrev16<mode>" |
| 4450 |
[(set (match_operand:VE 0 "s_register_operand" "=w") |
| 4451 |
(unspec:VE [(match_operand:VE 1 "s_register_operand" "w")] |
| 4452 |
UNSPEC_VREV16))] |
| 4453 |
"TARGET_NEON" |
| 4454 |
"vrev16.<V_sz_elem>\t%<V_reg>0, %<V_reg>1" |
| 4455 |
[(set_attr "type" "neon_rev<q>")] |
| 4456 |
) |
| 4457 |
|
| 4458 |
; vbsl_* intrinsics may compile to any of vbsl/vbif/vbit depending on register |
| 4459 |
; allocation. For an intrinsic of form: |
| 4460 |
; rD = vbsl_* (rS, rN, rM) |
| 4461 |
; We can use any of: |
| 4462 |
; vbsl rS, rN, rM (if D = S) |
| 4463 |
; vbit rD, rN, rS (if D = M, so 1-bits in rS choose bits from rN, else rM) |
| 4464 |
; vbif rD, rM, rS (if D = N, so 0-bits in rS choose bits from rM, else rN) |
| 4465 |
|
| 4466 |
(define_insn "neon_vbsl<mode>_internal" |
| 4467 |
[(set (match_operand:VDQX 0 "s_register_operand" "=w,w,w") |
| 4468 |
(unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" " 0,w,w") |
| 4469 |
(match_operand:VDQX 2 "s_register_operand" " w,w,0") |
| 4470 |
(match_operand:VDQX 3 "s_register_operand" " w,0,w")] |
| 4471 |
UNSPEC_VBSL))] |
| 4472 |
"TARGET_NEON" |
| 4473 |
"@ |
| 4474 |
vbsl\t%<V_reg>0, %<V_reg>2, %<V_reg>3 |
| 4475 |
vbit\t%<V_reg>0, %<V_reg>2, %<V_reg>1 |
| 4476 |
vbif\t%<V_reg>0, %<V_reg>3, %<V_reg>1" |
| 4477 |
[(set_attr "type" "neon_bsl<q>")] |
| 4478 |
) |
| 4479 |
|
| 4480 |
(define_expand "@neon_vbsl<mode>" |
| 4481 |
[(set (match_operand:VDQX 0 "s_register_operand") |
| 4482 |
(unspec:VDQX [(match_operand:<V_cmp_result> 1 "s_register_operand") |
| 4483 |
(match_operand:VDQX 2 "s_register_operand") |
| 4484 |
(match_operand:VDQX 3 "s_register_operand")] |
| 4485 |
UNSPEC_VBSL))] |
| 4486 |
"TARGET_NEON" |
| 4487 |
{ |
| 4488 |
/* We can't alias operands together if they have different modes. */ |
| 4489 |
operands[1] = gen_lowpart (<MODE>mode, operands[1]); |
| 4490 |
}) |
| 4491 |
|
| 4492 |
;; vshl, vrshl |
| 4493 |
(define_insn "neon_v<shift_op><sup><mode>" |
| 4494 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4495 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4496 |
(match_operand:VDQIX 2 "s_register_operand" "w")] |
| 4497 |
VSHL))] |
| 4498 |
"TARGET_NEON" |
| 4499 |
"v<shift_op>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 4500 |
[(set_attr "type" "neon_shift_imm<q>")] |
| 4501 |
) |
| 4502 |
|
| 4503 |
;; vqshl, vqrshl |
| 4504 |
(define_insn "neon_v<shift_op><sup><mode>" |
| 4505 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4506 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4507 |
(match_operand:VDQIX 2 "s_register_operand" "w")] |
| 4508 |
VQSHL))] |
| 4509 |
"TARGET_NEON" |
| 4510 |
"v<shift_op>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 4511 |
[(set_attr "type" "neon_sat_shift_imm<q>")] |
| 4512 |
) |
| 4513 |
|
| 4514 |
;; vshr_n, vrshr_n |
| 4515 |
(define_insn "neon_v<shift_op><sup>_n<mode>" |
| 4516 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4517 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4518 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4519 |
VSHR_N))] |
| 4520 |
"TARGET_NEON" |
| 4521 |
{ |
| 4522 |
arm_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) + 1); |
| 4523 |
return "v<shift_op>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %2"; |
| 4524 |
} |
| 4525 |
[(set_attr "type" "neon_shift_imm<q>")] |
| 4526 |
) |
| 4527 |
|
| 4528 |
;; vshrn_n, vrshrn_n |
| 4529 |
(define_insn "neon_v<shift_op>_n<mode>" |
| 4530 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 4531 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w") |
| 4532 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4533 |
VSHRN_N))] |
| 4534 |
"TARGET_NEON" |
| 4535 |
{ |
| 4536 |
arm_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1); |
| 4537 |
return "v<shift_op>.<V_if_elem>\t%P0, %q1, %2"; |
| 4538 |
} |
| 4539 |
[(set_attr "type" "neon_shift_imm_narrow_q")] |
| 4540 |
) |
| 4541 |
|
| 4542 |
;; vqshrn_n, vqrshrn_n |
| 4543 |
(define_insn "neon_v<shift_op><sup>_n<mode>" |
| 4544 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 4545 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w") |
| 4546 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4547 |
VQSHRN_N))] |
| 4548 |
"TARGET_NEON" |
| 4549 |
{ |
| 4550 |
arm_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1); |
| 4551 |
return "v<shift_op>.<sup>%#<V_sz_elem>\t%P0, %q1, %2"; |
| 4552 |
} |
| 4553 |
[(set_attr "type" "neon_sat_shift_imm_narrow_q")] |
| 4554 |
) |
| 4555 |
|
| 4556 |
;; vqshrun_n, vqrshrun_n |
| 4557 |
(define_insn "neon_v<shift_op>_n<mode>" |
| 4558 |
[(set (match_operand:<V_narrow> 0 "s_register_operand" "=w") |
| 4559 |
(unspec:<V_narrow> [(match_operand:VN 1 "s_register_operand" "w") |
| 4560 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4561 |
VQSHRUN_N))] |
| 4562 |
"TARGET_NEON" |
| 4563 |
{ |
| 4564 |
arm_const_bounds (operands[2], 1, neon_element_bits (<MODE>mode) / 2 + 1); |
| 4565 |
return "v<shift_op>.<V_s_elem>\t%P0, %q1, %2"; |
| 4566 |
} |
| 4567 |
[(set_attr "type" "neon_sat_shift_imm_narrow_q")] |
| 4568 |
) |
| 4569 |
|
| 4570 |
(define_insn "neon_vshl_n<mode>" |
| 4571 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4572 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4573 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4574 |
UNSPEC_VSHL_N))] |
| 4575 |
"TARGET_NEON" |
| 4576 |
{ |
| 4577 |
arm_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode)); |
| 4578 |
return "vshl.<V_if_elem>\t%<V_reg>0, %<V_reg>1, %2"; |
| 4579 |
} |
| 4580 |
[(set_attr "type" "neon_shift_imm<q>")] |
| 4581 |
) |
| 4582 |
|
| 4583 |
(define_insn "neon_vqshl_<sup>_n<mode>" |
| 4584 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4585 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4586 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4587 |
VQSHL_N))] |
| 4588 |
"TARGET_NEON" |
| 4589 |
{ |
| 4590 |
arm_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode)); |
| 4591 |
return "vqshl.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>1, %2"; |
| 4592 |
} |
| 4593 |
[(set_attr "type" "neon_sat_shift_imm<q>")] |
| 4594 |
) |
| 4595 |
|
| 4596 |
(define_insn "neon_vqshlu_n<mode>" |
| 4597 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4598 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "w") |
| 4599 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4600 |
UNSPEC_VQSHLU_N))] |
| 4601 |
"TARGET_NEON" |
| 4602 |
{ |
| 4603 |
arm_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode)); |
| 4604 |
return "vqshlu.<V_s_elem>\t%<V_reg>0, %<V_reg>1, %2"; |
| 4605 |
} |
| 4606 |
[(set_attr "type" "neon_sat_shift_imm<q>")] |
| 4607 |
) |
| 4608 |
|
| 4609 |
(define_insn "neon_vshll<sup>_n<mode>" |
| 4610 |
[(set (match_operand:<V_widen> 0 "s_register_operand" "=w") |
| 4611 |
(unspec:<V_widen> [(match_operand:VW 1 "s_register_operand" "w") |
| 4612 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 4613 |
VSHLL_N))] |
| 4614 |
"TARGET_NEON" |
| 4615 |
{ |
| 4616 |
/* The boundaries are: 0 < imm <= size. */ |
| 4617 |
arm_const_bounds (operands[2], 0, neon_element_bits (<MODE>mode) + 1); |
| 4618 |
return "vshll.<sup>%#<V_sz_elem>\t%q0, %P1, %2"; |
| 4619 |
} |
| 4620 |
[(set_attr "type" "neon_shift_imm_long")] |
| 4621 |
) |
| 4622 |
|
| 4623 |
;; vsra_n, vrsra_n |
| 4624 |
(define_insn "neon_v<shift_op><sup>_n<mode>" |
| 4625 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4626 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0") |
| 4627 |
(match_operand:VDQIX 2 "s_register_operand" "w") |
| 4628 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 4629 |
VSRA_N))] |
| 4630 |
"TARGET_NEON" |
| 4631 |
{ |
| 4632 |
arm_const_bounds (operands[3], 1, neon_element_bits (<MODE>mode) + 1); |
| 4633 |
return "v<shift_op>.<sup>%#<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3"; |
| 4634 |
} |
| 4635 |
[(set_attr "type" "neon_shift_acc<q>")] |
| 4636 |
) |
| 4637 |
|
| 4638 |
(define_insn "neon_vsri_n<mode>" |
| 4639 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4640 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0") |
| 4641 |
(match_operand:VDQIX 2 "s_register_operand" "w") |
| 4642 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 4643 |
UNSPEC_VSRI))] |
| 4644 |
"TARGET_NEON" |
| 4645 |
{ |
| 4646 |
arm_const_bounds (operands[3], 1, neon_element_bits (<MODE>mode) + 1); |
| 4647 |
return "vsri.<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3"; |
| 4648 |
} |
| 4649 |
[(set_attr "type" "neon_shift_reg<q>")] |
| 4650 |
) |
| 4651 |
|
| 4652 |
(define_insn "neon_vsli_n<mode>" |
| 4653 |
[(set (match_operand:VDQIX 0 "s_register_operand" "=w") |
| 4654 |
(unspec:VDQIX [(match_operand:VDQIX 1 "s_register_operand" "0") |
| 4655 |
(match_operand:VDQIX 2 "s_register_operand" "w") |
| 4656 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 4657 |
UNSPEC_VSLI))] |
| 4658 |
"TARGET_NEON" |
| 4659 |
{ |
| 4660 |
arm_const_bounds (operands[3], 0, neon_element_bits (<MODE>mode)); |
| 4661 |
return "vsli.<V_sz_elem>\t%<V_reg>0, %<V_reg>2, %3"; |
| 4662 |
} |
| 4663 |
[(set_attr "type" "neon_shift_reg<q>")] |
| 4664 |
) |
| 4665 |
|
| 4666 |
(define_insn "neon_vtbl1v8qi" |
| 4667 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4668 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "w") |
| 4669 |
(match_operand:V8QI 2 "s_register_operand" "w")] |
| 4670 |
UNSPEC_VTBL))] |
| 4671 |
"TARGET_NEON" |
| 4672 |
"vtbl.8\t%P0, {%P1}, %P2" |
| 4673 |
[(set_attr "type" "neon_tbl1")] |
| 4674 |
) |
| 4675 |
|
| 4676 |
(define_insn "neon_vtbl2v8qi" |
| 4677 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4678 |
(unspec:V8QI [(match_operand:TI 1 "s_register_operand" "w") |
| 4679 |
(match_operand:V8QI 2 "s_register_operand" "w")] |
| 4680 |
UNSPEC_VTBL))] |
| 4681 |
"TARGET_NEON" |
| 4682 |
{ |
| 4683 |
rtx ops[4]; |
| 4684 |
int tabbase = REGNO (operands[1]); |
| 4685 |
|
| 4686 |
ops[0] = operands[0]; |
| 4687 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4688 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4689 |
ops[3] = operands[2]; |
| 4690 |
output_asm_insn ("vtbl.8\t%P0, {%P1, %P2}, %P3", ops); |
| 4691 |
|
| 4692 |
return ""; |
| 4693 |
} |
| 4694 |
[(set_attr "type" "neon_tbl2")] |
| 4695 |
) |
| 4696 |
|
| 4697 |
(define_insn "neon_vtbl3v8qi" |
| 4698 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4699 |
(unspec:V8QI [(match_operand:EI 1 "s_register_operand" "w") |
| 4700 |
(match_operand:V8QI 2 "s_register_operand" "w")] |
| 4701 |
UNSPEC_VTBL))] |
| 4702 |
"TARGET_NEON" |
| 4703 |
{ |
| 4704 |
rtx ops[5]; |
| 4705 |
int tabbase = REGNO (operands[1]); |
| 4706 |
|
| 4707 |
ops[0] = operands[0]; |
| 4708 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4709 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4710 |
ops[3] = gen_rtx_REG (V8QImode, tabbase + 4); |
| 4711 |
ops[4] = operands[2]; |
| 4712 |
output_asm_insn ("vtbl.8\t%P0, {%P1, %P2, %P3}, %P4", ops); |
| 4713 |
|
| 4714 |
return ""; |
| 4715 |
} |
| 4716 |
[(set_attr "type" "neon_tbl3")] |
| 4717 |
) |
| 4718 |
|
| 4719 |
(define_insn "neon_vtbl4v8qi" |
| 4720 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4721 |
(unspec:V8QI [(match_operand:OI 1 "s_register_operand" "w") |
| 4722 |
(match_operand:V8QI 2 "s_register_operand" "w")] |
| 4723 |
UNSPEC_VTBL))] |
| 4724 |
"TARGET_NEON" |
| 4725 |
{ |
| 4726 |
rtx ops[6]; |
| 4727 |
int tabbase = REGNO (operands[1]); |
| 4728 |
|
| 4729 |
ops[0] = operands[0]; |
| 4730 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4731 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4732 |
ops[3] = gen_rtx_REG (V8QImode, tabbase + 4); |
| 4733 |
ops[4] = gen_rtx_REG (V8QImode, tabbase + 6); |
| 4734 |
ops[5] = operands[2]; |
| 4735 |
output_asm_insn ("vtbl.8\t%P0, {%P1, %P2, %P3, %P4}, %P5", ops); |
| 4736 |
|
| 4737 |
return ""; |
| 4738 |
} |
| 4739 |
[(set_attr "type" "neon_tbl4")] |
| 4740 |
) |
| 4741 |
|
| 4742 |
;; These three are used by the vec_perm infrastructure for V16QImode. |
| 4743 |
(define_insn_and_split "neon_vtbl1v16qi" |
| 4744 |
[(set (match_operand:V16QI 0 "s_register_operand" "=&w") |
| 4745 |
(unspec:V16QI [(match_operand:V16QI 1 "s_register_operand" "w") |
| 4746 |
(match_operand:V16QI 2 "s_register_operand" "w")] |
| 4747 |
UNSPEC_VTBL))] |
| 4748 |
"TARGET_NEON" |
| 4749 |
"#" |
| 4750 |
"&& reload_completed" |
| 4751 |
[(const_int 0)] |
| 4752 |
{ |
| 4753 |
rtx op0, op1, op2, part0, part2; |
| 4754 |
unsigned ofs; |
| 4755 |
|
| 4756 |
op0 = operands[0]; |
| 4757 |
op1 = gen_lowpart (TImode, operands[1]); |
| 4758 |
op2 = operands[2]; |
| 4759 |
|
| 4760 |
ofs = subreg_lowpart_offset (V8QImode, V16QImode); |
| 4761 |
part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs); |
| 4762 |
part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs); |
| 4763 |
emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2)); |
| 4764 |
|
| 4765 |
ofs = subreg_highpart_offset (V8QImode, V16QImode); |
| 4766 |
part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs); |
| 4767 |
part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs); |
| 4768 |
emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2)); |
| 4769 |
DONE; |
| 4770 |
} |
| 4771 |
[(set_attr "type" "multiple")] |
| 4772 |
) |
| 4773 |
|
| 4774 |
(define_insn_and_split "neon_vtbl2v16qi" |
| 4775 |
[(set (match_operand:V16QI 0 "s_register_operand" "=&w") |
| 4776 |
(unspec:V16QI [(match_operand:OI 1 "s_register_operand" "w") |
| 4777 |
(match_operand:V16QI 2 "s_register_operand" "w")] |
| 4778 |
UNSPEC_VTBL))] |
| 4779 |
"TARGET_NEON" |
| 4780 |
"#" |
| 4781 |
"&& reload_completed" |
| 4782 |
[(const_int 0)] |
| 4783 |
{ |
| 4784 |
rtx op0, op1, op2, part0, part2; |
| 4785 |
unsigned ofs; |
| 4786 |
|
| 4787 |
op0 = operands[0]; |
| 4788 |
op1 = operands[1]; |
| 4789 |
op2 = operands[2]; |
| 4790 |
|
| 4791 |
ofs = subreg_lowpart_offset (V8QImode, V16QImode); |
| 4792 |
part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs); |
| 4793 |
part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs); |
| 4794 |
emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2)); |
| 4795 |
|
| 4796 |
ofs = subreg_highpart_offset (V8QImode, V16QImode); |
| 4797 |
part0 = simplify_subreg (V8QImode, op0, V16QImode, ofs); |
| 4798 |
part2 = simplify_subreg (V8QImode, op2, V16QImode, ofs); |
| 4799 |
emit_insn (gen_neon_vtbl2v8qi (part0, op1, part2)); |
| 4800 |
DONE; |
| 4801 |
} |
| 4802 |
[(set_attr "type" "multiple")] |
| 4803 |
) |
| 4804 |
|
| 4805 |
;; ??? Logically we should extend the regular neon_vcombine pattern to |
| 4806 |
;; handle quad-word input modes, producing octa-word output modes. But |
| 4807 |
;; that requires us to add support for octa-word vector modes in moves. |
| 4808 |
;; That seems overkill for this one use in vec_perm. |
| 4809 |
(define_insn_and_split "neon_vcombinev16qi" |
| 4810 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 4811 |
(unspec:OI [(match_operand:V16QI 1 "s_register_operand" "w") |
| 4812 |
(match_operand:V16QI 2 "s_register_operand" "w")] |
| 4813 |
UNSPEC_VCONCAT))] |
| 4814 |
"TARGET_NEON" |
| 4815 |
"#" |
| 4816 |
"&& reload_completed" |
| 4817 |
[(const_int 0)] |
| 4818 |
{ |
| 4819 |
neon_split_vcombine (operands); |
| 4820 |
DONE; |
| 4821 |
} |
| 4822 |
[(set_attr "type" "multiple")] |
| 4823 |
) |
| 4824 |
|
| 4825 |
(define_insn "neon_vtbx1v8qi" |
| 4826 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4827 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0") |
| 4828 |
(match_operand:V8QI 2 "s_register_operand" "w") |
| 4829 |
(match_operand:V8QI 3 "s_register_operand" "w")] |
| 4830 |
UNSPEC_VTBX))] |
| 4831 |
"TARGET_NEON" |
| 4832 |
"vtbx.8\t%P0, {%P2}, %P3" |
| 4833 |
[(set_attr "type" "neon_tbl1")] |
| 4834 |
) |
| 4835 |
|
| 4836 |
(define_insn "neon_vtbx2v8qi" |
| 4837 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4838 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0") |
| 4839 |
(match_operand:TI 2 "s_register_operand" "w") |
| 4840 |
(match_operand:V8QI 3 "s_register_operand" "w")] |
| 4841 |
UNSPEC_VTBX))] |
| 4842 |
"TARGET_NEON" |
| 4843 |
{ |
| 4844 |
rtx ops[4]; |
| 4845 |
int tabbase = REGNO (operands[2]); |
| 4846 |
|
| 4847 |
ops[0] = operands[0]; |
| 4848 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4849 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4850 |
ops[3] = operands[3]; |
| 4851 |
output_asm_insn ("vtbx.8\t%P0, {%P1, %P2}, %P3", ops); |
| 4852 |
|
| 4853 |
return ""; |
| 4854 |
} |
| 4855 |
[(set_attr "type" "neon_tbl2")] |
| 4856 |
) |
| 4857 |
|
| 4858 |
(define_insn "neon_vtbx3v8qi" |
| 4859 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4860 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0") |
| 4861 |
(match_operand:EI 2 "s_register_operand" "w") |
| 4862 |
(match_operand:V8QI 3 "s_register_operand" "w")] |
| 4863 |
UNSPEC_VTBX))] |
| 4864 |
"TARGET_NEON" |
| 4865 |
{ |
| 4866 |
rtx ops[5]; |
| 4867 |
int tabbase = REGNO (operands[2]); |
| 4868 |
|
| 4869 |
ops[0] = operands[0]; |
| 4870 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4871 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4872 |
ops[3] = gen_rtx_REG (V8QImode, tabbase + 4); |
| 4873 |
ops[4] = operands[3]; |
| 4874 |
output_asm_insn ("vtbx.8\t%P0, {%P1, %P2, %P3}, %P4", ops); |
| 4875 |
|
| 4876 |
return ""; |
| 4877 |
} |
| 4878 |
[(set_attr "type" "neon_tbl3")] |
| 4879 |
) |
| 4880 |
|
| 4881 |
(define_insn "neon_vtbx4v8qi" |
| 4882 |
[(set (match_operand:V8QI 0 "s_register_operand" "=w") |
| 4883 |
(unspec:V8QI [(match_operand:V8QI 1 "s_register_operand" "0") |
| 4884 |
(match_operand:OI 2 "s_register_operand" "w") |
| 4885 |
(match_operand:V8QI 3 "s_register_operand" "w")] |
| 4886 |
UNSPEC_VTBX))] |
| 4887 |
"TARGET_NEON" |
| 4888 |
{ |
| 4889 |
rtx ops[6]; |
| 4890 |
int tabbase = REGNO (operands[2]); |
| 4891 |
|
| 4892 |
ops[0] = operands[0]; |
| 4893 |
ops[1] = gen_rtx_REG (V8QImode, tabbase); |
| 4894 |
ops[2] = gen_rtx_REG (V8QImode, tabbase + 2); |
| 4895 |
ops[3] = gen_rtx_REG (V8QImode, tabbase + 4); |
| 4896 |
ops[4] = gen_rtx_REG (V8QImode, tabbase + 6); |
| 4897 |
ops[5] = operands[3]; |
| 4898 |
output_asm_insn ("vtbx.8\t%P0, {%P1, %P2, %P3, %P4}, %P5", ops); |
| 4899 |
|
| 4900 |
return ""; |
| 4901 |
} |
| 4902 |
[(set_attr "type" "neon_tbl4")] |
| 4903 |
) |
| 4904 |
|
| 4905 |
(define_expand "@neon_vtrn<mode>_internal" |
| 4906 |
[(parallel |
| 4907 |
[(set (match_operand:VDQWH 0 "s_register_operand") |
| 4908 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand") |
| 4909 |
(match_operand:VDQWH 2 "s_register_operand")] |
| 4910 |
UNSPEC_VTRN1)) |
| 4911 |
(set (match_operand:VDQWH 3 "s_register_operand") |
| 4912 |
(unspec:VDQWH [(match_dup 1) (match_dup 2)] UNSPEC_VTRN2))])] |
| 4913 |
"TARGET_NEON" |
| 4914 |
"" |
| 4915 |
) |
| 4916 |
|
| 4917 |
;; Note: Different operand numbering to handle tied registers correctly. |
| 4918 |
(define_insn "*neon_vtrn<mode>_insn" |
| 4919 |
[(set (match_operand:VDQWH 0 "s_register_operand" "=&w") |
| 4920 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand" "0") |
| 4921 |
(match_operand:VDQWH 3 "s_register_operand" "2")] |
| 4922 |
UNSPEC_VTRN1)) |
| 4923 |
(set (match_operand:VDQWH 2 "s_register_operand" "=&w") |
| 4924 |
(unspec:VDQWH [(match_dup 1) (match_dup 3)] |
| 4925 |
UNSPEC_VTRN2))] |
| 4926 |
"TARGET_NEON" |
| 4927 |
"vtrn.<V_sz_elem>\t%<V_reg>0, %<V_reg>2" |
| 4928 |
[(set_attr "type" "neon_permute<q>")] |
| 4929 |
) |
| 4930 |
|
| 4931 |
(define_expand "@neon_vzip<mode>_internal" |
| 4932 |
[(parallel |
| 4933 |
[(set (match_operand:VDQWH 0 "s_register_operand") |
| 4934 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand") |
| 4935 |
(match_operand:VDQWH 2 "s_register_operand")] |
| 4936 |
UNSPEC_VZIP1)) |
| 4937 |
(set (match_operand:VDQWH 3 "s_register_operand") |
| 4938 |
(unspec:VDQWH [(match_dup 1) (match_dup 2)] UNSPEC_VZIP2))])] |
| 4939 |
"TARGET_NEON" |
| 4940 |
"" |
| 4941 |
) |
| 4942 |
|
| 4943 |
;; Note: Different operand numbering to handle tied registers correctly. |
| 4944 |
(define_insn "*neon_vzip<mode>_insn" |
| 4945 |
[(set (match_operand:VDQWH 0 "s_register_operand" "=&w") |
| 4946 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand" "0") |
| 4947 |
(match_operand:VDQWH 3 "s_register_operand" "2")] |
| 4948 |
UNSPEC_VZIP1)) |
| 4949 |
(set (match_operand:VDQWH 2 "s_register_operand" "=&w") |
| 4950 |
(unspec:VDQWH [(match_dup 1) (match_dup 3)] |
| 4951 |
UNSPEC_VZIP2))] |
| 4952 |
"TARGET_NEON" |
| 4953 |
"vzip.<V_sz_elem>\t%<V_reg>0, %<V_reg>2" |
| 4954 |
[(set_attr "type" "neon_zip<q>")] |
| 4955 |
) |
| 4956 |
|
| 4957 |
(define_expand "@neon_vuzp<mode>_internal" |
| 4958 |
[(parallel |
| 4959 |
[(set (match_operand:VDQWH 0 "s_register_operand") |
| 4960 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand") |
| 4961 |
(match_operand:VDQWH 2 "s_register_operand")] |
| 4962 |
UNSPEC_VUZP1)) |
| 4963 |
(set (match_operand:VDQWH 3 "s_register_operand") |
| 4964 |
(unspec:VDQWH [(match_dup 1) (match_dup 2)] UNSPEC_VUZP2))])] |
| 4965 |
"TARGET_NEON" |
| 4966 |
"" |
| 4967 |
) |
| 4968 |
|
| 4969 |
;; Note: Different operand numbering to handle tied registers correctly. |
| 4970 |
(define_insn "*neon_vuzp<mode>_insn" |
| 4971 |
[(set (match_operand:VDQWH 0 "s_register_operand" "=&w") |
| 4972 |
(unspec:VDQWH [(match_operand:VDQWH 1 "s_register_operand" "0") |
| 4973 |
(match_operand:VDQWH 3 "s_register_operand" "2")] |
| 4974 |
UNSPEC_VUZP1)) |
| 4975 |
(set (match_operand:VDQWH 2 "s_register_operand" "=&w") |
| 4976 |
(unspec:VDQWH [(match_dup 1) (match_dup 3)] |
| 4977 |
UNSPEC_VUZP2))] |
| 4978 |
"TARGET_NEON" |
| 4979 |
"vuzp.<V_sz_elem>\t%<V_reg>0, %<V_reg>2" |
| 4980 |
[(set_attr "type" "neon_zip<q>")] |
| 4981 |
) |
| 4982 |
|
| 4983 |
(define_expand "vec_load_lanes<mode><mode>" |
| 4984 |
[(set (match_operand:VDQX 0 "s_register_operand") |
| 4985 |
(unspec:VDQX [(match_operand:VDQX 1 "neon_struct_operand")] |
| 4986 |
UNSPEC_VLD1))] |
| 4987 |
"TARGET_NEON") |
| 4988 |
|
| 4989 |
(define_insn "neon_vld1<mode>" |
| 4990 |
[(set (match_operand:VDQX 0 "s_register_operand" "=w") |
| 4991 |
(unspec:VDQX [(match_operand:VDQX 1 "neon_struct_operand" "Um")] |
| 4992 |
UNSPEC_VLD1))] |
| 4993 |
"TARGET_NEON" |
| 4994 |
"vld1.<V_sz_elem>\t%h0, %A1" |
| 4995 |
[(set_attr "type" "neon_load1_1reg<q>")] |
| 4996 |
) |
| 4997 |
|
| 4998 |
(define_insn "neon_vld1<VMEMX2_q>_x2<VDQX:mode>" |
| 4999 |
[(set (match_operand:VMEMX2 0 "s_register_operand" "=w") |
| 5000 |
(unspec:VMEMX2 [(match_operand:VMEMX2 1 "neon_struct_operand" "Um") |
| 5001 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5002 |
UNSPEC_VLD1))] |
| 5003 |
"TARGET_NEON" |
| 5004 |
"vld1.<V_sz_elem>\t%h0, %A1" |
| 5005 |
[(set_attr "type" "neon_load1_2reg<q>")] |
| 5006 |
) |
| 5007 |
|
| 5008 |
(define_insn "neon_vld1_x3<mode>" |
| 5009 |
[(set (match_operand:EI 0 "s_register_operand" "=w") |
| 5010 |
(unspec:EI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5011 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5012 |
UNSPEC_VLD1))] |
| 5013 |
"TARGET_NEON" |
| 5014 |
"vld1.<V_sz_elem>\t%h0, %A1" |
| 5015 |
[(set_attr "type" "neon_load1_3reg<q>")] |
| 5016 |
) |
| 5017 |
|
| 5018 |
(define_expand "neon_vld1q_x3<mode>" |
| 5019 |
[(match_operand:CI 0 "s_register_operand") |
| 5020 |
(match_operand:CI 1 "neon_struct_operand") |
| 5021 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5022 |
"TARGET_NEON" |
| 5023 |
{ |
| 5024 |
rtx mem = adjust_address (operands[1], EImode, 0); |
| 5025 |
emit_insn (gen_neon_vld1x3qa<mode> (operands[0], mem)); |
| 5026 |
mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode)); |
| 5027 |
emit_insn (gen_neon_vld1x3qb<mode> (operands[0], mem, operands[0])); |
| 5028 |
DONE; |
| 5029 |
}) |
| 5030 |
|
| 5031 |
(define_insn "neon_vld1x3qa<mode>" |
| 5032 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5033 |
(unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5034 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5035 |
UNSPEC_VLD1X3A))] |
| 5036 |
"TARGET_NEON" |
| 5037 |
{ |
| 5038 |
rtx ops[2]; |
| 5039 |
ops[0] = gen_rtx_REG (EImode, REGNO (operands[0])); |
| 5040 |
ops[1] = operands[1]; |
| 5041 |
|
| 5042 |
output_asm_insn ("vld1.<V_sz_elem>\t%h0, %A1", ops); |
| 5043 |
return ""; |
| 5044 |
} |
| 5045 |
[(set_attr "type" "neon_load1_3reg<q>")] |
| 5046 |
) |
| 5047 |
|
| 5048 |
(define_insn "neon_vld1x3qb<mode>" |
| 5049 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5050 |
(unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5051 |
(match_operand:CI 2 "s_register_operand" "0") |
| 5052 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5053 |
UNSPEC_VLD1X3B))] |
| 5054 |
"TARGET_NEON" |
| 5055 |
{ |
| 5056 |
rtx ops[2]; |
| 5057 |
ops[0] = gen_rtx_REG (EImode, REGNO (operands[0]) + 6); |
| 5058 |
ops[1] = operands[1]; |
| 5059 |
|
| 5060 |
output_asm_insn ("vld1.<V_sz_elem>\t%h0, %A1", ops); |
| 5061 |
return ""; |
| 5062 |
} |
| 5063 |
[(set_attr "type" "neon_load1_3reg<q>")] |
| 5064 |
) |
| 5065 |
|
| 5066 |
(define_insn "neon_vld1_x4<mode>" |
| 5067 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 5068 |
(unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 5069 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5070 |
UNSPEC_VLD1))] |
| 5071 |
"TARGET_NEON" |
| 5072 |
"vld1.<V_sz_elem>\t%h0, %A1" |
| 5073 |
[(set_attr "type" "neon_load1_4reg<q>")] |
| 5074 |
) |
| 5075 |
(define_expand "neon_vld1q_x4<mode>" |
| 5076 |
[(match_operand:XI 0 "s_register_operand") |
| 5077 |
(match_operand:XI 1 "neon_struct_operand") |
| 5078 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5079 |
"TARGET_NEON" |
| 5080 |
{ |
| 5081 |
rtx mem = adjust_address (operands[1], OImode, 0); |
| 5082 |
emit_insn (gen_neon_vld1x4qa<mode> (operands[0], mem)); |
| 5083 |
mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode)); |
| 5084 |
emit_insn (gen_neon_vld1x4qb<mode> (operands[0], mem, operands[0])); |
| 5085 |
DONE; |
| 5086 |
}) |
| 5087 |
|
| 5088 |
(define_insn "neon_vld1x4qa<mode>" |
| 5089 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 5090 |
(unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 5091 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5092 |
UNSPEC_VLD1X4A))] |
| 5093 |
"TARGET_NEON" |
| 5094 |
{ |
| 5095 |
rtx ops[2]; |
| 5096 |
ops[0] = gen_rtx_REG (OImode, REGNO (operands[0])); |
| 5097 |
ops[1] = operands[1]; |
| 5098 |
|
| 5099 |
output_asm_insn ("vld1.<V_sz_elem>\t%h0, %A1", ops); |
| 5100 |
return ""; |
| 5101 |
} |
| 5102 |
[(set_attr "type" "neon_load1_4reg<q>")] |
| 5103 |
) |
| 5104 |
|
| 5105 |
(define_insn "neon_vld1x4qb<mode>" |
| 5106 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 5107 |
(unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 5108 |
(match_operand:XI 2 "s_register_operand" "0") |
| 5109 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5110 |
UNSPEC_VLD1X4B))] |
| 5111 |
"TARGET_NEON" |
| 5112 |
{ |
| 5113 |
rtx ops[2]; |
| 5114 |
ops[0] = gen_rtx_REG (OImode, REGNO (operands[0]) + 8); |
| 5115 |
ops[1] = operands[1]; |
| 5116 |
|
| 5117 |
output_asm_insn ("vld1.<V_sz_elem>\t%h0, %A1", ops); |
| 5118 |
return ""; |
| 5119 |
} |
| 5120 |
[(set_attr "type" "neon_load1_4reg<q>")] |
| 5121 |
) |
| 5122 |
|
| 5123 |
;; The lane numbers in the RTL are in GCC lane order, having been flipped |
| 5124 |
;; in arm_expand_neon_args. The lane numbers are restored to architectural |
| 5125 |
;; lane order here. |
| 5126 |
(define_insn "neon_vld1_lane<mode>" |
| 5127 |
[(set (match_operand:VDX 0 "s_register_operand" "=w") |
| 5128 |
(unspec:VDX [(match_operand:<V_elem> 1 "neon_struct_operand" "Um") |
| 5129 |
(match_operand:VDX 2 "s_register_operand" "0") |
| 5130 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 5131 |
UNSPEC_VLD1_LANE))] |
| 5132 |
"TARGET_NEON" |
| 5133 |
{ |
| 5134 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 5135 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5136 |
operands[3] = GEN_INT (lane); |
| 5137 |
if (max == 1) |
| 5138 |
return "vld1.<V_sz_elem>\t%P0, %A1"; |
| 5139 |
else |
| 5140 |
return "vld1.<V_sz_elem>\t{%P0[%c3]}, %A1"; |
| 5141 |
} |
| 5142 |
[(set_attr "type" "neon_load1_one_lane<q>")] |
| 5143 |
) |
| 5144 |
|
| 5145 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5146 |
;; here on big endian targets. |
| 5147 |
(define_insn "neon_vld1_lane<mode>" |
| 5148 |
[(set (match_operand:VQX 0 "s_register_operand" "=w") |
| 5149 |
(unspec:VQX [(match_operand:<V_elem> 1 "neon_struct_operand" "Um") |
| 5150 |
(match_operand:VQX 2 "s_register_operand" "0") |
| 5151 |
(match_operand:SI 3 "immediate_operand" "i")] |
| 5152 |
UNSPEC_VLD1_LANE))] |
| 5153 |
"TARGET_NEON" |
| 5154 |
{ |
| 5155 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 5156 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5157 |
operands[3] = GEN_INT (lane); |
| 5158 |
int regno = REGNO (operands[0]); |
| 5159 |
if (lane >= max / 2) |
| 5160 |
{ |
| 5161 |
lane -= max / 2; |
| 5162 |
regno += 2; |
| 5163 |
operands[3] = GEN_INT (lane); |
| 5164 |
} |
| 5165 |
operands[0] = gen_rtx_REG (<V_HALF>mode, regno); |
| 5166 |
if (max == 2) |
| 5167 |
return "vld1.<V_sz_elem>\t%P0, %A1"; |
| 5168 |
else |
| 5169 |
return "vld1.<V_sz_elem>\t{%P0[%c3]}, %A1"; |
| 5170 |
} |
| 5171 |
[(set_attr "type" "neon_load1_one_lane<q>")] |
| 5172 |
) |
| 5173 |
|
| 5174 |
(define_insn "neon_vld1_dup<mode>" |
| 5175 |
[(set (match_operand:VD_LANE 0 "s_register_operand" "=w") |
| 5176 |
(vec_duplicate:VD_LANE (match_operand:<V_elem> 1 "neon_struct_operand" "Um")))] |
| 5177 |
"TARGET_NEON" |
| 5178 |
"vld1.<V_sz_elem>\t{%P0[]}, %A1" |
| 5179 |
[(set_attr "type" "neon_load1_all_lanes<q>")] |
| 5180 |
) |
| 5181 |
|
| 5182 |
;; Special case for DImode. Treat it exactly like a simple load. |
| 5183 |
(define_expand "neon_vld1_dupdi" |
| 5184 |
[(set (match_operand:DI 0 "s_register_operand") |
| 5185 |
(unspec:DI [(match_operand:DI 1 "neon_struct_operand")] |
| 5186 |
UNSPEC_VLD1))] |
| 5187 |
"TARGET_NEON" |
| 5188 |
"" |
| 5189 |
) |
| 5190 |
|
| 5191 |
(define_insn "neon_vld1_dup<mode>" |
| 5192 |
[(set (match_operand:VQ2 0 "s_register_operand" "=w") |
| 5193 |
(vec_duplicate:VQ2 (match_operand:<V_elem> 1 "neon_struct_operand" "Um")))] |
| 5194 |
"TARGET_NEON" |
| 5195 |
{ |
| 5196 |
return "vld1.<V_sz_elem>\t{%e0[], %f0[]}, %A1"; |
| 5197 |
} |
| 5198 |
[(set_attr "type" "neon_load1_all_lanes<q>")] |
| 5199 |
) |
| 5200 |
|
| 5201 |
(define_insn_and_split "neon_vld1_dupv2di" |
| 5202 |
[(set (match_operand:V2DI 0 "s_register_operand" "=w") |
| 5203 |
(vec_duplicate:V2DI (match_operand:DI 1 "neon_struct_operand" "Um")))] |
| 5204 |
"TARGET_NEON" |
| 5205 |
"#" |
| 5206 |
"&& reload_completed" |
| 5207 |
[(const_int 0)] |
| 5208 |
{ |
| 5209 |
rtx tmprtx = gen_lowpart (DImode, operands[0]); |
| 5210 |
emit_insn (gen_neon_vld1_dupdi (tmprtx, operands[1])); |
| 5211 |
emit_move_insn (gen_highpart (DImode, operands[0]), tmprtx ); |
| 5212 |
DONE; |
| 5213 |
} |
| 5214 |
[(set_attr "length" "8") |
| 5215 |
(set_attr "type" "neon_load1_all_lanes_q")] |
| 5216 |
) |
| 5217 |
|
| 5218 |
(define_expand "vec_store_lanes<mode><mode>" |
| 5219 |
[(set (match_operand:VDQX 0 "neon_struct_operand") |
| 5220 |
(unspec:VDQX [(match_operand:VDQX 1 "s_register_operand")] |
| 5221 |
UNSPEC_VST1))] |
| 5222 |
"TARGET_NEON") |
| 5223 |
|
| 5224 |
(define_insn "neon_vst1<mode>" |
| 5225 |
[(set (match_operand:VDQX 0 "neon_struct_operand" "=Um") |
| 5226 |
(unspec:VDQX [(match_operand:VDQX 1 "s_register_operand" "w")] |
| 5227 |
UNSPEC_VST1))] |
| 5228 |
"TARGET_NEON" |
| 5229 |
"vst1.<V_sz_elem>\t%h1, %A0" |
| 5230 |
[(set_attr "type" "neon_store1_1reg<q>")]) |
| 5231 |
|
| 5232 |
(define_insn "neon_vst1<VMEMX2_q>_x2<VDQX:mode>" |
| 5233 |
[(set (match_operand:VMEMX2 0 "neon_struct_operand" "=Um") |
| 5234 |
(unspec:VMEMX2 [(match_operand:VMEMX2 1 "s_register_operand" "w") |
| 5235 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5236 |
UNSPEC_VST1))] |
| 5237 |
"TARGET_NEON" |
| 5238 |
"vst1.<V_sz_elem>\t%h1, %A0" |
| 5239 |
[(set_attr "type" "neon_store1_2reg<q>")] |
| 5240 |
) |
| 5241 |
|
| 5242 |
(define_insn "neon_vst1_x3<mode>" |
| 5243 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5244 |
(unspec:EI [(match_operand:EI 1 "s_register_operand" "w") |
| 5245 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5246 |
UNSPEC_VST1))] |
| 5247 |
"TARGET_NEON" |
| 5248 |
"vst1.<V_sz_elem>\t%h1, %A0" |
| 5249 |
[(set_attr "type" "neon_store1_3reg<q>")] |
| 5250 |
) |
| 5251 |
|
| 5252 |
(define_expand "neon_vst1q_x3<mode>" |
| 5253 |
[(match_operand:CI 0 "neon_struct_operand") |
| 5254 |
(match_operand:CI 1 "s_register_operand") |
| 5255 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5256 |
"TARGET_NEON" |
| 5257 |
{ |
| 5258 |
rtx mem = adjust_address (operands[0], EImode, 0); |
| 5259 |
emit_insn (gen_neon_vst1x3qa<mode> (mem, operands[1])); |
| 5260 |
mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode)); |
| 5261 |
emit_insn (gen_neon_vst1x3qb<mode> (mem, operands[1])); |
| 5262 |
DONE; |
| 5263 |
}) |
| 5264 |
|
| 5265 |
(define_insn "neon_vst1x3qa<mode>" |
| 5266 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5267 |
(unspec:EI [(match_operand:CI 1 "s_register_operand" "w") |
| 5268 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5269 |
UNSPEC_VST1X3A))] |
| 5270 |
"TARGET_NEON" |
| 5271 |
{ |
| 5272 |
rtx ops[2]; |
| 5273 |
ops[0] = operands[0]; |
| 5274 |
ops[1] = gen_rtx_REG (EImode, REGNO (operands[1])); |
| 5275 |
|
| 5276 |
output_asm_insn ("vst1.<V_sz_elem>\t%h1, %A0", ops); |
| 5277 |
return ""; |
| 5278 |
} |
| 5279 |
[(set_attr "type" "neon_store1_3reg<q>")] |
| 5280 |
) |
| 5281 |
|
| 5282 |
(define_insn "neon_vst1x3qb<mode>" |
| 5283 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5284 |
(unspec:EI [(match_operand:CI 1 "s_register_operand" "w") |
| 5285 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5286 |
UNSPEC_VST1X3B))] |
| 5287 |
"TARGET_NEON" |
| 5288 |
{ |
| 5289 |
rtx ops[2]; |
| 5290 |
ops[0] = operands[0]; |
| 5291 |
ops[1] = gen_rtx_REG (EImode, REGNO (operands[1]) + 6); |
| 5292 |
|
| 5293 |
output_asm_insn ("vst1.<V_sz_elem>\t%h1, %A0", ops); |
| 5294 |
return ""; |
| 5295 |
} |
| 5296 |
[(set_attr "type" "neon_store1_3reg<q>")] |
| 5297 |
) |
| 5298 |
|
| 5299 |
(define_insn "neon_vst1_x4<mode>" |
| 5300 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 5301 |
(unspec:OI [(match_operand:OI 1 "s_register_operand" "w") |
| 5302 |
(unspec:VDQX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5303 |
UNSPEC_VST1))] |
| 5304 |
"TARGET_NEON" |
| 5305 |
"vst1.<V_sz_elem>\t%h1, %A0" |
| 5306 |
[(set_attr "type" "neon_store1_4reg<q>")] |
| 5307 |
) |
| 5308 |
|
| 5309 |
(define_expand "neon_vst1q_x4<mode>" |
| 5310 |
[(match_operand:XI 0 "neon_struct_operand") |
| 5311 |
(match_operand:XI 1 "s_register_operand") |
| 5312 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5313 |
"TARGET_NEON" |
| 5314 |
{ |
| 5315 |
rtx mem = adjust_address (operands[0], OImode, 0); |
| 5316 |
emit_insn (gen_neon_vst1x4qa<mode> (mem, operands[1])); |
| 5317 |
mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode)); |
| 5318 |
emit_insn (gen_neon_vst1x4qb<mode> (mem, operands[1])); |
| 5319 |
DONE; |
| 5320 |
}) |
| 5321 |
|
| 5322 |
(define_insn "neon_vst1x4qa<mode>" |
| 5323 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 5324 |
(unspec:OI [(match_operand:XI 1 "s_register_operand" "w") |
| 5325 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5326 |
UNSPEC_VST1X4A))] |
| 5327 |
"TARGET_NEON" |
| 5328 |
{ |
| 5329 |
rtx ops[2]; |
| 5330 |
ops[0] = operands[0]; |
| 5331 |
ops[1] = gen_rtx_REG (OImode, REGNO (operands[1])); |
| 5332 |
|
| 5333 |
output_asm_insn ("vst1.<V_sz_elem>\t%h1, %A0", ops); |
| 5334 |
return ""; |
| 5335 |
} |
| 5336 |
[(set_attr "type" "neon_store1_4reg<q>")] |
| 5337 |
) |
| 5338 |
|
| 5339 |
(define_insn "neon_vst1x4qb<mode>" |
| 5340 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 5341 |
(unspec:OI [(match_operand:XI 1 "s_register_operand" "w") |
| 5342 |
(unspec:VQXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5343 |
UNSPEC_VST1X4B))] |
| 5344 |
"TARGET_NEON" |
| 5345 |
{ |
| 5346 |
rtx ops[2]; |
| 5347 |
ops[0] = operands[0]; |
| 5348 |
ops[1] = gen_rtx_REG (OImode, REGNO (operands[1]) + 8); |
| 5349 |
|
| 5350 |
output_asm_insn ("vst1.<V_sz_elem>\t%h1, %A0", ops); |
| 5351 |
return ""; |
| 5352 |
} |
| 5353 |
[(set_attr "type" "neon_store1_4reg<q>")] |
| 5354 |
) |
| 5355 |
|
| 5356 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5357 |
;; here on big endian targets. |
| 5358 |
(define_insn "neon_vst1_lane<mode>" |
| 5359 |
[(set (match_operand:<V_elem> 0 "neon_struct_operand" "=Um") |
| 5360 |
(unspec:<V_elem> |
| 5361 |
[(match_operand:VDX 1 "s_register_operand" "w") |
| 5362 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 5363 |
UNSPEC_VST1_LANE))] |
| 5364 |
"TARGET_NEON" |
| 5365 |
{ |
| 5366 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5367 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5368 |
operands[2] = GEN_INT (lane); |
| 5369 |
if (max == 1) |
| 5370 |
return "vst1.<V_sz_elem>\t{%P1}, %A0"; |
| 5371 |
else |
| 5372 |
return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0"; |
| 5373 |
} |
| 5374 |
[(set_attr "type" "neon_store1_one_lane<q>")] |
| 5375 |
) |
| 5376 |
|
| 5377 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5378 |
;; here on big endian targets. |
| 5379 |
(define_insn "neon_vst1_lane<mode>" |
| 5380 |
[(set (match_operand:<V_elem> 0 "neon_struct_operand" "=Um") |
| 5381 |
(unspec:<V_elem> |
| 5382 |
[(match_operand:VQX 1 "s_register_operand" "w") |
| 5383 |
(match_operand:SI 2 "immediate_operand" "i")] |
| 5384 |
UNSPEC_VST1_LANE))] |
| 5385 |
"TARGET_NEON" |
| 5386 |
{ |
| 5387 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5388 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5389 |
int regno = REGNO (operands[1]); |
| 5390 |
if (lane >= max / 2) |
| 5391 |
{ |
| 5392 |
lane -= max / 2; |
| 5393 |
regno += 2; |
| 5394 |
} |
| 5395 |
operands[2] = GEN_INT (lane); |
| 5396 |
operands[1] = gen_rtx_REG (<V_HALF>mode, regno); |
| 5397 |
if (max == 2) |
| 5398 |
return "vst1.<V_sz_elem>\t{%P1}, %A0"; |
| 5399 |
else |
| 5400 |
return "vst1.<V_sz_elem>\t{%P1[%c2]}, %A0"; |
| 5401 |
} |
| 5402 |
[(set_attr "type" "neon_store1_one_lane<q>")] |
| 5403 |
) |
| 5404 |
|
| 5405 |
(define_expand "vec_load_lanesti<mode>" |
| 5406 |
[(set (match_operand:TI 0 "s_register_operand") |
| 5407 |
(unspec:TI [(match_operand:TI 1 "neon_struct_operand") |
| 5408 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5409 |
UNSPEC_VLD2))] |
| 5410 |
"TARGET_NEON") |
| 5411 |
|
| 5412 |
(define_insn "neon_vld2<mode>" |
| 5413 |
[(set (match_operand:TI 0 "s_register_operand" "=w") |
| 5414 |
(unspec:TI [(match_operand:TI 1 "neon_struct_operand" "Um") |
| 5415 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5416 |
UNSPEC_VLD2))] |
| 5417 |
"TARGET_NEON" |
| 5418 |
{ |
| 5419 |
if (<V_sz_elem> == 64) |
| 5420 |
return "vld1.64\t%h0, %A1"; |
| 5421 |
else |
| 5422 |
return "vld2.<V_sz_elem>\t%h0, %A1"; |
| 5423 |
} |
| 5424 |
[(set (attr "type") |
| 5425 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 5426 |
(const_string "neon_load1_2reg<q>") |
| 5427 |
(const_string "neon_load2_2reg<q>")))] |
| 5428 |
) |
| 5429 |
|
| 5430 |
(define_insn "neon_vld2<mode>" |
| 5431 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 5432 |
(unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 5433 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5434 |
UNSPEC_VLD2))] |
| 5435 |
"TARGET_NEON" |
| 5436 |
"vld2.<V_sz_elem>\t%h0, %A1" |
| 5437 |
[(set_attr "type" "neon_load2_2reg_q")]) |
| 5438 |
|
| 5439 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5440 |
;; here on big endian targets. |
| 5441 |
(define_insn "neon_vld2_lane<mode>" |
| 5442 |
[(set (match_operand:TI 0 "s_register_operand" "=w") |
| 5443 |
(unspec:TI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um") |
| 5444 |
(match_operand:TI 2 "s_register_operand" "0") |
| 5445 |
(match_operand:SI 3 "immediate_operand" "i") |
| 5446 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5447 |
UNSPEC_VLD2_LANE))] |
| 5448 |
"TARGET_NEON" |
| 5449 |
{ |
| 5450 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 5451 |
int regno = REGNO (operands[0]); |
| 5452 |
rtx ops[4]; |
| 5453 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5454 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 5455 |
ops[2] = operands[1]; |
| 5456 |
ops[3] = GEN_INT (lane); |
| 5457 |
output_asm_insn ("vld2.<V_sz_elem>\t{%P0[%c3], %P1[%c3]}, %A2", ops); |
| 5458 |
return ""; |
| 5459 |
} |
| 5460 |
[(set_attr "type" "neon_load2_one_lane<q>")] |
| 5461 |
) |
| 5462 |
|
| 5463 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5464 |
;; here on big endian targets. |
| 5465 |
(define_insn "neon_vld2_lane<mode>" |
| 5466 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 5467 |
(unspec:OI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um") |
| 5468 |
(match_operand:OI 2 "s_register_operand" "0") |
| 5469 |
(match_operand:SI 3 "immediate_operand" "i") |
| 5470 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5471 |
UNSPEC_VLD2_LANE))] |
| 5472 |
"TARGET_NEON" |
| 5473 |
{ |
| 5474 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 5475 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5476 |
int regno = REGNO (operands[0]); |
| 5477 |
rtx ops[4]; |
| 5478 |
if (lane >= max / 2) |
| 5479 |
{ |
| 5480 |
lane -= max / 2; |
| 5481 |
regno += 2; |
| 5482 |
} |
| 5483 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5484 |
ops[1] = gen_rtx_REG (DImode, regno + 4); |
| 5485 |
ops[2] = operands[1]; |
| 5486 |
ops[3] = GEN_INT (lane); |
| 5487 |
output_asm_insn ("vld2.<V_sz_elem>\t{%P0[%c3], %P1[%c3]}, %A2", ops); |
| 5488 |
return ""; |
| 5489 |
} |
| 5490 |
[(set_attr "type" "neon_load2_one_lane<q>")] |
| 5491 |
) |
| 5492 |
|
| 5493 |
(define_insn "neon_vld2_dup<mode>" |
| 5494 |
[(set (match_operand:TI 0 "s_register_operand" "=w") |
| 5495 |
(unspec:TI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um") |
| 5496 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5497 |
UNSPEC_VLD2_DUP))] |
| 5498 |
"TARGET_NEON" |
| 5499 |
{ |
| 5500 |
if (GET_MODE_NUNITS (<MODE>mode) > 1) |
| 5501 |
return "vld2.<V_sz_elem>\t{%e0[], %f0[]}, %A1"; |
| 5502 |
else |
| 5503 |
return "vld1.<V_sz_elem>\t%h0, %A1"; |
| 5504 |
} |
| 5505 |
[(set (attr "type") |
| 5506 |
(if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1")) |
| 5507 |
(const_string "neon_load2_all_lanes<q>") |
| 5508 |
(const_string "neon_load1_1reg<q>")))] |
| 5509 |
) |
| 5510 |
|
| 5511 |
(define_insn "neon_vld2_dupv8bf" |
| 5512 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 5513 |
(unspec:OI [(match_operand:V2BF 1 "neon_struct_operand" "Um") |
| 5514 |
(unspec:V8BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5515 |
UNSPEC_VLD2_DUP))] |
| 5516 |
"TARGET_BF16_SIMD" |
| 5517 |
{ |
| 5518 |
rtx ops[5]; |
| 5519 |
int tabbase = REGNO (operands[0]); |
| 5520 |
|
| 5521 |
ops[4] = operands[1]; |
| 5522 |
ops[0] = gen_rtx_REG (V4BFmode, tabbase); |
| 5523 |
ops[1] = gen_rtx_REG (V4BFmode, tabbase + 2); |
| 5524 |
ops[2] = gen_rtx_REG (V4BFmode, tabbase + 4); |
| 5525 |
ops[3] = gen_rtx_REG (V4BFmode, tabbase + 6); |
| 5526 |
output_asm_insn ("vld2.16\t{%P0, %P1, %P2, %P3}, %A4", ops); |
| 5527 |
return ""; |
| 5528 |
} |
| 5529 |
[(set_attr "type" "neon_load2_all_lanes_q")] |
| 5530 |
) |
| 5531 |
|
| 5532 |
(define_expand "vec_store_lanesti<mode>" |
| 5533 |
[(set (match_operand:TI 0 "neon_struct_operand") |
| 5534 |
(unspec:TI [(match_operand:TI 1 "s_register_operand") |
| 5535 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5536 |
UNSPEC_VST2))] |
| 5537 |
"TARGET_NEON") |
| 5538 |
|
| 5539 |
(define_insn "neon_vst2<mode>" |
| 5540 |
[(set (match_operand:TI 0 "neon_struct_operand" "=Um") |
| 5541 |
(unspec:TI [(match_operand:TI 1 "s_register_operand" "w") |
| 5542 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5543 |
UNSPEC_VST2))] |
| 5544 |
"TARGET_NEON" |
| 5545 |
{ |
| 5546 |
if (<V_sz_elem> == 64) |
| 5547 |
return "vst1.64\t%h1, %A0"; |
| 5548 |
else |
| 5549 |
return "vst2.<V_sz_elem>\t%h1, %A0"; |
| 5550 |
} |
| 5551 |
[(set (attr "type") |
| 5552 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 5553 |
(const_string "neon_store1_2reg<q>") |
| 5554 |
(const_string "neon_store2_one_lane<q>")))] |
| 5555 |
) |
| 5556 |
|
| 5557 |
(define_insn "neon_vst2<mode>" |
| 5558 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 5559 |
(unspec:OI [(match_operand:OI 1 "s_register_operand" "w") |
| 5560 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5561 |
UNSPEC_VST2))] |
| 5562 |
"TARGET_NEON" |
| 5563 |
"vst2.<V_sz_elem>\t%h1, %A0" |
| 5564 |
[(set_attr "type" "neon_store2_4reg<q>")] |
| 5565 |
) |
| 5566 |
|
| 5567 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5568 |
;; here on big endian targets. |
| 5569 |
(define_insn "neon_vst2_lane<mode>" |
| 5570 |
[(set (match_operand:<V_two_elem> 0 "neon_struct_operand" "=Um") |
| 5571 |
(unspec:<V_two_elem> |
| 5572 |
[(match_operand:TI 1 "s_register_operand" "w") |
| 5573 |
(match_operand:SI 2 "immediate_operand" "i") |
| 5574 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5575 |
UNSPEC_VST2_LANE))] |
| 5576 |
"TARGET_NEON" |
| 5577 |
{ |
| 5578 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5579 |
int regno = REGNO (operands[1]); |
| 5580 |
rtx ops[4]; |
| 5581 |
ops[0] = operands[0]; |
| 5582 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 5583 |
ops[2] = gen_rtx_REG (DImode, regno + 2); |
| 5584 |
ops[3] = GEN_INT (lane); |
| 5585 |
output_asm_insn ("vst2.<V_sz_elem>\t{%P1[%c3], %P2[%c3]}, %A0", ops); |
| 5586 |
return ""; |
| 5587 |
} |
| 5588 |
[(set_attr "type" "neon_store2_one_lane<q>")] |
| 5589 |
) |
| 5590 |
|
| 5591 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5592 |
;; here on big endian targets. |
| 5593 |
(define_insn "neon_vst2_lane<mode>" |
| 5594 |
[(set (match_operand:<V_two_elem> 0 "neon_struct_operand" "=Um") |
| 5595 |
(unspec:<V_two_elem> |
| 5596 |
[(match_operand:OI 1 "s_register_operand" "w") |
| 5597 |
(match_operand:SI 2 "immediate_operand" "i") |
| 5598 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5599 |
UNSPEC_VST2_LANE))] |
| 5600 |
"TARGET_NEON" |
| 5601 |
{ |
| 5602 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5603 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5604 |
int regno = REGNO (operands[1]); |
| 5605 |
rtx ops[4]; |
| 5606 |
if (lane >= max / 2) |
| 5607 |
{ |
| 5608 |
lane -= max / 2; |
| 5609 |
regno += 2; |
| 5610 |
} |
| 5611 |
ops[0] = operands[0]; |
| 5612 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 5613 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 5614 |
ops[3] = GEN_INT (lane); |
| 5615 |
output_asm_insn ("vst2.<V_sz_elem>\t{%P1[%c3], %P2[%c3]}, %A0", ops); |
| 5616 |
return ""; |
| 5617 |
} |
| 5618 |
[(set_attr "type" "neon_store2_one_lane<q>")] |
| 5619 |
) |
| 5620 |
|
| 5621 |
(define_expand "vec_load_lanesei<mode>" |
| 5622 |
[(set (match_operand:EI 0 "s_register_operand") |
| 5623 |
(unspec:EI [(match_operand:EI 1 "neon_struct_operand") |
| 5624 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5625 |
UNSPEC_VLD3))] |
| 5626 |
"TARGET_NEON") |
| 5627 |
|
| 5628 |
(define_insn "neon_vld3<mode>" |
| 5629 |
[(set (match_operand:EI 0 "s_register_operand" "=w") |
| 5630 |
(unspec:EI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5631 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5632 |
UNSPEC_VLD3))] |
| 5633 |
"TARGET_NEON" |
| 5634 |
{ |
| 5635 |
if (<V_sz_elem> == 64) |
| 5636 |
return "vld1.64\t%h0, %A1"; |
| 5637 |
else |
| 5638 |
return "vld3.<V_sz_elem>\t%h0, %A1"; |
| 5639 |
} |
| 5640 |
[(set (attr "type") |
| 5641 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 5642 |
(const_string "neon_load1_3reg<q>") |
| 5643 |
(const_string "neon_load3_3reg<q>")))] |
| 5644 |
) |
| 5645 |
|
| 5646 |
(define_expand "vec_load_lanesci<mode>" |
| 5647 |
[(match_operand:CI 0 "s_register_operand") |
| 5648 |
(match_operand:CI 1 "neon_struct_operand") |
| 5649 |
(unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5650 |
"TARGET_NEON" |
| 5651 |
{ |
| 5652 |
emit_insn (gen_neon_vld3<mode> (operands[0], operands[1])); |
| 5653 |
DONE; |
| 5654 |
}) |
| 5655 |
|
| 5656 |
(define_expand "neon_vld3<mode>" |
| 5657 |
[(match_operand:CI 0 "s_register_operand") |
| 5658 |
(match_operand:CI 1 "neon_struct_operand") |
| 5659 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5660 |
"TARGET_NEON" |
| 5661 |
{ |
| 5662 |
rtx mem; |
| 5663 |
|
| 5664 |
mem = adjust_address (operands[1], EImode, 0); |
| 5665 |
emit_insn (gen_neon_vld3qa<mode> (operands[0], mem)); |
| 5666 |
mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode)); |
| 5667 |
emit_insn (gen_neon_vld3qb<mode> (operands[0], mem, operands[0])); |
| 5668 |
DONE; |
| 5669 |
}) |
| 5670 |
|
| 5671 |
(define_insn "neon_vld3qa<mode>" |
| 5672 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5673 |
(unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5674 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5675 |
UNSPEC_VLD3A))] |
| 5676 |
"TARGET_NEON" |
| 5677 |
{ |
| 5678 |
int regno = REGNO (operands[0]); |
| 5679 |
rtx ops[4]; |
| 5680 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5681 |
ops[1] = gen_rtx_REG (DImode, regno + 4); |
| 5682 |
ops[2] = gen_rtx_REG (DImode, regno + 8); |
| 5683 |
ops[3] = operands[1]; |
| 5684 |
output_asm_insn ("vld3.<V_sz_elem>\t{%P0, %P1, %P2}, %A3", ops); |
| 5685 |
return ""; |
| 5686 |
} |
| 5687 |
[(set_attr "type" "neon_load3_3reg<q>")] |
| 5688 |
) |
| 5689 |
|
| 5690 |
(define_insn "neon_vld3qb<mode>" |
| 5691 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5692 |
(unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") |
| 5693 |
(match_operand:CI 2 "s_register_operand" "0") |
| 5694 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5695 |
UNSPEC_VLD3B))] |
| 5696 |
"TARGET_NEON" |
| 5697 |
{ |
| 5698 |
int regno = REGNO (operands[0]); |
| 5699 |
rtx ops[4]; |
| 5700 |
ops[0] = gen_rtx_REG (DImode, regno + 2); |
| 5701 |
ops[1] = gen_rtx_REG (DImode, regno + 6); |
| 5702 |
ops[2] = gen_rtx_REG (DImode, regno + 10); |
| 5703 |
ops[3] = operands[1]; |
| 5704 |
output_asm_insn ("vld3.<V_sz_elem>\t{%P0, %P1, %P2}, %A3", ops); |
| 5705 |
return ""; |
| 5706 |
} |
| 5707 |
[(set_attr "type" "neon_load3_3reg<q>")] |
| 5708 |
) |
| 5709 |
|
| 5710 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5711 |
;; here on big endian targets. |
| 5712 |
(define_insn "neon_vld3_lane<mode>" |
| 5713 |
[(set (match_operand:EI 0 "s_register_operand" "=w") |
| 5714 |
(unspec:EI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um") |
| 5715 |
(match_operand:EI 2 "s_register_operand" "0") |
| 5716 |
(match_operand:SI 3 "immediate_operand" "i") |
| 5717 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5718 |
UNSPEC_VLD3_LANE))] |
| 5719 |
"TARGET_NEON" |
| 5720 |
{ |
| 5721 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3])); |
| 5722 |
int regno = REGNO (operands[0]); |
| 5723 |
rtx ops[5]; |
| 5724 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5725 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 5726 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 5727 |
ops[3] = operands[1]; |
| 5728 |
ops[4] = GEN_INT (lane); |
| 5729 |
output_asm_insn ("vld3.<V_sz_elem>\t{%P0[%c4], %P1[%c4], %P2[%c4]}, %3", |
| 5730 |
ops); |
| 5731 |
return ""; |
| 5732 |
} |
| 5733 |
[(set_attr "type" "neon_load3_one_lane<q>")] |
| 5734 |
) |
| 5735 |
|
| 5736 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5737 |
;; here on big endian targets. |
| 5738 |
(define_insn "neon_vld3_lane<mode>" |
| 5739 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5740 |
(unspec:CI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um") |
| 5741 |
(match_operand:CI 2 "s_register_operand" "0") |
| 5742 |
(match_operand:SI 3 "immediate_operand" "i") |
| 5743 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5744 |
UNSPEC_VLD3_LANE))] |
| 5745 |
"TARGET_NEON" |
| 5746 |
{ |
| 5747 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 5748 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5749 |
int regno = REGNO (operands[0]); |
| 5750 |
rtx ops[5]; |
| 5751 |
if (lane >= max / 2) |
| 5752 |
{ |
| 5753 |
lane -= max / 2; |
| 5754 |
regno += 2; |
| 5755 |
} |
| 5756 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5757 |
ops[1] = gen_rtx_REG (DImode, regno + 4); |
| 5758 |
ops[2] = gen_rtx_REG (DImode, regno + 8); |
| 5759 |
ops[3] = operands[1]; |
| 5760 |
ops[4] = GEN_INT (lane); |
| 5761 |
output_asm_insn ("vld3.<V_sz_elem>\t{%P0[%c4], %P1[%c4], %P2[%c4]}, %3", |
| 5762 |
ops); |
| 5763 |
return ""; |
| 5764 |
} |
| 5765 |
[(set_attr "type" "neon_load3_one_lane<q>")] |
| 5766 |
) |
| 5767 |
|
| 5768 |
(define_insn "neon_vld3_dup<mode>" |
| 5769 |
[(set (match_operand:EI 0 "s_register_operand" "=w") |
| 5770 |
(unspec:EI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um") |
| 5771 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5772 |
UNSPEC_VLD3_DUP))] |
| 5773 |
"TARGET_NEON" |
| 5774 |
{ |
| 5775 |
if (GET_MODE_NUNITS (<MODE>mode) > 1) |
| 5776 |
{ |
| 5777 |
int regno = REGNO (operands[0]); |
| 5778 |
rtx ops[4]; |
| 5779 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 5780 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 5781 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 5782 |
ops[3] = operands[1]; |
| 5783 |
output_asm_insn ("vld3.<V_sz_elem>\t{%P0[], %P1[], %P2[]}, %3", ops); |
| 5784 |
return ""; |
| 5785 |
} |
| 5786 |
else |
| 5787 |
return "vld1.<V_sz_elem>\t%h0, %A1"; |
| 5788 |
} |
| 5789 |
[(set (attr "type") |
| 5790 |
(if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1")) |
| 5791 |
(const_string "neon_load3_all_lanes<q>") |
| 5792 |
(const_string "neon_load1_1reg<q>")))]) |
| 5793 |
|
| 5794 |
(define_insn "neon_vld3_dupv8bf" |
| 5795 |
[(set (match_operand:CI 0 "s_register_operand" "=w") |
| 5796 |
(unspec:CI [(match_operand:V2BF 1 "neon_struct_operand" "Um") |
| 5797 |
(unspec:V8BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5798 |
UNSPEC_VLD2_DUP))] |
| 5799 |
"TARGET_BF16_SIMD" |
| 5800 |
{ |
| 5801 |
rtx ops[4]; |
| 5802 |
int tabbase = REGNO (operands[0]); |
| 5803 |
|
| 5804 |
ops[3] = operands[1]; |
| 5805 |
ops[0] = gen_rtx_REG (V4BFmode, tabbase); |
| 5806 |
ops[1] = gen_rtx_REG (V4BFmode, tabbase + 2); |
| 5807 |
ops[2] = gen_rtx_REG (V4BFmode, tabbase + 4); |
| 5808 |
output_asm_insn ("vld3.16\t{%P0[], %P1[], %P2[]}, %A3", ops); |
| 5809 |
return ""; |
| 5810 |
} |
| 5811 |
[(set_attr "type" "neon_load3_all_lanes_q")] |
| 5812 |
) |
| 5813 |
|
| 5814 |
(define_expand "vec_store_lanesei<mode>" |
| 5815 |
[(set (match_operand:EI 0 "neon_struct_operand") |
| 5816 |
(unspec:EI [(match_operand:EI 1 "s_register_operand") |
| 5817 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5818 |
UNSPEC_VST3))] |
| 5819 |
"TARGET_NEON") |
| 5820 |
|
| 5821 |
(define_insn "neon_vst3<mode>" |
| 5822 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5823 |
(unspec:EI [(match_operand:EI 1 "s_register_operand" "w") |
| 5824 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5825 |
UNSPEC_VST3))] |
| 5826 |
"TARGET_NEON" |
| 5827 |
{ |
| 5828 |
if (<V_sz_elem> == 64) |
| 5829 |
return "vst1.64\t%h1, %A0"; |
| 5830 |
else |
| 5831 |
return "vst3.<V_sz_elem>\t%h1, %A0"; |
| 5832 |
} |
| 5833 |
[(set (attr "type") |
| 5834 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 5835 |
(const_string "neon_store1_3reg<q>") |
| 5836 |
(const_string "neon_store3_one_lane<q>")))]) |
| 5837 |
|
| 5838 |
(define_expand "vec_store_lanesci<mode>" |
| 5839 |
[(match_operand:CI 0 "neon_struct_operand") |
| 5840 |
(match_operand:CI 1 "s_register_operand") |
| 5841 |
(unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5842 |
"TARGET_NEON" |
| 5843 |
{ |
| 5844 |
emit_insn (gen_neon_vst3<mode> (operands[0], operands[1])); |
| 5845 |
DONE; |
| 5846 |
}) |
| 5847 |
|
| 5848 |
(define_expand "neon_vst3<mode>" |
| 5849 |
[(match_operand:CI 0 "neon_struct_operand") |
| 5850 |
(match_operand:CI 1 "s_register_operand") |
| 5851 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5852 |
"TARGET_NEON" |
| 5853 |
{ |
| 5854 |
rtx mem; |
| 5855 |
|
| 5856 |
mem = adjust_address (operands[0], EImode, 0); |
| 5857 |
emit_insn (gen_neon_vst3qa<mode> (mem, operands[1])); |
| 5858 |
mem = adjust_address (mem, EImode, GET_MODE_SIZE (EImode)); |
| 5859 |
emit_insn (gen_neon_vst3qb<mode> (mem, operands[1])); |
| 5860 |
DONE; |
| 5861 |
}) |
| 5862 |
|
| 5863 |
(define_insn "neon_vst3qa<mode>" |
| 5864 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5865 |
(unspec:EI [(match_operand:CI 1 "s_register_operand" "w") |
| 5866 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5867 |
UNSPEC_VST3A))] |
| 5868 |
"TARGET_NEON" |
| 5869 |
{ |
| 5870 |
int regno = REGNO (operands[1]); |
| 5871 |
rtx ops[4]; |
| 5872 |
ops[0] = operands[0]; |
| 5873 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 5874 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 5875 |
ops[3] = gen_rtx_REG (DImode, regno + 8); |
| 5876 |
output_asm_insn ("vst3.<V_sz_elem>\t{%P1, %P2, %P3}, %A0", ops); |
| 5877 |
return ""; |
| 5878 |
} |
| 5879 |
[(set_attr "type" "neon_store3_3reg<q>")] |
| 5880 |
) |
| 5881 |
|
| 5882 |
(define_insn "neon_vst3qb<mode>" |
| 5883 |
[(set (match_operand:EI 0 "neon_struct_operand" "=Um") |
| 5884 |
(unspec:EI [(match_operand:CI 1 "s_register_operand" "w") |
| 5885 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5886 |
UNSPEC_VST3B))] |
| 5887 |
"TARGET_NEON" |
| 5888 |
{ |
| 5889 |
int regno = REGNO (operands[1]); |
| 5890 |
rtx ops[4]; |
| 5891 |
ops[0] = operands[0]; |
| 5892 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 5893 |
ops[2] = gen_rtx_REG (DImode, regno + 6); |
| 5894 |
ops[3] = gen_rtx_REG (DImode, regno + 10); |
| 5895 |
output_asm_insn ("vst3.<V_sz_elem>\t{%P1, %P2, %P3}, %A0", ops); |
| 5896 |
return ""; |
| 5897 |
} |
| 5898 |
[(set_attr "type" "neon_store3_3reg<q>")] |
| 5899 |
) |
| 5900 |
|
| 5901 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5902 |
;; here on big endian targets. |
| 5903 |
(define_insn "neon_vst3_lane<mode>" |
| 5904 |
[(set (match_operand:<V_three_elem> 0 "neon_struct_operand" "=Um") |
| 5905 |
(unspec:<V_three_elem> |
| 5906 |
[(match_operand:EI 1 "s_register_operand" "w") |
| 5907 |
(match_operand:SI 2 "immediate_operand" "i") |
| 5908 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5909 |
UNSPEC_VST3_LANE))] |
| 5910 |
"TARGET_NEON" |
| 5911 |
{ |
| 5912 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5913 |
int regno = REGNO (operands[1]); |
| 5914 |
rtx ops[5]; |
| 5915 |
ops[0] = operands[0]; |
| 5916 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 5917 |
ops[2] = gen_rtx_REG (DImode, regno + 2); |
| 5918 |
ops[3] = gen_rtx_REG (DImode, regno + 4); |
| 5919 |
ops[4] = GEN_INT (lane); |
| 5920 |
output_asm_insn ("vst3.<V_sz_elem>\t{%P1[%c4], %P2[%c4], %P3[%c4]}, %0", |
| 5921 |
ops); |
| 5922 |
return ""; |
| 5923 |
} |
| 5924 |
[(set_attr "type" "neon_store3_one_lane<q>")] |
| 5925 |
) |
| 5926 |
|
| 5927 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 5928 |
;; here on big endian targets. |
| 5929 |
(define_insn "neon_vst3_lane<mode>" |
| 5930 |
[(set (match_operand:<V_three_elem> 0 "neon_struct_operand" "=Um") |
| 5931 |
(unspec:<V_three_elem> |
| 5932 |
[(match_operand:CI 1 "s_register_operand" "w") |
| 5933 |
(match_operand:SI 2 "immediate_operand" "i") |
| 5934 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5935 |
UNSPEC_VST3_LANE))] |
| 5936 |
"TARGET_NEON" |
| 5937 |
{ |
| 5938 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 5939 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 5940 |
int regno = REGNO (operands[1]); |
| 5941 |
rtx ops[5]; |
| 5942 |
if (lane >= max / 2) |
| 5943 |
{ |
| 5944 |
lane -= max / 2; |
| 5945 |
regno += 2; |
| 5946 |
} |
| 5947 |
ops[0] = operands[0]; |
| 5948 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 5949 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 5950 |
ops[3] = gen_rtx_REG (DImode, regno + 8); |
| 5951 |
ops[4] = GEN_INT (lane); |
| 5952 |
output_asm_insn ("vst3.<V_sz_elem>\t{%P1[%c4], %P2[%c4], %P3[%c4]}, %0", |
| 5953 |
ops); |
| 5954 |
return ""; |
| 5955 |
} |
| 5956 |
[(set_attr "type" "neon_store3_one_lane<q>")] |
| 5957 |
) |
| 5958 |
|
| 5959 |
(define_expand "vec_load_lanesoi<mode>" |
| 5960 |
[(set (match_operand:OI 0 "s_register_operand") |
| 5961 |
(unspec:OI [(match_operand:OI 1 "neon_struct_operand") |
| 5962 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5963 |
UNSPEC_VLD4))] |
| 5964 |
"TARGET_NEON") |
| 5965 |
|
| 5966 |
(define_insn "neon_vld4<mode>" |
| 5967 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 5968 |
(unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 5969 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5970 |
UNSPEC_VLD4))] |
| 5971 |
"TARGET_NEON" |
| 5972 |
{ |
| 5973 |
if (<V_sz_elem> == 64) |
| 5974 |
return "vld1.64\t%h0, %A1"; |
| 5975 |
else |
| 5976 |
return "vld4.<V_sz_elem>\t%h0, %A1"; |
| 5977 |
} |
| 5978 |
[(set (attr "type") |
| 5979 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 5980 |
(const_string "neon_load1_4reg<q>") |
| 5981 |
(const_string "neon_load4_4reg<q>")))] |
| 5982 |
) |
| 5983 |
|
| 5984 |
(define_expand "neon_vld4<mode>" |
| 5985 |
[(match_operand:XI 0 "s_register_operand") |
| 5986 |
(match_operand:XI 1 "neon_struct_operand") |
| 5987 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 5988 |
"TARGET_NEON" |
| 5989 |
{ |
| 5990 |
rtx mem; |
| 5991 |
|
| 5992 |
mem = adjust_address (operands[1], OImode, 0); |
| 5993 |
emit_insn (gen_neon_vld4qa<mode> (operands[0], mem)); |
| 5994 |
mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode)); |
| 5995 |
emit_insn (gen_neon_vld4qb<mode> (operands[0], mem, operands[0])); |
| 5996 |
DONE; |
| 5997 |
}) |
| 5998 |
|
| 5999 |
(define_insn "neon_vld4qa<mode>" |
| 6000 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 6001 |
(unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 6002 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6003 |
UNSPEC_VLD4A))] |
| 6004 |
"TARGET_NEON" |
| 6005 |
{ |
| 6006 |
int regno = REGNO (operands[0]); |
| 6007 |
rtx ops[5]; |
| 6008 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 6009 |
ops[1] = gen_rtx_REG (DImode, regno + 4); |
| 6010 |
ops[2] = gen_rtx_REG (DImode, regno + 8); |
| 6011 |
ops[3] = gen_rtx_REG (DImode, regno + 12); |
| 6012 |
ops[4] = operands[1]; |
| 6013 |
output_asm_insn ("vld4.<V_sz_elem>\t{%P0, %P1, %P2, %P3}, %A4", ops); |
| 6014 |
return ""; |
| 6015 |
} |
| 6016 |
[(set_attr "type" "neon_load4_4reg<q>")] |
| 6017 |
) |
| 6018 |
|
| 6019 |
(define_insn "neon_vld4qb<mode>" |
| 6020 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 6021 |
(unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") |
| 6022 |
(match_operand:XI 2 "s_register_operand" "0") |
| 6023 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6024 |
UNSPEC_VLD4B))] |
| 6025 |
"TARGET_NEON" |
| 6026 |
{ |
| 6027 |
int regno = REGNO (operands[0]); |
| 6028 |
rtx ops[5]; |
| 6029 |
ops[0] = gen_rtx_REG (DImode, regno + 2); |
| 6030 |
ops[1] = gen_rtx_REG (DImode, regno + 6); |
| 6031 |
ops[2] = gen_rtx_REG (DImode, regno + 10); |
| 6032 |
ops[3] = gen_rtx_REG (DImode, regno + 14); |
| 6033 |
ops[4] = operands[1]; |
| 6034 |
output_asm_insn ("vld4.<V_sz_elem>\t{%P0, %P1, %P2, %P3}, %A4", ops); |
| 6035 |
return ""; |
| 6036 |
} |
| 6037 |
[(set_attr "type" "neon_load4_4reg<q>")] |
| 6038 |
) |
| 6039 |
|
| 6040 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 6041 |
;; here on big endian targets. |
| 6042 |
(define_insn "neon_vld4_lane<mode>" |
| 6043 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 6044 |
(unspec:OI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um") |
| 6045 |
(match_operand:OI 2 "s_register_operand" "0") |
| 6046 |
(match_operand:SI 3 "immediate_operand" "i") |
| 6047 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6048 |
UNSPEC_VLD4_LANE))] |
| 6049 |
"TARGET_NEON" |
| 6050 |
{ |
| 6051 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 6052 |
int regno = REGNO (operands[0]); |
| 6053 |
rtx ops[6]; |
| 6054 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 6055 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 6056 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 6057 |
ops[3] = gen_rtx_REG (DImode, regno + 6); |
| 6058 |
ops[4] = operands[1]; |
| 6059 |
ops[5] = GEN_INT (lane); |
| 6060 |
output_asm_insn ("vld4.<V_sz_elem>\t{%P0[%c5], %P1[%c5], %P2[%c5], %P3[%c5]}, %A4", |
| 6061 |
ops); |
| 6062 |
return ""; |
| 6063 |
} |
| 6064 |
[(set_attr "type" "neon_load4_one_lane<q>")] |
| 6065 |
) |
| 6066 |
|
| 6067 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 6068 |
;; here on big endian targets. |
| 6069 |
(define_insn "neon_vld4_lane<mode>" |
| 6070 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 6071 |
(unspec:XI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um") |
| 6072 |
(match_operand:XI 2 "s_register_operand" "0") |
| 6073 |
(match_operand:SI 3 "immediate_operand" "i") |
| 6074 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6075 |
UNSPEC_VLD4_LANE))] |
| 6076 |
"TARGET_NEON" |
| 6077 |
{ |
| 6078 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[3])); |
| 6079 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 6080 |
int regno = REGNO (operands[0]); |
| 6081 |
rtx ops[6]; |
| 6082 |
if (lane >= max / 2) |
| 6083 |
{ |
| 6084 |
lane -= max / 2; |
| 6085 |
regno += 2; |
| 6086 |
} |
| 6087 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 6088 |
ops[1] = gen_rtx_REG (DImode, regno + 4); |
| 6089 |
ops[2] = gen_rtx_REG (DImode, regno + 8); |
| 6090 |
ops[3] = gen_rtx_REG (DImode, regno + 12); |
| 6091 |
ops[4] = operands[1]; |
| 6092 |
ops[5] = GEN_INT (lane); |
| 6093 |
output_asm_insn ("vld4.<V_sz_elem>\t{%P0[%c5], %P1[%c5], %P2[%c5], %P3[%c5]}, %A4", |
| 6094 |
ops); |
| 6095 |
return ""; |
| 6096 |
} |
| 6097 |
[(set_attr "type" "neon_load4_one_lane<q>")] |
| 6098 |
) |
| 6099 |
|
| 6100 |
(define_insn "neon_vld4_dup<mode>" |
| 6101 |
[(set (match_operand:OI 0 "s_register_operand" "=w") |
| 6102 |
(unspec:OI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um") |
| 6103 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6104 |
UNSPEC_VLD4_DUP))] |
| 6105 |
"TARGET_NEON" |
| 6106 |
{ |
| 6107 |
if (GET_MODE_NUNITS (<MODE>mode) > 1) |
| 6108 |
{ |
| 6109 |
int regno = REGNO (operands[0]); |
| 6110 |
rtx ops[5]; |
| 6111 |
ops[0] = gen_rtx_REG (DImode, regno); |
| 6112 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 6113 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 6114 |
ops[3] = gen_rtx_REG (DImode, regno + 6); |
| 6115 |
ops[4] = operands[1]; |
| 6116 |
output_asm_insn ("vld4.<V_sz_elem>\t{%P0[], %P1[], %P2[], %P3[]}, %A4", |
| 6117 |
ops); |
| 6118 |
return ""; |
| 6119 |
} |
| 6120 |
else |
| 6121 |
return "vld1.<V_sz_elem>\t%h0, %A1"; |
| 6122 |
} |
| 6123 |
[(set (attr "type") |
| 6124 |
(if_then_else (gt (const_string "<V_mode_nunits>") (const_string "1")) |
| 6125 |
(const_string "neon_load4_all_lanes<q>") |
| 6126 |
(const_string "neon_load1_1reg<q>")))] |
| 6127 |
) |
| 6128 |
|
| 6129 |
(define_insn "neon_vld4_dupv8bf" |
| 6130 |
[(set (match_operand:XI 0 "s_register_operand" "=w") |
| 6131 |
(unspec:XI [(match_operand:V2BF 1 "neon_struct_operand" "Um") |
| 6132 |
(unspec:V8BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6133 |
UNSPEC_VLD2_DUP))] |
| 6134 |
"TARGET_BF16_SIMD" |
| 6135 |
{ |
| 6136 |
rtx ops[5]; |
| 6137 |
int tabbase = REGNO (operands[0]); |
| 6138 |
|
| 6139 |
ops[4] = operands[1]; |
| 6140 |
ops[0] = gen_rtx_REG (V4BFmode, tabbase); |
| 6141 |
ops[1] = gen_rtx_REG (V4BFmode, tabbase + 2); |
| 6142 |
ops[2] = gen_rtx_REG (V4BFmode, tabbase + 4); |
| 6143 |
ops[3] = gen_rtx_REG (V4BFmode, tabbase + 6); |
| 6144 |
output_asm_insn ("vld4.16\t{%P0[], %P1[], %P2[], %P3[]}, %A4", ops); |
| 6145 |
return ""; |
| 6146 |
} |
| 6147 |
[(set_attr "type" "neon_load4_all_lanes_q")] |
| 6148 |
) |
| 6149 |
|
| 6150 |
(define_expand "vec_store_lanesoi<mode>" |
| 6151 |
[(set (match_operand:OI 0 "neon_struct_operand") |
| 6152 |
(unspec:OI [(match_operand:OI 1 "s_register_operand") |
| 6153 |
(unspec:VDX [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6154 |
UNSPEC_VST4))] |
| 6155 |
"TARGET_NEON") |
| 6156 |
|
| 6157 |
(define_insn "neon_vst4<mode>" |
| 6158 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 6159 |
(unspec:OI [(match_operand:OI 1 "s_register_operand" "w") |
| 6160 |
(unspec:VDXBF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6161 |
UNSPEC_VST4))] |
| 6162 |
"TARGET_NEON" |
| 6163 |
{ |
| 6164 |
if (<V_sz_elem> == 64) |
| 6165 |
return "vst1.64\t%h1, %A0"; |
| 6166 |
else |
| 6167 |
return "vst4.<V_sz_elem>\t%h1, %A0"; |
| 6168 |
} |
| 6169 |
[(set (attr "type") |
| 6170 |
(if_then_else (eq (const_string "<V_sz_elem>") (const_string "64")) |
| 6171 |
(const_string "neon_store1_4reg<q>") |
| 6172 |
(const_string "neon_store4_4reg<q>")))] |
| 6173 |
) |
| 6174 |
|
| 6175 |
(define_expand "neon_vst4<mode>" |
| 6176 |
[(match_operand:XI 0 "neon_struct_operand") |
| 6177 |
(match_operand:XI 1 "s_register_operand") |
| 6178 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6179 |
"TARGET_NEON" |
| 6180 |
{ |
| 6181 |
rtx mem; |
| 6182 |
|
| 6183 |
mem = adjust_address (operands[0], OImode, 0); |
| 6184 |
emit_insn (gen_neon_vst4qa<mode> (mem, operands[1])); |
| 6185 |
mem = adjust_address (mem, OImode, GET_MODE_SIZE (OImode)); |
| 6186 |
emit_insn (gen_neon_vst4qb<mode> (mem, operands[1])); |
| 6187 |
DONE; |
| 6188 |
}) |
| 6189 |
|
| 6190 |
(define_insn "neon_vst4qa<mode>" |
| 6191 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 6192 |
(unspec:OI [(match_operand:XI 1 "s_register_operand" "w") |
| 6193 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6194 |
UNSPEC_VST4A))] |
| 6195 |
"TARGET_NEON" |
| 6196 |
{ |
| 6197 |
int regno = REGNO (operands[1]); |
| 6198 |
rtx ops[5]; |
| 6199 |
ops[0] = operands[0]; |
| 6200 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 6201 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 6202 |
ops[3] = gen_rtx_REG (DImode, regno + 8); |
| 6203 |
ops[4] = gen_rtx_REG (DImode, regno + 12); |
| 6204 |
output_asm_insn ("vst4.<V_sz_elem>\t{%P1, %P2, %P3, %P4}, %A0", ops); |
| 6205 |
return ""; |
| 6206 |
} |
| 6207 |
[(set_attr "type" "neon_store4_4reg<q>")] |
| 6208 |
) |
| 6209 |
|
| 6210 |
(define_insn "neon_vst4qb<mode>" |
| 6211 |
[(set (match_operand:OI 0 "neon_struct_operand" "=Um") |
| 6212 |
(unspec:OI [(match_operand:XI 1 "s_register_operand" "w") |
| 6213 |
(unspec:VQ2BF [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6214 |
UNSPEC_VST4B))] |
| 6215 |
"TARGET_NEON" |
| 6216 |
{ |
| 6217 |
int regno = REGNO (operands[1]); |
| 6218 |
rtx ops[5]; |
| 6219 |
ops[0] = operands[0]; |
| 6220 |
ops[1] = gen_rtx_REG (DImode, regno + 2); |
| 6221 |
ops[2] = gen_rtx_REG (DImode, regno + 6); |
| 6222 |
ops[3] = gen_rtx_REG (DImode, regno + 10); |
| 6223 |
ops[4] = gen_rtx_REG (DImode, regno + 14); |
| 6224 |
output_asm_insn ("vst4.<V_sz_elem>\t{%P1, %P2, %P3, %P4}, %A0", ops); |
| 6225 |
return ""; |
| 6226 |
} |
| 6227 |
[(set_attr "type" "neon_store4_4reg<q>")] |
| 6228 |
) |
| 6229 |
|
| 6230 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 6231 |
;; here on big endian targets. |
| 6232 |
(define_insn "neon_vst4_lane<mode>" |
| 6233 |
[(set (match_operand:<V_four_elem> 0 "neon_struct_operand" "=Um") |
| 6234 |
(unspec:<V_four_elem> |
| 6235 |
[(match_operand:OI 1 "s_register_operand" "w") |
| 6236 |
(match_operand:SI 2 "immediate_operand" "i") |
| 6237 |
(unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6238 |
UNSPEC_VST4_LANE))] |
| 6239 |
"TARGET_NEON" |
| 6240 |
{ |
| 6241 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 6242 |
int regno = REGNO (operands[1]); |
| 6243 |
rtx ops[6]; |
| 6244 |
ops[0] = operands[0]; |
| 6245 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 6246 |
ops[2] = gen_rtx_REG (DImode, regno + 2); |
| 6247 |
ops[3] = gen_rtx_REG (DImode, regno + 4); |
| 6248 |
ops[4] = gen_rtx_REG (DImode, regno + 6); |
| 6249 |
ops[5] = GEN_INT (lane); |
| 6250 |
output_asm_insn ("vst4.<V_sz_elem>\t{%P1[%c5], %P2[%c5], %P3[%c5], %P4[%c5]}, %A0", |
| 6251 |
ops); |
| 6252 |
return ""; |
| 6253 |
} |
| 6254 |
[(set_attr "type" "neon_store4_one_lane<q>")] |
| 6255 |
) |
| 6256 |
|
| 6257 |
;; see comment on neon_vld1_lane for reason why the lane numbers are reversed |
| 6258 |
;; here on big endian targets. |
| 6259 |
(define_insn "neon_vst4_lane<mode>" |
| 6260 |
[(set (match_operand:<V_four_elem> 0 "neon_struct_operand" "=Um") |
| 6261 |
(unspec:<V_four_elem> |
| 6262 |
[(match_operand:XI 1 "s_register_operand" "w") |
| 6263 |
(match_operand:SI 2 "immediate_operand" "i") |
| 6264 |
(unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] |
| 6265 |
UNSPEC_VST4_LANE))] |
| 6266 |
"TARGET_NEON" |
| 6267 |
{ |
| 6268 |
HOST_WIDE_INT lane = NEON_ENDIAN_LANE_N(<MODE>mode, INTVAL (operands[2])); |
| 6269 |
HOST_WIDE_INT max = GET_MODE_NUNITS (<MODE>mode); |
| 6270 |
int regno = REGNO (operands[1]); |
| 6271 |
rtx ops[6]; |
| 6272 |
if (lane >= max / 2) |
| 6273 |
{ |
| 6274 |
lane -= max / 2; |
| 6275 |
regno += 2; |
| 6276 |
} |
| 6277 |
ops[0] = operands[0]; |
| 6278 |
ops[1] = gen_rtx_REG (DImode, regno); |
| 6279 |
ops[2] = gen_rtx_REG (DImode, regno + 4); |
| 6280 |
ops[3] = gen_rtx_REG (DImode, regno + 8); |
| 6281 |
ops[4] = gen_rtx_REG (DImode, regno + 12); |
| 6282 |
ops[5] = GEN_INT (lane); |
| 6283 |
output_asm_insn ("vst4.<V_sz_elem>\t{%P1[%c5], %P2[%c5], %P3[%c5], %P4[%c5]}, %A0", |
| 6284 |
ops); |
| 6285 |
return ""; |
| 6286 |
} |
| 6287 |
[(set_attr "type" "neon_store4_4reg<q>")] |
| 6288 |
) |
| 6289 |
|
| 6290 |
(define_insn "neon_vec_unpack<US>_lo_<mode>" |
| 6291 |
[(set (match_operand:<V_unpack> 0 "register_operand" "=w") |
| 6292 |
(SE:<V_unpack> (vec_select:<V_HALF> |
| 6293 |
(match_operand:VU 1 "register_operand" "w") |
| 6294 |
(match_operand:VU 2 "vect_par_constant_low" ""))))] |
| 6295 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6296 |
"vmovl.<US><V_sz_elem> %q0, %e1" |
| 6297 |
[(set_attr "type" "neon_shift_imm_long")] |
| 6298 |
) |
| 6299 |
|
| 6300 |
(define_insn "neon_vec_unpack<US>_hi_<mode>" |
| 6301 |
[(set (match_operand:<V_unpack> 0 "register_operand" "=w") |
| 6302 |
(SE:<V_unpack> (vec_select:<V_HALF> |
| 6303 |
(match_operand:VU 1 "register_operand" "w") |
| 6304 |
(match_operand:VU 2 "vect_par_constant_high" ""))))] |
| 6305 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6306 |
"vmovl.<US><V_sz_elem> %q0, %f1" |
| 6307 |
[(set_attr "type" "neon_shift_imm_long")] |
| 6308 |
) |
| 6309 |
|
| 6310 |
(define_expand "vec_unpack<US>_hi_<mode>" |
| 6311 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6312 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand"))] |
| 6313 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6314 |
{ |
| 6315 |
rtvec v = rtvec_alloc (<V_mode_nunits>/2) ; |
| 6316 |
rtx t1; |
| 6317 |
int i; |
| 6318 |
for (i = 0; i < (<V_mode_nunits>/2); i++) |
| 6319 |
RTVEC_ELT (v, i) = GEN_INT ((<V_mode_nunits>/2) + i); |
| 6320 |
|
| 6321 |
t1 = gen_rtx_PARALLEL (<MODE>mode, v); |
| 6322 |
emit_insn (gen_neon_vec_unpack<US>_hi_<mode> (operands[0], |
| 6323 |
operands[1], |
| 6324 |
t1)); |
| 6325 |
DONE; |
| 6326 |
} |
| 6327 |
) |
| 6328 |
|
| 6329 |
(define_expand "vec_unpack<US>_lo_<mode>" |
| 6330 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6331 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand"))] |
| 6332 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6333 |
{ |
| 6334 |
rtvec v = rtvec_alloc (<V_mode_nunits>/2) ; |
| 6335 |
rtx t1; |
| 6336 |
int i; |
| 6337 |
for (i = 0; i < (<V_mode_nunits>/2) ; i++) |
| 6338 |
RTVEC_ELT (v, i) = GEN_INT (i); |
| 6339 |
t1 = gen_rtx_PARALLEL (<MODE>mode, v); |
| 6340 |
emit_insn (gen_neon_vec_unpack<US>_lo_<mode> (operands[0], |
| 6341 |
operands[1], |
| 6342 |
t1)); |
| 6343 |
DONE; |
| 6344 |
} |
| 6345 |
) |
| 6346 |
|
| 6347 |
(define_insn "neon_vec_<US>mult_lo_<mode>" |
| 6348 |
[(set (match_operand:<V_unpack> 0 "register_operand" "=w") |
| 6349 |
(mult:<V_unpack> (SE:<V_unpack> (vec_select:<V_HALF> |
| 6350 |
(match_operand:VU 1 "register_operand" "w") |
| 6351 |
(match_operand:VU 2 "vect_par_constant_low" ""))) |
| 6352 |
(SE:<V_unpack> (vec_select:<V_HALF> |
| 6353 |
(match_operand:VU 3 "register_operand" "w") |
| 6354 |
(match_dup 2)))))] |
| 6355 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6356 |
"vmull.<US><V_sz_elem> %q0, %e1, %e3" |
| 6357 |
[(set_attr "type" "neon_mul_<V_elem_ch>_long")] |
| 6358 |
) |
| 6359 |
|
| 6360 |
(define_expand "vec_widen_<US>mult_lo_<mode>" |
| 6361 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6362 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand")) |
| 6363 |
(SE:<V_unpack> (match_operand:VU 2 "register_operand"))] |
| 6364 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6365 |
{ |
| 6366 |
rtvec v = rtvec_alloc (<V_mode_nunits>/2) ; |
| 6367 |
rtx t1; |
| 6368 |
int i; |
| 6369 |
for (i = 0; i < (<V_mode_nunits>/2) ; i++) |
| 6370 |
RTVEC_ELT (v, i) = GEN_INT (i); |
| 6371 |
t1 = gen_rtx_PARALLEL (<MODE>mode, v); |
| 6372 |
|
| 6373 |
emit_insn (gen_neon_vec_<US>mult_lo_<mode> (operands[0], |
| 6374 |
operands[1], |
| 6375 |
t1, |
| 6376 |
operands[2])); |
| 6377 |
DONE; |
| 6378 |
} |
| 6379 |
) |
| 6380 |
|
| 6381 |
(define_insn "neon_vec_<US>mult_hi_<mode>" |
| 6382 |
[(set (match_operand:<V_unpack> 0 "register_operand" "=w") |
| 6383 |
(mult:<V_unpack> (SE:<V_unpack> (vec_select:<V_HALF> |
| 6384 |
(match_operand:VU 1 "register_operand" "w") |
| 6385 |
(match_operand:VU 2 "vect_par_constant_high" ""))) |
| 6386 |
(SE:<V_unpack> (vec_select:<V_HALF> |
| 6387 |
(match_operand:VU 3 "register_operand" "w") |
| 6388 |
(match_dup 2)))))] |
| 6389 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6390 |
"vmull.<US><V_sz_elem> %q0, %f1, %f3" |
| 6391 |
[(set_attr "type" "neon_mul_<V_elem_ch>_long")] |
| 6392 |
) |
| 6393 |
|
| 6394 |
(define_expand "vec_widen_<US>mult_hi_<mode>" |
| 6395 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6396 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand")) |
| 6397 |
(SE:<V_unpack> (match_operand:VU 2 "register_operand"))] |
| 6398 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6399 |
{ |
| 6400 |
rtvec v = rtvec_alloc (<V_mode_nunits>/2) ; |
| 6401 |
rtx t1; |
| 6402 |
int i; |
| 6403 |
for (i = 0; i < (<V_mode_nunits>/2) ; i++) |
| 6404 |
RTVEC_ELT (v, i) = GEN_INT (<V_mode_nunits>/2 + i); |
| 6405 |
t1 = gen_rtx_PARALLEL (<MODE>mode, v); |
| 6406 |
|
| 6407 |
emit_insn (gen_neon_vec_<US>mult_hi_<mode> (operands[0], |
| 6408 |
operands[1], |
| 6409 |
t1, |
| 6410 |
operands[2])); |
| 6411 |
DONE; |
| 6412 |
|
| 6413 |
} |
| 6414 |
) |
| 6415 |
|
| 6416 |
(define_insn "neon_vec_<US>shiftl_<mode>" |
| 6417 |
[(set (match_operand:<V_widen> 0 "register_operand" "=w") |
| 6418 |
(SE:<V_widen> (ashift:VW (match_operand:VW 1 "register_operand" "w") |
| 6419 |
(match_operand:<V_innermode> 2 "const_neon_scalar_shift_amount_operand" ""))))] |
| 6420 |
"TARGET_NEON" |
| 6421 |
{ |
| 6422 |
return "vshll.<US><V_sz_elem> %q0, %P1, %2"; |
| 6423 |
} |
| 6424 |
[(set_attr "type" "neon_shift_imm_long")] |
| 6425 |
) |
| 6426 |
|
| 6427 |
(define_expand "vec_widen_<US>shiftl_lo_<mode>" |
| 6428 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6429 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand")) |
| 6430 |
(match_operand:SI 2 "immediate_operand")] |
| 6431 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6432 |
{ |
| 6433 |
emit_insn (gen_neon_vec_<US>shiftl_<V_half> (operands[0], |
| 6434 |
simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode, 0), |
| 6435 |
operands[2])); |
| 6436 |
DONE; |
| 6437 |
} |
| 6438 |
) |
| 6439 |
|
| 6440 |
(define_expand "vec_widen_<US>shiftl_hi_<mode>" |
| 6441 |
[(match_operand:<V_unpack> 0 "register_operand") |
| 6442 |
(SE:<V_unpack> (match_operand:VU 1 "register_operand")) |
| 6443 |
(match_operand:SI 2 "immediate_operand")] |
| 6444 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6445 |
{ |
| 6446 |
emit_insn (gen_neon_vec_<US>shiftl_<V_half> (operands[0], |
| 6447 |
simplify_gen_subreg (<V_HALF>mode, operands[1], <MODE>mode, |
| 6448 |
GET_MODE_SIZE (<V_HALF>mode)), |
| 6449 |
operands[2])); |
| 6450 |
DONE; |
| 6451 |
} |
| 6452 |
) |
| 6453 |
|
| 6454 |
;; Vectorize for non-neon-quad case |
| 6455 |
(define_insn "neon_unpack<US>_<mode>" |
| 6456 |
[(set (match_operand:<V_widen> 0 "register_operand" "=w") |
| 6457 |
(SE:<V_widen> (match_operand:VDI 1 "register_operand" "w")))] |
| 6458 |
"TARGET_NEON" |
| 6459 |
"vmovl.<US><V_sz_elem> %q0, %P1" |
| 6460 |
[(set_attr "type" "neon_move")] |
| 6461 |
) |
| 6462 |
|
| 6463 |
(define_expand "vec_unpack<US>_lo_<mode>" |
| 6464 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6465 |
(SE:<V_double_width>(match_operand:VDI 1 "register_operand"))] |
| 6466 |
"TARGET_NEON" |
| 6467 |
{ |
| 6468 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6469 |
emit_insn (gen_neon_unpack<US>_<mode> (tmpreg, operands[1])); |
| 6470 |
emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg)); |
| 6471 |
|
| 6472 |
DONE; |
| 6473 |
} |
| 6474 |
) |
| 6475 |
|
| 6476 |
(define_expand "vec_unpack<US>_hi_<mode>" |
| 6477 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6478 |
(SE:<V_double_width>(match_operand:VDI 1 "register_operand"))] |
| 6479 |
"TARGET_NEON" |
| 6480 |
{ |
| 6481 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6482 |
emit_insn (gen_neon_unpack<US>_<mode> (tmpreg, operands[1])); |
| 6483 |
emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg)); |
| 6484 |
|
| 6485 |
DONE; |
| 6486 |
} |
| 6487 |
) |
| 6488 |
|
| 6489 |
(define_insn "neon_vec_<US>mult_<mode>" |
| 6490 |
[(set (match_operand:<V_widen> 0 "register_operand" "=w") |
| 6491 |
(mult:<V_widen> (SE:<V_widen> |
| 6492 |
(match_operand:VDI 1 "register_operand" "w")) |
| 6493 |
(SE:<V_widen> |
| 6494 |
(match_operand:VDI 2 "register_operand" "w"))))] |
| 6495 |
"TARGET_NEON" |
| 6496 |
"vmull.<US><V_sz_elem> %q0, %P1, %P2" |
| 6497 |
[(set_attr "type" "neon_mul_<V_elem_ch>_long")] |
| 6498 |
) |
| 6499 |
|
| 6500 |
(define_expand "vec_widen_<US>mult_hi_<mode>" |
| 6501 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6502 |
(SE:<V_double_width> (match_operand:VDI 1 "register_operand")) |
| 6503 |
(SE:<V_double_width> (match_operand:VDI 2 "register_operand"))] |
| 6504 |
"TARGET_NEON" |
| 6505 |
{ |
| 6506 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6507 |
emit_insn (gen_neon_vec_<US>mult_<mode> (tmpreg, operands[1], operands[2])); |
| 6508 |
emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg)); |
| 6509 |
|
| 6510 |
DONE; |
| 6511 |
|
| 6512 |
} |
| 6513 |
) |
| 6514 |
|
| 6515 |
(define_expand "vec_widen_<US>mult_lo_<mode>" |
| 6516 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6517 |
(SE:<V_double_width> (match_operand:VDI 1 "register_operand")) |
| 6518 |
(SE:<V_double_width> (match_operand:VDI 2 "register_operand"))] |
| 6519 |
"TARGET_NEON" |
| 6520 |
{ |
| 6521 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6522 |
emit_insn (gen_neon_vec_<US>mult_<mode> (tmpreg, operands[1], operands[2])); |
| 6523 |
emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg)); |
| 6524 |
|
| 6525 |
DONE; |
| 6526 |
|
| 6527 |
} |
| 6528 |
) |
| 6529 |
|
| 6530 |
(define_expand "vec_widen_<US>shiftl_hi_<mode>" |
| 6531 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6532 |
(SE:<V_double_width> (match_operand:VDI 1 "register_operand")) |
| 6533 |
(match_operand:SI 2 "immediate_operand")] |
| 6534 |
"TARGET_NEON" |
| 6535 |
{ |
| 6536 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6537 |
emit_insn (gen_neon_vec_<US>shiftl_<mode> (tmpreg, operands[1], operands[2])); |
| 6538 |
emit_insn (gen_neon_vget_high<V_widen_l> (operands[0], tmpreg)); |
| 6539 |
|
| 6540 |
DONE; |
| 6541 |
} |
| 6542 |
) |
| 6543 |
|
| 6544 |
(define_expand "vec_widen_<US>shiftl_lo_<mode>" |
| 6545 |
[(match_operand:<V_double_width> 0 "register_operand") |
| 6546 |
(SE:<V_double_width> (match_operand:VDI 1 "register_operand")) |
| 6547 |
(match_operand:SI 2 "immediate_operand")] |
| 6548 |
"TARGET_NEON" |
| 6549 |
{ |
| 6550 |
rtx tmpreg = gen_reg_rtx (<V_widen>mode); |
| 6551 |
emit_insn (gen_neon_vec_<US>shiftl_<mode> (tmpreg, operands[1], operands[2])); |
| 6552 |
emit_insn (gen_neon_vget_low<V_widen_l> (operands[0], tmpreg)); |
| 6553 |
|
| 6554 |
DONE; |
| 6555 |
} |
| 6556 |
) |
| 6557 |
|
| 6558 |
; FIXME: These instruction patterns can't be used safely in big-endian mode |
| 6559 |
; because the ordering of vector elements in Q registers is different from what |
| 6560 |
; the semantics of the instructions require. |
| 6561 |
|
| 6562 |
(define_insn "vec_pack_trunc_<mode>" |
| 6563 |
[(set (match_operand:<V_narrow_pack> 0 "register_operand" "=&w") |
| 6564 |
(vec_concat:<V_narrow_pack> |
| 6565 |
(truncate:<V_narrow> |
| 6566 |
(match_operand:VN 1 "register_operand" "w")) |
| 6567 |
(truncate:<V_narrow> |
| 6568 |
(match_operand:VN 2 "register_operand" "w"))))] |
| 6569 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6570 |
"vmovn.i<V_sz_elem>\t%e0, %q1\;vmovn.i<V_sz_elem>\t%f0, %q2" |
| 6571 |
[(set_attr "type" "multiple") |
| 6572 |
(set_attr "length" "8")] |
| 6573 |
) |
| 6574 |
|
| 6575 |
;; For the non-quad case. |
| 6576 |
(define_insn "neon_vec_pack_trunc_<mode>" |
| 6577 |
[(set (match_operand:<V_narrow> 0 "register_operand" "=w") |
| 6578 |
(truncate:<V_narrow> (match_operand:VN 1 "register_operand" "w")))] |
| 6579 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6580 |
"vmovn.i<V_sz_elem>\t%P0, %q1" |
| 6581 |
[(set_attr "type" "neon_move_narrow_q")] |
| 6582 |
) |
| 6583 |
|
| 6584 |
(define_expand "vec_pack_trunc_<mode>" |
| 6585 |
[(match_operand:<V_narrow_pack> 0 "register_operand") |
| 6586 |
(match_operand:VSHFT 1 "register_operand") |
| 6587 |
(match_operand:VSHFT 2 "register_operand")] |
| 6588 |
"TARGET_NEON && !BYTES_BIG_ENDIAN" |
| 6589 |
{ |
| 6590 |
rtx tempreg = gen_reg_rtx (<V_DOUBLE>mode); |
| 6591 |
|
| 6592 |
emit_insn (gen_move_lo_quad_<V_double> (tempreg, operands[1])); |
| 6593 |
emit_insn (gen_move_hi_quad_<V_double> (tempreg, operands[2])); |
| 6594 |
emit_insn (gen_neon_vec_pack_trunc_<V_double> (operands[0], tempreg)); |
| 6595 |
DONE; |
| 6596 |
}) |
| 6597 |
|
| 6598 |
(define_insn "neon_vabd<mode>_2" |
| 6599 |
[(set (match_operand:VF 0 "s_register_operand" "=w") |
| 6600 |
(abs:VF (minus:VF (match_operand:VF 1 "s_register_operand" "w") |
| 6601 |
(match_operand:VF 2 "s_register_operand" "w"))))] |
| 6602 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 6603 |
"vabd.<V_s_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 6604 |
[(set_attr "type" "neon_fp_abd_s<q>")] |
| 6605 |
) |
| 6606 |
|
| 6607 |
(define_insn "neon_vabd<mode>_3" |
| 6608 |
[(set (match_operand:VF 0 "s_register_operand" "=w") |
| 6609 |
(abs:VF (unspec:VF [(match_operand:VF 1 "s_register_operand" "w") |
| 6610 |
(match_operand:VF 2 "s_register_operand" "w")] |
| 6611 |
UNSPEC_VSUB)))] |
| 6612 |
"ARM_HAVE_NEON_<MODE>_ARITH" |
| 6613 |
"vabd.<V_if_elem> %<V_reg>0, %<V_reg>1, %<V_reg>2" |
| 6614 |
[(set_attr "type" "neon_fp_abd_s<q>")] |
| 6615 |
) |
| 6616 |
|
| 6617 |
(define_insn "neon_<sup>mmlav16qi" |
| 6618 |
[(set (match_operand:V4SI 0 "register_operand" "=w") |
| 6619 |
(plus:V4SI |
| 6620 |
(unspec:V4SI [(match_operand:V16QI 2 "register_operand" "w") |
| 6621 |
(match_operand:V16QI 3 "register_operand" "w")] MATMUL) |
| 6622 |
(match_operand:V4SI 1 "register_operand" "0")))] |
| 6623 |
"TARGET_I8MM" |
| 6624 |
"v<sup>mmla.<mmla_sfx>\t%q0, %q2, %q3" |
| 6625 |
[(set_attr "type" "neon_mla_s_q")] |
| 6626 |
) |
| 6627 |
|
| 6628 |
(define_insn "neon_vbfdot<VCVTF:mode>" |
| 6629 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 6630 |
(plus:VCVTF (match_operand:VCVTF 1 "register_operand" "0") |
| 6631 |
(unspec:VCVTF [ |
| 6632 |
(match_operand:<VSF2BF> 2 "register_operand" "w") |
| 6633 |
(match_operand:<VSF2BF> 3 "register_operand" "w")] |
| 6634 |
UNSPEC_DOT_S)))] |
| 6635 |
"TARGET_BF16_SIMD" |
| 6636 |
"vdot.bf16\\t%<V_reg>0, %<V_reg>2, %<V_reg>3" |
| 6637 |
[(set_attr "type" "neon_dot<q>")] |
| 6638 |
) |
| 6639 |
|
| 6640 |
(define_insn "neon_vbfdot_lanev4bf<VCVTF:mode>" |
| 6641 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 6642 |
(plus:VCVTF (match_operand:VCVTF 1 "register_operand" "0") |
| 6643 |
(unspec:VCVTF [ |
| 6644 |
(match_operand:<VSF2BF> 2 "register_operand" "w") |
| 6645 |
(match_operand:V4BF 3 "register_operand" "x") |
| 6646 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 6647 |
UNSPEC_DOT_S)))] |
| 6648 |
"TARGET_BF16_SIMD" |
| 6649 |
"vdot.bf16\\t%<V_reg>0, %<V_reg>2, %P3[%c4]" |
| 6650 |
[(set_attr "type" "neon_dot<q>")] |
| 6651 |
) |
| 6652 |
|
| 6653 |
(define_insn "neon_vbfdot_lanev8bf<VCVTF:mode>" |
| 6654 |
[(set (match_operand:VCVTF 0 "register_operand" "=w") |
| 6655 |
(plus:VCVTF (match_operand:VCVTF 1 "register_operand" "0") |
| 6656 |
(unspec:VCVTF [ |
| 6657 |
(match_operand:<VSF2BF> 2 "register_operand" "w") |
| 6658 |
(match_operand:V8BF 3 "register_operand" "x") |
| 6659 |
(match_operand:SI 4 "immediate_operand" "i")] |
| 6660 |
UNSPEC_DOT_S)))] |
| 6661 |
"TARGET_BF16_SIMD" |
| 6662 |
{ |
| 6663 |
int lane = INTVAL (operands[4]); |
| 6664 |
int half = GET_MODE_NUNITS (GET_MODE (operands[3])) / 4; |
| 6665 |
if (lane < half) |
| 6666 |
return "vdot.bf16\\t%<V_reg>0, %<V_reg>2, %e3[%c4]"; |
| 6667 |
else |
| 6668 |
{ |
| 6669 |
operands[4] = GEN_INT (lane - half); |
| 6670 |
return "vdot.bf16\\t%<V_reg>0, %<V_reg>2, %f3[%c4]"; |
| 6671 |
} |
| 6672 |
} |
| 6673 |
[(set_attr "type" "neon_dot<q>")] |
| 6674 |
) |
| 6675 |
|
| 6676 |
(define_insn "neon_vbfcvtv4sf<VBFCVT:mode>" |
| 6677 |
[(set (match_operand:VBFCVT 0 "register_operand" "=w") |
| 6678 |
(unspec:VBFCVT [(match_operand:V4SF 1 "register_operand" "w")] |
| 6679 |
UNSPEC_BFCVT))] |
| 6680 |
"TARGET_BF16_SIMD" |
| 6681 |
"vcvt.bf16.f32\\t%<V_bf_low>0, %q1" |
| 6682 |
[(set_attr "type" "neon_fp_cvt_narrow_s_q")] |
| 6683 |
) |
| 6684 |
|
| 6685 |
(define_insn "neon_vbfcvtv4sf_highv8bf" |
| 6686 |
[(set (match_operand:V8BF 0 "register_operand" "=w") |
| 6687 |
(unspec:V8BF [(match_operand:V8BF 1 "register_operand" "0") |
| 6688 |
(match_operand:V4SF 2 "register_operand" "w")] |
| 6689 |
UNSPEC_BFCVT_HIGH))] |
| 6690 |
"TARGET_BF16_SIMD" |
| 6691 |
"vcvt.bf16.f32\\t%f0, %q2" |
| 6692 |
[(set_attr "type" "neon_fp_cvt_narrow_s_q")] |
| 6693 |
) |
| 6694 |
|
| 6695 |
(define_insn "neon_vbfcvtsf" |
| 6696 |
[(set (match_operand:BF 0 "register_operand" "=t") |
| 6697 |
(unspec:BF [(match_operand:SF 1 "register_operand" "t")] |
| 6698 |
UNSPEC_BFCVT))] |
| 6699 |
"TARGET_BF16_FP" |
| 6700 |
"vcvtb.bf16.f32\\t%0, %1" |
| 6701 |
[(set_attr "type" "f_cvt")] |
| 6702 |
) |
| 6703 |
|
| 6704 |
(define_insn "neon_vbfcvt<VBFCVT:mode>" |
| 6705 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6706 |
(unspec:V4SF [(match_operand:VBFCVT 1 "register_operand" "w")] |
| 6707 |
UNSPEC_BFCVT))] |
| 6708 |
"TARGET_BF16_SIMD" |
| 6709 |
"vshll.u32\\t%q0, %<V_bf_low>1, #16" |
| 6710 |
[(set_attr "type" "neon_shift_imm_q")] |
| 6711 |
) |
| 6712 |
|
| 6713 |
(define_insn "neon_vbfcvt_highv8bf" |
| 6714 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6715 |
(unspec:V4SF [(match_operand:V8BF 1 "register_operand" "w")] |
| 6716 |
UNSPEC_BFCVT_HIGH))] |
| 6717 |
"TARGET_BF16_SIMD" |
| 6718 |
"vshll.u32\\t%q0, %f1, #16" |
| 6719 |
[(set_attr "type" "neon_shift_imm_q")] |
| 6720 |
) |
| 6721 |
|
| 6722 |
;; Convert a BF scalar operand to SF via VSHL. |
| 6723 |
;; VSHL doesn't accept 32-bit registers where the BF and SF scalar operands |
| 6724 |
;; would be allocated, therefore the operands must be converted to intermediate |
| 6725 |
;; vectors (i.e. V2SI) in order to apply 64-bit registers. |
| 6726 |
(define_expand "neon_vbfcvtbf" |
| 6727 |
[(match_operand:SF 0 "register_operand") |
| 6728 |
(unspec:SF [(match_operand:BF 1 "register_operand")] UNSPEC_BFCVT)] |
| 6729 |
"TARGET_BF16_FP" |
| 6730 |
{ |
| 6731 |
rtx op0 = gen_reg_rtx (V2SImode); |
| 6732 |
rtx op1 = gen_reg_rtx (V2SImode); |
| 6733 |
emit_insn (gen_neon_vbfcvtbf_cvtmodev2si (op1, operands[1])); |
| 6734 |
emit_insn (gen_neon_vshl_nv2si (op0, op1, gen_int_mode(16, SImode))); |
| 6735 |
emit_insn (gen_neon_vbfcvtbf_cvtmodesf (operands[0], op0)); |
| 6736 |
DONE; |
| 6737 |
}) |
| 6738 |
|
| 6739 |
;; Convert BF mode to V2SI and V2SI to SF. |
| 6740 |
;; Implement this by allocating a 32-bit operand in the low half of a 64-bit |
| 6741 |
;; register indexed by a 32-bit sub-register number. |
| 6742 |
;; This will generate reloads but compiler can optimize out the moves. |
| 6743 |
;; Use 'x' constraint to guarantee the 32-bit sub-registers in an indexable |
| 6744 |
;; range so that to avoid extra moves. |
| 6745 |
(define_insn "neon_vbfcvtbf_cvtmode<mode>" |
| 6746 |
[(set (match_operand:VBFCVTM 0 "register_operand" "=x") |
| 6747 |
(unspec:VBFCVTM [(match_operand:<V_bf_cvt_m> 1 "register_operand" "0")] |
| 6748 |
UNSPEC_BFCVT))] |
| 6749 |
"TARGET_BF16_FP" |
| 6750 |
"" |
| 6751 |
) |
| 6752 |
|
| 6753 |
(define_insn "neon_vmmlav8bf" |
| 6754 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6755 |
(plus:V4SF (match_operand:V4SF 1 "register_operand" "0") |
| 6756 |
(unspec:V4SF [(match_operand:V8BF 2 "register_operand" "w") |
| 6757 |
(match_operand:V8BF 3 "register_operand" "w")] |
| 6758 |
UNSPEC_BFMMLA)))] |
| 6759 |
"TARGET_BF16_SIMD" |
| 6760 |
"vmmla.bf16\\t%q0, %q2, %q3" |
| 6761 |
[(set_attr "type" "neon_fp_mla_s_q")] |
| 6762 |
) |
| 6763 |
|
| 6764 |
(define_insn "neon_vfma<bt>v8bf" |
| 6765 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6766 |
(plus: V4SF (match_operand:V4SF 1 "register_operand" "0") |
| 6767 |
(unspec:V4SF [(match_operand:V8BF 2 "register_operand" "w") |
| 6768 |
(match_operand:V8BF 3 "register_operand" "w")] |
| 6769 |
BF_MA)))] |
| 6770 |
"TARGET_BF16_SIMD" |
| 6771 |
"vfma<bt>.bf16\\t%q0, %q2, %q3" |
| 6772 |
[(set_attr "type" "neon_fp_mla_s_q")] |
| 6773 |
) |
| 6774 |
|
| 6775 |
(define_insn "neon_vfma<bt>_lanev8bf" |
| 6776 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6777 |
(plus: V4SF (match_operand:V4SF 1 "register_operand" "0") |
| 6778 |
(unspec:V4SF [(match_operand:V8BF 2 "register_operand" "w") |
| 6779 |
(match_operand:V4BF 3 "register_operand" "x") |
| 6780 |
(match_operand:SI 4 "const_int_operand" "n")] |
| 6781 |
BF_MA)))] |
| 6782 |
"TARGET_BF16_SIMD" |
| 6783 |
"vfma<bt>.bf16\\t%q0, %q2, %P3[%c4]" |
| 6784 |
[(set_attr "type" "neon_fp_mla_s_scalar_q")] |
| 6785 |
) |
| 6786 |
|
| 6787 |
(define_expand "neon_vfma<bt>_laneqv8bf" |
| 6788 |
[(set (match_operand:V4SF 0 "register_operand" "=w") |
| 6789 |
(plus: V4SF (match_operand:V4SF 1 "register_operand" "0") |
| 6790 |
(unspec:V4SF [(match_operand:V8BF 2 "register_operand" "w") |
| 6791 |
(match_operand:V8BF 3 "register_operand" "x") |
| 6792 |
(match_operand:SI 4 "const_int_operand" "n")] |
| 6793 |
BF_MA)))] |
| 6794 |
"TARGET_BF16_SIMD" |
| 6795 |
{ |
| 6796 |
int lane = INTVAL (operands[4]); |
| 6797 |
gcc_assert (IN_RANGE(lane, 0, 7)); |
| 6798 |
if (lane < 4) |
| 6799 |
{ |
| 6800 |
emit_insn (gen_neon_vfma<bt>_lanev8bf (operands[0], operands[1], operands[2], operands[3], operands[4])); |
| 6801 |
} |
| 6802 |
else |
| 6803 |
{ |
| 6804 |
rtx op_highpart = gen_reg_rtx (V4BFmode); |
| 6805 |
emit_insn (gen_neon_vget_highv8bf (op_highpart, operands[3])); |
| 6806 |
operands[4] = GEN_INT (lane - 4); |
| 6807 |
emit_insn (gen_neon_vfma<bt>_lanev8bf (operands[0], operands[1], operands[2], op_highpart, operands[4])); |
| 6808 |
} |
| 6809 |
DONE; |
| 6810 |
} |
| 6811 |
[(set_attr "type" "neon_fp_mla_s_scalar_q")] |
| 6812 |
) |