Skip to content

Commit 41582f8

Browse files
[COMMITTED] Fix PR aarch64/104474: ICE with vector float initializers and non-consts.
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.cc (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.
1 parent 3adf509 commit 41582f8

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

gcc/config/aarch64/aarch64.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21164,7 +21164,7 @@ aarch64_sve_expand_vector_init_handle_trailing_constants
2116421164
{
2116521165
rtx x = builder.elt (i + nelts_reqd - n_trailing_constants);
2116621166
if (!valid_for_const_vector_p (elem_mode, x))
21167-
x = const0_rtx;
21167+
x = CONST0_RTX (elem_mode);
2116821168
v.quick_push (x);
2116921169
}
2117021170
rtx const_vec = v.build ();
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* { dg-options "-mcpu=neoverse-512tvb -frounding-math -msve-vector-bits=512" } */
2+
3+
typedef float __attribute__((__vector_size__ (64))) F;
4+
5+
F
6+
foo (void)
7+
{
8+
return (F){68435453, 0, 0, 0, 0, 0, 0, 5, 0, 431144844};
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* { dg-options "-mcpu=neoverse-512tvb -msve-vector-bits=512" } */
2+
3+
typedef float __attribute__((__vector_size__ (64))) F;
4+
5+
F
6+
foo (float t)
7+
{
8+
return (F){t, 0, 0, 0, 0, 0, 0, 5, 0, t};
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* { dg-options "-mcpu=neoverse-v1 -frounding-math -msve-vector-bits=256" } */
2+
3+
typedef _Float16 __attribute__((__vector_size__ (32))) F;
4+
5+
F
6+
foo (void)
7+
{
8+
return (F){0, 6270, 0, 0, 0, 0, 0, 0, 3229, 0, 40};
9+
}

0 commit comments

Comments
 (0)