]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[COMMITTED] Fix PR aarch64/104474: ICE with vector float initializers and non-consts.
authorAndrew Pinski <apinski@marvell.com>
Wed, 9 Feb 2022 22:56:58 +0000 (14:56 -0800)
committerRichard Biener <rguenther@suse.de>
Thu, 7 Apr 2022 08:58:46 +0000 (10:58 +0200)
The problem here is that the aarch64 back-end was placing const0_rtx
into the constant vector RTL even if the mode was a floating point mode.
The fix is instead to use CONST0_RTX and pass the mode to select the
correct zero (either const_int or const_double).

Committed as obvious after a bootstrap/test on aarch64-linux-gnu with
no regressions.

PR target/104474

gcc/ChangeLog:

* config/aarch64/aarch64.c
(aarch64_sve_expand_vector_init_handle_trailing_constants):
Use CONST0_RTX instead of const0_rtx for the non-constant elements.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/pr104474-1.c: New test.
* gcc.target/aarch64/sve/pr104474-2.c: New test.
* gcc.target/aarch64/sve/pr104474-3.c: New test.

(cherry picked from commit 41582f88ec01c5ce2f85ebc4ac2743eb426d6e33)

gcc/config/aarch64/aarch64.c
gcc/testsuite/gcc.target/aarch64/sve/pr104474-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pr104474-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pr104474-3.c [new file with mode: 0644]

index b7a375f90d8d83f759cec57ca3e5f0a113bb73fe..c155f4883cfece8fd1c190b1567deadee0da9774 100644 (file)
@@ -21095,7 +21095,7 @@ aarch64_sve_expand_vector_init_handle_trailing_constants
        {
          rtx x = builder.elt (i + nelts_reqd - n_trailing_constants);
          if (!valid_for_const_vector_p (elem_mode, x))
-           x = const0_rtx;
+           x = CONST0_RTX (elem_mode);
          v.quick_push (x);
        }
       rtx const_vec = v.build ();
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr104474-1.c b/gcc/testsuite/gcc.target/aarch64/sve/pr104474-1.c
new file mode 100644 (file)
index 0000000..9e5bfe6
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-options "-mcpu=neoverse-512tvb -frounding-math -msve-vector-bits=512" } */
+
+typedef float __attribute__((__vector_size__ (64))) F;
+
+F
+foo (void)
+{
+  return (F){68435453, 0, 0, 0, 0, 0, 0, 5, 0, 431144844};
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr104474-2.c b/gcc/testsuite/gcc.target/aarch64/sve/pr104474-2.c
new file mode 100644 (file)
index 0000000..02a4b6a
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-options "-mcpu=neoverse-512tvb -msve-vector-bits=512" } */
+
+typedef float __attribute__((__vector_size__ (64))) F;
+
+F
+foo (float t)
+{
+  return (F){t, 0, 0, 0, 0, 0, 0, 5, 0, t};
+}
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr104474-3.c b/gcc/testsuite/gcc.target/aarch64/sve/pr104474-3.c
new file mode 100644 (file)
index 0000000..7bed014
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-options "-mcpu=neoverse-v1 -frounding-math -msve-vector-bits=256" } */
+
+typedef _Float16 __attribute__((__vector_size__ (32))) F;
+
+F
+foo (void)
+{
+  return (F){0, 6270, 0, 0, 0, 0, 0, 0, 3229, 0, 40};
+}