aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-11-06 20:02:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-11-06 20:02:49 +0000
commit8094001759f757a5dc7ce375e4d1e5fd0d9a2a8e (patch)
treefebc464d11da1b18798cc76439d27a731222ba17
parentf5cbabc1ccfe4ac8dc3226553cbc6a8fbe6286a3 (diff)
downloadgcc-8094001759f757a5dc7ce375e4d1e5fd0d9a2a8e.zip
gcc-8094001759f757a5dc7ce375e4d1e5fd0d9a2a8e.tar.gz
gcc-8094001759f757a5dc7ce375e4d1e5fd0d9a2a8e.tar.bz2
[AArch64] Pass number of units to aarch64_expand_vec_perm(_const)
This patch passes the number of units to aarch64_expand_vec_perm and aarch64_expand_vec_perm_const, 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_expand_vec_perm) (aarch64_expand_vec_perm_const): Take the number of units too. * config/aarch64/aarch64.c (aarch64_expand_vec_perm) (aarch64_expand_vec_perm_const): Likewise. * config/aarch64/aarch64-simd.md (vec_perm_const<mode>) (vec_perm<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: r254469
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/config/aarch64/aarch64-protos.h4
-rw-r--r--gcc/config/aarch64/aarch64-simd.md4
-rw-r--r--gcc/config/aarch64/aarch64.c18
4 files changed, 26 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d11224..46bffae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,17 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm)
+ (aarch64_expand_vec_perm_const): Take the number of units too.
+ * config/aarch64/aarch64.c (aarch64_expand_vec_perm)
+ (aarch64_expand_vec_perm_const): Likewise.
+ * config/aarch64/aarch64-simd.md (vec_perm_const<mode>)
+ (vec_perm<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_simd_vect_par_cnst_half):
Take the number of units too.
* config/aarch64/aarch64.c (aarch64_simd_vect_par_cnst_half): Likewise.
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 4fdded7..15c3b46 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -471,11 +471,11 @@ tree aarch64_builtin_rsqrt (unsigned int);
tree aarch64_builtin_vectorized_function (unsigned int, tree, tree);
extern void aarch64_split_combinev16qi (rtx operands[3]);
-extern void aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel);
+extern void aarch64_expand_vec_perm (rtx, rtx, rtx, rtx, unsigned int);
extern bool aarch64_madd_needs_nop (rtx_insn *);
extern void aarch64_final_prescan_insn (rtx_insn *);
extern bool
-aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel);
+aarch64_expand_vec_perm_const (rtx, rtx, rtx, rtx, unsigned int);
void aarch64_atomic_assign_expand_fenv (tree *, tree *, tree *);
int aarch64_ccmp_mode_to_code (machine_mode mode);
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 0699e56..9aeeffd 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -5239,7 +5239,7 @@
"TARGET_SIMD"
{
if (aarch64_expand_vec_perm_const (operands[0], operands[1],
- operands[2], operands[3]))
+ operands[2], operands[3], <nunits>))
DONE;
else
FAIL;
@@ -5253,7 +5253,7 @@
"TARGET_SIMD"
{
aarch64_expand_vec_perm (operands[0], operands[1],
- operands[2], operands[3]);
+ operands[2], operands[3], <nunits>);
DONE;
})
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index d209f81..62ce7d6 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -13242,11 +13242,14 @@ aarch64_expand_vec_perm_1 (rtx target, rtx op0, rtx op1, rtx sel)
}
}
+/* Expand a vec_perm with the operands given by TARGET, OP0, OP1 and SEL.
+ NELT is the number of elements in the vector. */
+
void
-aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel)
+aarch64_expand_vec_perm (rtx target, rtx op0, rtx op1, rtx sel,
+ unsigned int nelt)
{
machine_mode vmode = GET_MODE (target);
- unsigned int nelt = GET_MODE_NUNITS (vmode);
bool one_vector_p = rtx_equal_p (op0, op1);
rtx mask;
@@ -13602,13 +13605,15 @@ aarch64_expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
return false;
}
-/* Expand a vec_perm_const pattern. */
+/* Expand a vec_perm_const pattern with the operands given by TARGET,
+ OP0, OP1 and SEL. NELT is the number of elements in the vector. */
bool
-aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel)
+aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel,
+ unsigned int nelt)
{
struct expand_vec_perm_d d;
- int i, nelt, which;
+ unsigned int i, which;
d.target = target;
d.op0 = op0;
@@ -13618,12 +13623,11 @@ aarch64_expand_vec_perm_const (rtx target, rtx op0, rtx op1, rtx sel)
gcc_assert (VECTOR_MODE_P (d.vmode));
d.testing_p = false;
- nelt = GET_MODE_NUNITS (d.vmode);
d.perm.reserve (nelt);
for (i = which = 0; i < nelt; ++i)
{
rtx e = XVECEXP (sel, 0, i);
- int ei = INTVAL (e) & (2 * nelt - 1);
+ unsigned int ei = INTVAL (e) & (2 * nelt - 1);
which |= (ei < nelt ? 1 : 2);
d.perm.quick_push (ei);
}