nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1Without the change `libhwy-1.3.0` ICEs when built for aarch64-linux as:
2https://github.com/NixOS/nixpkgs/pull/320616#issuecomment-3764400891
3
4Upstream report: http://gcc.gnu.org/PR120718
5Upstream fix: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00
6Fetched as:
7$ curl -L 'https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00' > aarch64-sve-rtx.patch
8
9From: Richard Sandiford <richard.sandiford@arm.com>
10Date: Thu, 14 Aug 2025 16:56:50 +0000 (+0100)
11Subject: Remove MODE_COMPOSITE_P test from simplify_gen_subreg [PR120718]
12X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00
13
14Remove MODE_COMPOSITE_P test from simplify_gen_subreg [PR120718]
15
16simplify_gen_subreg rejected subregs of literal constants if
17MODE_COMPOSITE_P. This was added by the fix for PR96648 in
18g:c0f772894b6b3cd8ed5c5dd09d0c7917f51cf70f. Jakub said:
19
20 As for the simplify_gen_subreg change, I think it would be desirable
21 to just avoid creating SUBREGs of constants on all targets and for all
22 constants, if simplify_immed_subreg simplified, fine, otherwise punt,
23 but as we are late in GCC11 development, the patch instead guards this
24 behavior on MODE_COMPOSITE_P (outermode) - i.e. only conversions to
25 powerpc{,64,64le} double double long double - and only for the cases where
26 simplify_immed_subreg was called.
27
28I'm not sure about relaxing the codes further, since subregs might
29be wanted for CONST, SYMBOL_REF and LABEL_REF. But removing the
30MODE_COMPOSITE_P is needed to fix PR120718, where we get an ICE
31from generating a subreg of a V2SI const_vector.
32
33Unlike the trunk version, this backport does not remove the
34VOIDmode test; see PR121501.
35
36gcc/
37 PR rtl-optimization/120718
38 * simplify-rtx.cc (simplify_context::simplify_gen_subreg):
39 Remove MODE_COMPOSITE_P condition.
40
41gcc/testsuite/
42 PR rtl-optimization/120718
43 * gcc.target/aarch64/sve/acle/general/pr120718.c: New test.
44---
45
46diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
47index 88d31a71c05a..8d4cbf1371a3 100644
48--- a/gcc/simplify-rtx.cc
49+++ b/gcc/simplify-rtx.cc
50@@ -8317,14 +8317,11 @@ simplify_context::simplify_gen_subreg (machine_mode outermode, rtx op,
51
52 if (GET_CODE (op) == SUBREG
53 || GET_CODE (op) == CONCAT
54- || GET_MODE (op) == VOIDmode)
55- return NULL_RTX;
56-
57- if (MODE_COMPOSITE_P (outermode)
58- && (CONST_SCALAR_INT_P (op)
59- || CONST_DOUBLE_AS_FLOAT_P (op)
60- || CONST_FIXED_P (op)
61- || GET_CODE (op) == CONST_VECTOR))
62+ || GET_MODE (op) == VOIDmode
63+ || CONST_SCALAR_INT_P (op)
64+ || CONST_DOUBLE_AS_FLOAT_P (op)
65+ || CONST_FIXED_P (op)
66+ || GET_CODE (op) == CONST_VECTOR)
67 return NULL_RTX;
68
69 if (validate_subreg (outermode, innermode, op, byte))
70diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c
71new file mode 100644
72index 000000000000..9ca0938e36bf
73--- /dev/null
74+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c
75@@ -0,0 +1,12 @@
76+/* { dg-options "-O2" } */
77+
78+#include <arm_sve.h>
79+typedef int __attribute__((vector_size(8))) v2si;
80+typedef struct { int x; int y; } A;
81+void bar(A a);
82+void foo()
83+{
84+ A a;
85+ *(v2si *)&a = (v2si){0, (int)svcntd_pat(SV_ALL)};
86+ bar(a);
87+}