Handle POLY_INT_CST in copy_reference_ops_from_ref
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 8 Nov 2019 09:43:44 +0000 (09:43 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 8 Nov 2019 09:43:44 +0000 (09:43 +0000)
2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle
POLY_INT_CST.

gcc/testsuite/
* gcc.target/aarch64/sve/acle/general/deref_2.c: New test.
* gcc.target/aarch64/sve/acle/general/whilele_8.c: Likewise.
* gcc.target/aarch64/sve/acle/general/whilelt_4.c: Likewise.

From-SVN: r277959

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilele_8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilelt_4.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index b50456e74fc2da3032381fc7a75f64dee6127189..d6f516775db7f08da8b2966a6910bd4672eba3a4 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle
+       POLY_INT_CST.
+
 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-inline.c (declare_return_variable): Check for poly_int_tree_p
index 9d5702b1c27fc0aa0d0ada50bece85e79d18d5d7..7d0d4ef23b01fd13bc31968fb4b929780605a066 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * gcc.target/aarch64/sve/acle/general/deref_2.c: New test.
+       * gcc.target/aarch64/sve/acle/general/whilele_8.c: Likewise.
+       * gcc.target/aarch64/sve/acle/general/whilelt_4.c: Likewise.
+
 2019-11-08  Richard Sandiford  <richard.sandiford@arm.com>
 
        * gcc.target/aarch64/sve/acle/general/inline_1.c: New test.
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_2.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/deref_2.c
new file mode 100644 (file)
index 0000000..0890298
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+#include <string.h>
+
+inline void
+copy (void *dst, svbool_t src)
+{
+  memcpy (dst, &src, svcntd ());
+}
+
+uint64_t
+f (int32_t *x, int32_t *y)
+{
+  union { uint64_t x; char c[8]; } u;
+  svbool_t pg = svptrue_b32 ();
+  copy (u.c, svcmpeq (pg, svld1 (pg, x), 0));
+  copy (u.c + 4, svcmpeq (pg, svld1 (pg, y), 1));
+  return u.x;
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilele_8.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilele_8.c
new file mode 100644 (file)
index 0000000..c7b6663
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+/* { dg-final { scan-assembler-not {\tptrue\t} } } */
+/* { dg-final { scan-assembler-not {\tpfalse\t} } } */
+
+void
+test1 (svbool_t *ptr)
+{
+  *ptr = svwhilele_b32_s32 (-4, 0);
+}
+
+void
+test2 (svbool_t *ptr)
+{
+  *ptr = svwhilele_b16_s64 (svcntb (), svcntb () + 8);
+}
+
+void
+test3 (svbool_t *ptr)
+{
+  *ptr = svwhilele_b64_s32 (0, 2);
+}
+
+void
+test4 (svbool_t *ptr)
+{
+  *ptr = svwhilele_b8_s64 (16, svcntb ());
+}
+
+/* { dg-final { scan-assembler-times {\twhilel[et]\t} 4 } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilelt_4.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/whilelt_4.c
new file mode 100644 (file)
index 0000000..849cd45
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+/* { dg-final { scan-assembler-not {\tptrue\t} } } */
+/* { dg-final { scan-assembler-not {\tpfalse\t} } } */
+
+void
+test1 (svbool_t *ptr)
+{
+  *ptr = svwhilelt_b32_s32 (-4, 1);
+}
+
+void
+test2 (svbool_t *ptr)
+{
+  *ptr = svwhilelt_b16_s64 (svcntb (), svcntb () + 9);
+}
+
+void
+test3 (svbool_t *ptr)
+{
+  *ptr = svwhilelt_b64_s32 (0, 3);
+}
+
+void
+test4 (svbool_t *ptr)
+{
+  *ptr = svwhilelt_b8_s64 (16, svcntb ());
+}
+
+/* { dg-final { scan-assembler-times {\twhilel[et]\t} 4 } } */
index 7465bedb3496b829dbf07febb831dea2f1b8185d..f58dbe1504716e9c3d04d8d7f7819faca1d1839f 100644 (file)
@@ -928,6 +928,7 @@ copy_reference_ops_from_ref (tree ref, vec<vn_reference_op_s> *result)
          break;
        case STRING_CST:
        case INTEGER_CST:
+       case POLY_INT_CST:
        case COMPLEX_CST:
        case VECTOR_CST:
        case REAL_CST: