Commit 73e3da51 by Richard Sandiford Committed by Richard Sandiford

[AArch64] Pass number of units to aarch64_reverse_mask

This patch passes the number of units to aarch64_reverse_mask,
which avoids a to_constant () once GET_MODE_NUNITS is variable.

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_reverse_mask): Take
	the number of units too.
	* config/aarch64/aarch64.c (aarch64_reverse_mask): Likewise.
	* config/aarch64/aarch64-simd.md (vec_load_lanesoi<mode>)
	(vec_store_lanesoi<mode>, vec_load_lanesci<mode>)
	(vec_store_lanesci<mode>, vec_load_lanesxi<mode>)
	(vec_store_lanesxi<mode>): Update accordingly.

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: r254467
parent 7ac29c0f
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
Alan Hayward <alan.hayward@arm.com> Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com> David Sherwood <david.sherwood@arm.com>
* config/aarch64/aarch64-protos.h (aarch64_reverse_mask): Take
the number of units too.
* config/aarch64/aarch64.c (aarch64_reverse_mask): Likewise.
* config/aarch64/aarch64-simd.md (vec_load_lanesoi<mode>)
(vec_store_lanesoi<mode>, vec_load_lanesci<mode>)
(vec_store_lanesci<mode>, vec_load_lanesxi<mode>)
(vec_store_lanesxi<mode>): Update accordingly.
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-protos.h (aarch64_endian_lane_rtx): Declare.
* config/aarch64/aarch64.c (aarch64_endian_lane_rtx): New function. * config/aarch64/aarch64.c (aarch64_endian_lane_rtx): New function.
* config/aarch64/aarch64.h (ENDIAN_LANE_N): Take the number * config/aarch64/aarch64.h (ENDIAN_LANE_N): Take the number
...@@ -352,7 +352,7 @@ bool aarch64_mask_and_shift_for_ubfiz_p (scalar_int_mode, rtx, rtx); ...@@ -352,7 +352,7 @@ bool aarch64_mask_and_shift_for_ubfiz_p (scalar_int_mode, rtx, rtx);
bool aarch64_zero_extend_const_eq (machine_mode, rtx, machine_mode, rtx); bool aarch64_zero_extend_const_eq (machine_mode, rtx, machine_mode, rtx);
bool aarch64_move_imm (HOST_WIDE_INT, machine_mode); bool aarch64_move_imm (HOST_WIDE_INT, machine_mode);
bool aarch64_mov_operand_p (rtx, machine_mode); bool aarch64_mov_operand_p (rtx, machine_mode);
rtx aarch64_reverse_mask (machine_mode); rtx aarch64_reverse_mask (machine_mode, unsigned int);
bool aarch64_offset_7bit_signed_scaled_p (machine_mode, HOST_WIDE_INT); bool aarch64_offset_7bit_signed_scaled_p (machine_mode, HOST_WIDE_INT);
char *aarch64_output_scalar_simd_mov_immediate (rtx, scalar_int_mode); char *aarch64_output_scalar_simd_mov_immediate (rtx, scalar_int_mode);
char *aarch64_output_simd_mov_immediate (rtx, machine_mode, unsigned, char *aarch64_output_simd_mov_immediate (rtx, machine_mode, unsigned,
......
...@@ -4633,7 +4633,7 @@ ...@@ -4633,7 +4633,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (OImode); rtx tmp = gen_reg_rtx (OImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_simd_ld2<mode> (tmp, operands[1])); emit_insn (gen_aarch64_simd_ld2<mode> (tmp, operands[1]));
emit_insn (gen_aarch64_rev_reglistoi (operands[0], tmp, mask)); emit_insn (gen_aarch64_rev_reglistoi (operands[0], tmp, mask));
} }
...@@ -4677,7 +4677,7 @@ ...@@ -4677,7 +4677,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (OImode); rtx tmp = gen_reg_rtx (OImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_rev_reglistoi (tmp, operands[1], mask)); emit_insn (gen_aarch64_rev_reglistoi (tmp, operands[1], mask));
emit_insn (gen_aarch64_simd_st2<mode> (operands[0], tmp)); emit_insn (gen_aarch64_simd_st2<mode> (operands[0], tmp));
} }
...@@ -4731,7 +4731,7 @@ ...@@ -4731,7 +4731,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (CImode); rtx tmp = gen_reg_rtx (CImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_simd_ld3<mode> (tmp, operands[1])); emit_insn (gen_aarch64_simd_ld3<mode> (tmp, operands[1]));
emit_insn (gen_aarch64_rev_reglistci (operands[0], tmp, mask)); emit_insn (gen_aarch64_rev_reglistci (operands[0], tmp, mask));
} }
...@@ -4775,7 +4775,7 @@ ...@@ -4775,7 +4775,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (CImode); rtx tmp = gen_reg_rtx (CImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_rev_reglistci (tmp, operands[1], mask)); emit_insn (gen_aarch64_rev_reglistci (tmp, operands[1], mask));
emit_insn (gen_aarch64_simd_st3<mode> (operands[0], tmp)); emit_insn (gen_aarch64_simd_st3<mode> (operands[0], tmp));
} }
...@@ -4829,7 +4829,7 @@ ...@@ -4829,7 +4829,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (XImode); rtx tmp = gen_reg_rtx (XImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_simd_ld4<mode> (tmp, operands[1])); emit_insn (gen_aarch64_simd_ld4<mode> (tmp, operands[1]));
emit_insn (gen_aarch64_rev_reglistxi (operands[0], tmp, mask)); emit_insn (gen_aarch64_rev_reglistxi (operands[0], tmp, mask));
} }
...@@ -4873,7 +4873,7 @@ ...@@ -4873,7 +4873,7 @@
if (BYTES_BIG_ENDIAN) if (BYTES_BIG_ENDIAN)
{ {
rtx tmp = gen_reg_rtx (XImode); rtx tmp = gen_reg_rtx (XImode);
rtx mask = aarch64_reverse_mask (<MODE>mode); rtx mask = aarch64_reverse_mask (<MODE>mode, <nunits>);
emit_insn (gen_aarch64_rev_reglistxi (tmp, operands[1], mask)); emit_insn (gen_aarch64_rev_reglistxi (tmp, operands[1], mask));
emit_insn (gen_aarch64_simd_st4<mode> (operands[0], tmp)); emit_insn (gen_aarch64_simd_st4<mode> (operands[0], tmp));
} }
......
...@@ -13699,16 +13699,18 @@ aarch64_vectorize_vec_perm_const_ok (machine_mode vmode, vec_perm_indices sel) ...@@ -13699,16 +13699,18 @@ aarch64_vectorize_vec_perm_const_ok (machine_mode vmode, vec_perm_indices sel)
return ret; return ret;
} }
/* Generate a byte permute mask for a register of mode MODE,
which has NUNITS units. */
rtx rtx
aarch64_reverse_mask (machine_mode mode) aarch64_reverse_mask (machine_mode mode, unsigned int nunits)
{ {
/* We have to reverse each vector because we dont have /* We have to reverse each vector because we dont have
a permuted load that can reverse-load according to ABI rules. */ a permuted load that can reverse-load according to ABI rules. */
rtx mask; rtx mask;
rtvec v = rtvec_alloc (16); rtvec v = rtvec_alloc (16);
int i, j; unsigned int i, j;
int nunits = GET_MODE_NUNITS (mode); unsigned int usize = GET_MODE_UNIT_SIZE (mode);
int usize = GET_MODE_UNIT_SIZE (mode);
gcc_assert (BYTES_BIG_ENDIAN); gcc_assert (BYTES_BIG_ENDIAN);
gcc_assert (AARCH64_VALID_SIMD_QREG_MODE (mode)); gcc_assert (AARCH64_VALID_SIMD_QREG_MODE (mode));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment