diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-11-06 20:02:10 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-11-06 20:02:10 +0000 |
commit | 7ac29c0fa046d6018bad07ab17ec17585b5ef4ce (patch) | |
tree | 60361d1dfcf632b8f66d3272c2f3f9234e59d95b /gcc | |
parent | 6e601f26f2b4a43a31c8e8f818baeee27875195d (diff) | |
download | gcc-7ac29c0fa046d6018bad07ab17ec17585b5ef4ce.zip gcc-7ac29c0fa046d6018bad07ab17ec17585b5ef4ce.tar.gz gcc-7ac29c0fa046d6018bad07ab17ec17585b5ef4ce.tar.bz2 |
[AArch64] Add an endian_lane_rtx helper routine
Later patches turn the number of vector units into a poly_int.
We deliberately don't support applying GEN_INT to those (except
in target code that doesn't distinguish between poly_ints and normal
constants); gen_int_mode needs to be used instead.
This patch therefore replaces instances of:
GEN_INT (ENDIAN_LANE_N (builtin_mode, INTVAL (op[opc])))
with uses of a new endian_lane_rtx function.
2017-11-06 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* config/aarch64/aarch64-protos.h (aarch64_endian_lane_rtx): Declare.
* config/aarch64/aarch64.c (aarch64_endian_lane_rtx): New function.
* config/aarch64/aarch64.h (ENDIAN_LANE_N): Take the number
of units rather than the mode.
* config/aarch64/iterators.md (nunits): New mode attribute.
* config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args):
Use aarch64_endian_lane_rtx instead of GEN_INT (ENDIAN_LANE_N ...).
* config/aarch64/aarch64-simd.md (aarch64_dup_lane<mode>)
(aarch64_dup_lane_<vswap_width_name><mode>, *aarch64_mul3_elt<mode>)
(*aarch64_mul3_elt_<vswap_width_name><mode>): Likewise.
(*aarch64_mul3_elt_to_64v2df, *aarch64_mla_elt<mode>): Likewise.
(*aarch64_mla_elt_<vswap_width_name><mode>, *aarch64_mls_elt<mode>)
(*aarch64_mls_elt_<vswap_width_name><mode>, *aarch64_fma4_elt<mode>)
(*aarch64_fma4_elt_<vswap_width_name><mode>):: Likewise.
(*aarch64_fma4_elt_to_64v2df, *aarch64_fnma4_elt<mode>): Likewise.
(*aarch64_fnma4_elt_<vswap_width_name><mode>): Likewise.
(*aarch64_fnma4_elt_to_64v2df, reduc_plus_scal_<mode>): Likewise.
(reduc_plus_scal_v4sf, reduc_<maxmin_uns>_scal_<mode>): Likewise.
(reduc_<maxmin_uns>_scal_<mode>): Likewise.
(*aarch64_get_lane_extend<GPI:mode><VDQQH:mode>): Likewise.
(*aarch64_get_lane_zero_extendsi<mode>): Likewise.
(aarch64_get_lane<mode>, *aarch64_mulx_elt_<vswap_width_name><mode>)
(*aarch64_mulx_elt<mode>, *aarch64_vgetfmulx<mode>): Likewise.
(aarch64_sq<r>dmulh_lane<mode>, aarch64_sq<r>dmulh_laneq<mode>)
(aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_lane<mode>): Likewise.
(aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_laneq<mode>): Likewise.
(aarch64_sqdml<SBINQOPS:as>l_lane<mode>): Likewise.
(aarch64_sqdml<SBINQOPS:as>l_laneq<mode>): Likewise.
(aarch64_sqdml<SBINQOPS:as>l2_lane<mode>_internal): Likewise.
(aarch64_sqdml<SBINQOPS:as>l2_laneq<mode>_internal): Likewise.
(aarch64_sqdmull_lane<mode>, aarch64_sqdmull_laneq<mode>): Likewise.
(aarch64_sqdmull2_lane<mode>_internal): Likewise.
(aarch64_sqdmull2_laneq<mode>_internal): Likewise.
(aarch64_vec_load_lanesoi_lane<mode>): Likewise.
(aarch64_vec_store_lanesoi_lane<mode>): Likewise.
(aarch64_vec_load_lanesci_lane<mode>): Likewise.
(aarch64_vec_store_lanesci_lane<mode>): Likewise.
(aarch64_vec_load_lanesxi_lane<mode>): Likewise.
(aarch64_vec_store_lanesxi_lane<mode>): Likewise.
(aarch64_simd_vec_set<mode>): Update use of ENDIAN_LANE_N.
(aarch64_simd_vec_setv2di): Likewise.
Reviewed-by: James Greenhalgh <james.greenhalgh@arm.com>
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254466
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 46 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64-builtins.c | 6 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64-simd.md | 115 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 9 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.h | 4 | ||||
-rw-r--r-- | gcc/config/aarch64/iterators.md | 11 |
7 files changed, 126 insertions, 66 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 889e36a..04f4d13 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,49 @@ +2017-11-06 Richard Sandiford <richard.sandiford@linaro.org> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + + * config/aarch64/aarch64-protos.h (aarch64_endian_lane_rtx): Declare. + * config/aarch64/aarch64.c (aarch64_endian_lane_rtx): New function. + * config/aarch64/aarch64.h (ENDIAN_LANE_N): Take the number + of units rather than the mode. + * config/aarch64/iterators.md (nunits): New mode attribute. + * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): + Use aarch64_endian_lane_rtx instead of GEN_INT (ENDIAN_LANE_N ...). + * config/aarch64/aarch64-simd.md (aarch64_dup_lane<mode>) + (aarch64_dup_lane_<vswap_width_name><mode>, *aarch64_mul3_elt<mode>) + (*aarch64_mul3_elt_<vswap_width_name><mode>): Likewise. + (*aarch64_mul3_elt_to_64v2df, *aarch64_mla_elt<mode>): Likewise. + (*aarch64_mla_elt_<vswap_width_name><mode>, *aarch64_mls_elt<mode>) + (*aarch64_mls_elt_<vswap_width_name><mode>, *aarch64_fma4_elt<mode>) + (*aarch64_fma4_elt_<vswap_width_name><mode>):: Likewise. + (*aarch64_fma4_elt_to_64v2df, *aarch64_fnma4_elt<mode>): Likewise. + (*aarch64_fnma4_elt_<vswap_width_name><mode>): Likewise. + (*aarch64_fnma4_elt_to_64v2df, reduc_plus_scal_<mode>): Likewise. + (reduc_plus_scal_v4sf, reduc_<maxmin_uns>_scal_<mode>): Likewise. + (reduc_<maxmin_uns>_scal_<mode>): Likewise. + (*aarch64_get_lane_extend<GPI:mode><VDQQH:mode>): Likewise. + (*aarch64_get_lane_zero_extendsi<mode>): Likewise. + (aarch64_get_lane<mode>, *aarch64_mulx_elt_<vswap_width_name><mode>) + (*aarch64_mulx_elt<mode>, *aarch64_vgetfmulx<mode>): Likewise. + (aarch64_sq<r>dmulh_lane<mode>, aarch64_sq<r>dmulh_laneq<mode>) + (aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_lane<mode>): Likewise. + (aarch64_sqrdml<SQRDMLH_AS:rdma_as>h_laneq<mode>): Likewise. + (aarch64_sqdml<SBINQOPS:as>l_lane<mode>): Likewise. + (aarch64_sqdml<SBINQOPS:as>l_laneq<mode>): Likewise. + (aarch64_sqdml<SBINQOPS:as>l2_lane<mode>_internal): Likewise. + (aarch64_sqdml<SBINQOPS:as>l2_laneq<mode>_internal): Likewise. + (aarch64_sqdmull_lane<mode>, aarch64_sqdmull_laneq<mode>): Likewise. + (aarch64_sqdmull2_lane<mode>_internal): Likewise. + (aarch64_sqdmull2_laneq<mode>_internal): Likewise. + (aarch64_vec_load_lanesoi_lane<mode>): Likewise. + (aarch64_vec_store_lanesoi_lane<mode>): Likewise. + (aarch64_vec_load_lanesci_lane<mode>): Likewise. + (aarch64_vec_store_lanesci_lane<mode>): Likewise. + (aarch64_vec_load_lanesxi_lane<mode>): Likewise. + (aarch64_vec_store_lanesxi_lane<mode>): Likewise. + (aarch64_simd_vec_set<mode>): Update use of ENDIAN_LANE_N. + (aarch64_simd_vec_setv2di): Likewise. + 2017-11-06 Carl Love <cel@us.ibm.com> * config/rs6000/rs6000-c.c (P8V_BUILTIN_VEC_REVB): Add power 8 diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 242b2e3..ff4ab60 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -1067,8 +1067,8 @@ aarch64_simd_expand_args (rtx target, int icode, int have_retval, GET_MODE_NUNITS (builtin_mode), exp); /* Keep to GCC-vector-extension lane indices in the RTL. */ - op[opc] = - GEN_INT (ENDIAN_LANE_N (builtin_mode, INTVAL (op[opc]))); + op[opc] = aarch64_endian_lane_rtx (builtin_mode, + INTVAL (op[opc])); } goto constant_arg; @@ -1081,7 +1081,7 @@ aarch64_simd_expand_args (rtx target, int icode, int have_retval, aarch64_simd_lane_bounds (op[opc], 0, GET_MODE_NUNITS (vmode), exp); /* Keep to GCC-vector-extension lane indices in the RTL. */ - op[opc] = GEN_INT (ENDIAN_LANE_N (vmode, INTVAL (op[opc]))); + op[opc] = aarch64_endian_lane_rtx (vmode, INTVAL (op[opc])); } /* Fall through - if the lane index isn't a constant then the next case will error. */ diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 345bfe8..4df2ee0 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -425,6 +425,7 @@ void aarch64_simd_emit_reg_reg_move (rtx *, machine_mode, unsigned int); rtx aarch64_simd_expand_builtin (int, tree, rtx); void aarch64_simd_lane_bounds (rtx, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); +rtx aarch64_endian_lane_rtx (machine_mode, unsigned int); void aarch64_split_128bit_move (rtx, rtx); diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index a3600b3..445503d 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -80,7 +80,7 @@ )))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "dup\\t%0.<Vtype>, %1.<Vetype>[%2]"; } [(set_attr "type" "neon_dup<q>")] @@ -95,8 +95,7 @@ )))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "dup\\t%0.<Vtype>, %1.<Vetype>[%2]"; } [(set_attr "type" "neon_dup<q>")] @@ -502,7 +501,7 @@ (match_operand:VMUL 3 "register_operand" "w")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "<f>mul\\t%0.<Vtype>, %3.<Vtype>, %1.<Vetype>[%2]"; } [(set_attr "type" "neon<fp>_mul_<stype>_scalar<q>")] @@ -518,8 +517,7 @@ (match_operand:VMUL_CHANGE_NLANES 3 "register_operand" "w")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "<f>mul\\t%0.<Vtype>, %3.<Vtype>, %1.<Vetype>[%2]"; } [(set_attr "type" "neon<fp>_mul_<Vetype>_scalar<q>")] @@ -572,7 +570,7 @@ (match_operand:DF 3 "register_operand" "w")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (V2DFmode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (V2DFmode, INTVAL (operands[2])); return "fmul\\t%0.2d, %3.2d, %1.d[%2]"; } [(set_attr "type" "neon_fp_mul_d_scalar_q")] @@ -707,7 +705,7 @@ (match_operand:SI 2 "immediate_operand" "i,i,i")))] "TARGET_SIMD" { - int elt = ENDIAN_LANE_N (<MODE>mode, exact_log2 (INTVAL (operands[2]))); + int elt = ENDIAN_LANE_N (<nunits>, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT ((HOST_WIDE_INT) 1 << elt); switch (which_alternative) { @@ -1073,7 +1071,7 @@ (match_operand:SI 2 "immediate_operand" "i,i")))] "TARGET_SIMD" { - int elt = ENDIAN_LANE_N (V2DImode, exact_log2 (INTVAL (operands[2]))); + int elt = ENDIAN_LANE_N (2, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT ((HOST_WIDE_INT) 1 << elt); switch (which_alternative) { @@ -1110,7 +1108,7 @@ (match_operand:SI 2 "immediate_operand" "i")))] "TARGET_SIMD" { - int elt = ENDIAN_LANE_N (<MODE>mode, exact_log2 (INTVAL (operands[2]))); + int elt = ENDIAN_LANE_N (<nunits>, exact_log2 (INTVAL (operands[2]))); operands[2] = GEN_INT ((HOST_WIDE_INT)1 << elt); return "ins\t%0.<Vetype>[%p2], %1.<Vetype>[0]"; @@ -1155,7 +1153,7 @@ (match_operand:VDQHS 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "mla\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_mla_<Vetype>_scalar<q>")] @@ -1173,8 +1171,7 @@ (match_operand:VDQHS 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "mla\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_mla_<Vetype>_scalar<q>")] @@ -1214,7 +1211,7 @@ (match_operand:VDQHS 3 "register_operand" "w"))))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "mls\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_mla_<Vetype>_scalar<q>")] @@ -1232,8 +1229,7 @@ (match_operand:VDQHS 3 "register_operand" "w"))))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "mls\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_mla_<Vetype>_scalar<q>")] @@ -1803,7 +1799,7 @@ (match_operand:VDQF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "fmla\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_fp_mla_<Vetype>_scalar<q>")] @@ -1820,8 +1816,7 @@ (match_operand:VDQSF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "fmla\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_fp_mla_<Vetype>_scalar<q>")] @@ -1849,7 +1844,7 @@ (match_operand:DF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (V2DFmode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (V2DFmode, INTVAL (operands[2])); return "fmla\\t%0.2d, %3.2d, %1.2d[%2]"; } [(set_attr "type" "neon_fp_mla_d_scalar_q")] @@ -1879,7 +1874,7 @@ (match_operand:VDQF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "fmls\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_fp_mla_<Vetype>_scalar<q>")] @@ -1897,8 +1892,7 @@ (match_operand:VDQSF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[2])); return "fmls\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"; } [(set_attr "type" "neon_fp_mla_<Vetype>_scalar<q>")] @@ -1928,7 +1922,7 @@ (match_operand:DF 4 "register_operand" "0")))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (V2DFmode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (V2DFmode, INTVAL (operands[2])); return "fmls\\t%0.2d, %3.2d, %1.2d[%2]"; } [(set_attr "type" "neon_fp_mla_d_scalar_q")] @@ -2261,7 +2255,7 @@ UNSPEC_ADDV)] "TARGET_SIMD" { - rtx elt = GEN_INT (ENDIAN_LANE_N (<MODE>mode, 0)); + rtx elt = aarch64_endian_lane_rtx (<MODE>mode, 0); rtx scratch = gen_reg_rtx (<MODE>mode); emit_insn (gen_aarch64_reduc_plus_internal<mode> (scratch, operands[1])); emit_insn (gen_aarch64_get_lane<mode> (operands[0], scratch, elt)); @@ -2312,7 +2306,7 @@ UNSPEC_FADDV))] "TARGET_SIMD" { - rtx elt = GEN_INT (ENDIAN_LANE_N (V4SFmode, 0)); + rtx elt = aarch64_endian_lane_rtx (V4SFmode, 0); rtx scratch = gen_reg_rtx (V4SFmode); emit_insn (gen_aarch64_faddpv4sf (scratch, operands[1], operands[1])); emit_insn (gen_aarch64_faddpv4sf (scratch, scratch, scratch)); @@ -2354,7 +2348,7 @@ FMAXMINV)] "TARGET_SIMD" { - rtx elt = GEN_INT (ENDIAN_LANE_N (<MODE>mode, 0)); + rtx elt = aarch64_endian_lane_rtx (<MODE>mode, 0); rtx scratch = gen_reg_rtx (<MODE>mode); emit_insn (gen_aarch64_reduc_<maxmin_uns>_internal<mode> (scratch, operands[1])); @@ -2370,7 +2364,7 @@ MAXMINV)] "TARGET_SIMD" { - rtx elt = GEN_INT (ENDIAN_LANE_N (<MODE>mode, 0)); + rtx elt = aarch64_endian_lane_rtx (<MODE>mode, 0); rtx scratch = gen_reg_rtx (<MODE>mode); emit_insn (gen_aarch64_reduc_<maxmin_uns>_internal<mode> (scratch, operands[1])); @@ -2895,7 +2889,7 @@ (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "smov\\t%<GPI:w>0, %1.<VDQQH:Vetype>[%2]"; } [(set_attr "type" "neon_to_gp<q>")] @@ -2909,7 +2903,7 @@ (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "umov\\t%w0, %1.<Vetype>[%2]"; } [(set_attr "type" "neon_to_gp<q>")] @@ -2925,7 +2919,7 @@ (parallel [(match_operand:SI 2 "immediate_operand" "i, i, i")])))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); switch (which_alternative) { case 0: @@ -3301,8 +3295,7 @@ UNSPEC_FMULX))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VSWAP_WIDTH>mode, - INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VSWAP_WIDTH>mode, INTVAL (operands[3])); return "fmulx\t%<v>0<Vmtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_fp_mul_<Vetype>_scalar<q>")] @@ -3321,7 +3314,7 @@ UNSPEC_FMULX))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[3])); return "fmulx\t%<v>0<Vmtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_fp_mul_<Vetype><q>")] @@ -3355,7 +3348,7 @@ UNSPEC_FMULX))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[3])); return "fmulx\t%<Vetype>0, %<Vetype>1, %2.<Vetype>[%3]"; } [(set_attr "type" "fmul<Vetype>")] @@ -3441,7 +3434,7 @@ VQDMULH))] "TARGET_SIMD" "* - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[3])); return \"sq<r>dmulh\\t%0.<Vtype>, %1.<Vtype>, %2.<Vetype>[%3]\";" [(set_attr "type" "neon_sat_mul_<Vetype>_scalar<q>")] ) @@ -3456,7 +3449,7 @@ VQDMULH))] "TARGET_SIMD" "* - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[3])); return \"sq<r>dmulh\\t%0.<Vtype>, %1.<Vtype>, %2.<Vetype>[%3]\";" [(set_attr "type" "neon_sat_mul_<Vetype>_scalar<q>")] ) @@ -3471,7 +3464,7 @@ VQDMULH))] "TARGET_SIMD" "* - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[3])); return \"sq<r>dmulh\\t%<v>0, %<v>1, %2.<v>[%3]\";" [(set_attr "type" "neon_sat_mul_<Vetype>_scalar<q>")] ) @@ -3486,7 +3479,7 @@ VQDMULH))] "TARGET_SIMD" "* - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[3])); return \"sq<r>dmulh\\t%<v>0, %<v>1, %2.<v>[%3]\";" [(set_attr "type" "neon_sat_mul_<Vetype>_scalar<q>")] ) @@ -3518,7 +3511,7 @@ SQRDMLH_AS))] "TARGET_SIMD_RDMA" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[4])); return "sqrdml<SQRDMLH_AS:rdma_as>h\\t%0.<Vtype>, %2.<Vtype>, %3.<Vetype>[%4]"; } @@ -3536,7 +3529,7 @@ SQRDMLH_AS))] "TARGET_SIMD_RDMA" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[4])); return "sqrdml<SQRDMLH_AS:rdma_as>h\\t%<v>0, %<v>2, %3.<Vetype>[%4]"; } @@ -3556,7 +3549,7 @@ SQRDMLH_AS))] "TARGET_SIMD_RDMA" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[4])); return "sqrdml<SQRDMLH_AS:rdma_as>h\\t%0.<Vtype>, %2.<Vtype>, %3.<Vetype>[%4]"; } @@ -3574,7 +3567,7 @@ SQRDMLH_AS))] "TARGET_SIMD_RDMA" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[4])); return "sqrdml<SQRDMLH_AS:rdma_as>h\\t%<v>0, %<v>2, %3.<v>[%4]"; } @@ -3618,7 +3611,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3642,7 +3635,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3665,7 +3658,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3688,7 +3681,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3783,7 +3776,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l2\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3809,7 +3802,7 @@ (const_int 1))))] "TARGET_SIMD" { - operands[4] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[4]))); + operands[4] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[4])); return "sqdml<SBINQOPS:as>l2\\t%<vw2>0<Vmwtype>, %<v>2<Vmtype>, %3.<Vetype>[%4]"; } @@ -3956,7 +3949,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[3])); return "sqdmull\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -3977,7 +3970,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[3])); return "sqdmull\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -3997,7 +3990,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[3])); return "sqdmull\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -4017,7 +4010,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[3])); return "sqdmull\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -4095,7 +4088,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCOND>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCOND>mode, INTVAL (operands[3])); return "sqdmull2\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -4118,7 +4111,7 @@ (const_int 1)))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<VCONQ>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<VCONQ>mode, INTVAL (operands[3])); return "sqdmull2\\t%<vw2>0<Vmwtype>, %<v>1<Vmtype>, %2.<Vetype>[%3]"; } [(set_attr "type" "neon_sat_mul_<Vetype>_scalar_long")] @@ -4624,7 +4617,7 @@ UNSPEC_LD2_LANE))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[3])); return "ld2\\t{%S0.<Vetype> - %T0.<Vetype>}[%3], %1"; } [(set_attr "type" "neon_load2_one_lane")] @@ -4668,7 +4661,7 @@ UNSPEC_ST2_LANE))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "st2\\t{%S1.<Vetype> - %T1.<Vetype>}[%2], %0"; } [(set_attr "type" "neon_store2_one_lane<q>")] @@ -4722,7 +4715,7 @@ UNSPEC_LD3_LANE))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[3])); return "ld3\\t{%S0.<Vetype> - %U0.<Vetype>}[%3], %1"; } [(set_attr "type" "neon_load3_one_lane")] @@ -4766,7 +4759,7 @@ UNSPEC_ST3_LANE))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "st3\\t{%S1.<Vetype> - %U1.<Vetype>}[%2], %0"; } [(set_attr "type" "neon_store3_one_lane<q>")] @@ -4820,7 +4813,7 @@ UNSPEC_LD4_LANE))] "TARGET_SIMD" { - operands[3] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[3]))); + operands[3] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[3])); return "ld4\\t{%S0.<Vetype> - %V0.<Vetype>}[%3], %1"; } [(set_attr "type" "neon_load4_one_lane")] @@ -4864,7 +4857,7 @@ UNSPEC_ST4_LANE))] "TARGET_SIMD" { - operands[2] = GEN_INT (ENDIAN_LANE_N (<MODE>mode, INTVAL (operands[2]))); + operands[2] = aarch64_endian_lane_rtx (<MODE>mode, INTVAL (operands[2])); return "st4\\t{%S1.<Vetype> - %V1.<Vetype>}[%2], %0"; } [(set_attr "type" "neon_store4_one_lane<q>")] diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 71c3693..ffcca32 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -11833,6 +11833,15 @@ aarch64_simd_lane_bounds (rtx operand, HOST_WIDE_INT low, HOST_WIDE_INT high, } } +/* Peform endian correction on lane number N, which indexes a vector + of mode MODE, and return the result as an SImode rtx. */ + +rtx +aarch64_endian_lane_rtx (machine_mode mode, unsigned int n) +{ + return gen_int_mode (ENDIAN_LANE_N (GET_MODE_NUNITS (mode), n), SImode); +} + /* Return TRUE if OP is a valid vector addressing mode. */ bool aarch64_simd_mem_operand_p (rtx op) diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 5e2e2fc..93d29b8 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -913,8 +913,8 @@ extern enum aarch64_code_model aarch64_cmodel; || (MODE) == V4SFmode || (MODE) == V8HFmode || (MODE) == V2DImode \ || (MODE) == V2DFmode) -#define ENDIAN_LANE_N(mode, n) \ - (BYTES_BIG_ENDIAN ? GET_MODE_NUNITS (mode) - 1 - n : n) +#define ENDIAN_LANE_N(NUNITS, N) \ + (BYTES_BIG_ENDIAN ? NUNITS - 1 - N : N) /* Support for a configure-time default CPU, etc. We currently support --with-arch and --with-cpu. Both are ignored if either is specified diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 46aa6fd..5d7b0f3 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -450,6 +450,17 @@ (define_mode_attr rtn [(DI "d") (SI "")]) (define_mode_attr vas [(DI "") (SI ".2s")]) +;; Map a vector to the number of units in it, if the size of the mode +;; is constant. +(define_mode_attr nunits [(V8QI "8") (V16QI "16") + (V4HI "4") (V8HI "8") + (V2SI "2") (V4SI "4") + (V2DI "2") + (V4HF "4") (V8HF "8") + (V2SF "2") (V4SF "4") + (V1DF "1") (V2DF "2") + (DI "1") (DF "1")]) + ;; Map a floating point or integer mode to the appropriate register name prefix (define_mode_attr s [(HF "h") (SF "s") (DF "d") (SI "s") (DI "d")]) |