summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-13 10:24:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-15 08:15:25 +0100
commit2404188958adb26bef0121140c9761610b30196a (patch)
tree7312668179222be1009d037f2983903263c8b841 /meta/recipes-devtools/gcc
parent450d5ba9b09476769c049194e5042cd3cef34d82 (diff)
downloadpoky-2404188958adb26bef0121140c9761610b30196a.tar.gz
gcc: Add patch to improve testsuite failures, particularly mips
Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some of the instruction decoding is there. Also disable MSA mips runtime extensions. For some reason qemu appears to accept the test code when it shouldn't. Our selected MIPS cpu for QEMU doesn't support them. MIPS is unusual in the gcc testsuite as it uses EFFECTIVE_TARGETS and loops multiple times through the vector testsuite. In the case of the two above, we can compile/link them but not run them. Even with the runtime disabled, if the code marks it as a runtime test, it will elevate itself to that. Setting the default target to compile therefore isn't enough. Therefore add code to downgrade runtime tests to link tests if the hardware support isn't there to run them. This avoids thousands of test failures. To do this we have to hook downgrade code into the main test runner. Enable that downgrading for other cases where hardware to run vector extensions is unavailable to remove test failures on other architectures too. Also, for gcc.target tests, add checks on wheter loongson or msa code can be run before trying that, allowing downgrading of tests there to work too. Parts of the patch may be able to be split off and acceptable to upstream with discussion. Need to investigate why qemu-user passes the 'bad' instructions'. For now, this should at least remove hundreds of test failures and improve test failures on non-mips too now a root cause of some was identified. (From OE-Core rev: bdb744edfec77d3fb000da0fe432689089b20d02) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-13.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch225
2 files changed, 226 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-13.2.inc b/meta/recipes-devtools/gcc/gcc-13.2.inc
index 7329562f65..7f97ecc332 100644
--- a/meta/recipes-devtools/gcc/gcc-13.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-13.2.inc
@@ -64,6 +64,7 @@ SRC_URI = "${BASEURI} \
64 file://0022-libatomic-Do-not-enforce-march-on-aarch64.patch \ 64 file://0022-libatomic-Do-not-enforce-march-on-aarch64.patch \
65 file://0023-Fix-install-path-of-linux64.h.patch \ 65 file://0023-Fix-install-path-of-linux64.h.patch \
66 file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \ 66 file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \
67 file://0025-gcc-testsuite-mips.patch \
67" 68"
68SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da" 69SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da"
69 70
diff --git a/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch b/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch
new file mode 100644
index 0000000000..49eaece923
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch
@@ -0,0 +1,225 @@
1gcc testsuite tweaks for mips/OE
2
3Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some
4of the instruction decoding is there.
5
6Also disable MSA mips runtime extensions. For some reason qemu appears to accept the test
7code when it shouldn't. Our selected MIPS cpu for QEMU doesn't support them.
8
9MIPS is unusual in the gcc testsuite as it uses EFFECTIVE_TARGETS and loops
10multiple times through the vector testsuite. In the case of the two above, we can
11compile/link them but not run them. Even with the runtime disabled, if the code
12marks it as a runtime test, it will elevate itself to that. Setting the default
13target to compile therefore isn't enough.
14
15Therefore add code to downgrade runtime tests to link tests if the hardware
16support isn't there to run them. This avoids thousands of test failures. To do
17this we have to hook downgrade code into the main test runner.
18
19Enable that downgrading for other cases where hardware to run vector extensions is
20unavailable to remove test failures on other architectures too.
21
22Also, for gcc.target tests, add checks on wheter loongson or msa code can
23be run before trying that, allowing downgrading of tests there to work too.
24
25Upstream-Status: Pending
26[Parts of the patch may be able to be split off and acceptable to upstream with
27discussion. Need to investigate why qemu-user passes the 'bad' instructions']
28
29Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
30
31Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp
32===================================================================
33--- gcc-13.2.0.orig/gcc/testsuite/lib/target-supports.exp
34+++ gcc-13.2.0/gcc/testsuite/lib/target-supports.exp
35@@ -2155,14 +2155,7 @@ proc check_mips_loongson_mmi_hw_availabl
36 if { !([istarget mips*-*-*]) } {
37 expr 0
38 } else {
39- check_runtime_nocache mips_loongson_mmi_hw_available {
40- #include <loongson-mmiintrin.h>
41- int main()
42- {
43- asm volatile ("paddw $f2,$f4,$f6");
44- return 0;
45- }
46- } "-mloongson-mmi"
47+ expr 0
48 }
49 }]
50 }
51@@ -2176,29 +2169,7 @@ proc check_mips_msa_hw_available { } {
52 if { !([istarget mips*-*-*]) } {
53 expr 0
54 } else {
55- check_runtime_nocache mips_msa_hw_available {
56- #if !defined(__mips_msa)
57- #error "MSA NOT AVAIL"
58- #else
59- #if !(((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2))
60- #error "MSA NOT AVAIL FOR ISA REV < 2"
61- #endif
62- #if !defined(__mips_hard_float)
63- #error "MSA HARD_FLOAT REQUIRED"
64- #endif
65- #if __mips_fpr != 64
66- #error "MSA 64-bit FPR REQUIRED"
67- #endif
68- #include <msa.h>
69-
70- int main()
71- {
72- v8i16 v = __builtin_msa_ldi_h (0);
73- v[0] = 0;
74- return v[0];
75- }
76- #endif
77- } "-mmsa"
78+ expr 0
79 }
80 }]
81 }
82@@ -9187,6 +9158,7 @@ proc is-effective-target-keyword { arg }
83
84 proc et-dg-runtest { runtest testcases flags default-extra-flags } {
85 global dg-do-what-default
86+ global do-what-limit
87 global EFFECTIVE_TARGETS
88 global et_index
89
90@@ -9194,6 +9166,7 @@ proc et-dg-runtest { runtest testcases f
91 foreach target $EFFECTIVE_TARGETS {
92 set target_flags $flags
93 set dg-do-what-default compile
94+ set do-what-limit link
95 set et_index [lsearch -exact $EFFECTIVE_TARGETS $target]
96 if { [info procs add_options_for_${target}] != [list] } {
97 set target_flags [add_options_for_${target} "$flags"]
98@@ -9201,8 +9174,10 @@ proc et-dg-runtest { runtest testcases f
99 if { [info procs check_effective_target_${target}_runtime]
100 != [list] && [check_effective_target_${target}_runtime] } {
101 set dg-do-what-default run
102+ set do-what-limit run
103 }
104 $runtest $testcases $target_flags ${default-extra-flags}
105+ unset do-what-limit
106 }
107 } else {
108 set et_index 0
109@@ -10789,6 +10764,7 @@ proc check_effective_target_sigsetjmp {}
110 proc check_vect_support_and_set_flags { } {
111 global DEFAULT_VECTCFLAGS
112 global dg-do-what-default
113+ global do-what-limit
114 global EFFECTIVE_TARGETS
115
116 if [istarget powerpc-*paired*] {
117@@ -10797,6 +10773,7 @@ proc check_vect_support_and_set_flags {
118 set dg-do-what-default run
119 } else {
120 set dg-do-what-default compile
121+ set do-what-limit link
122 }
123 } elseif [istarget powerpc*-*-*] {
124 # Skip targets not supporting -maltivec.
125@@ -10821,6 +10798,7 @@ proc check_vect_support_and_set_flags {
126 lappend DEFAULT_VECTCFLAGS "-mcpu=970"
127 }
128 set dg-do-what-default compile
129+ set do-what-limit link
130 }
131 } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
132 lappend DEFAULT_VECTCFLAGS "-msse2"
133@@ -10828,6 +10806,7 @@ proc check_vect_support_and_set_flags {
134 set dg-do-what-default run
135 } else {
136 set dg-do-what-default compile
137+ set do-what-limit link
138 }
139 } elseif { [istarget mips*-*-*]
140 && [check_effective_target_nomips16] } {
141@@ -10847,6 +10826,7 @@ proc check_vect_support_and_set_flags {
142 set dg-do-what-default run
143 } else {
144 set dg-do-what-default compile
145+ set do-what-limit link
146 }
147 } elseif [istarget alpha*-*-*] {
148 # Alpha's vectorization capabilities are extremely limited.
149@@ -10860,6 +10840,7 @@ proc check_vect_support_and_set_flags {
150 set dg-do-what-default run
151 } else {
152 set dg-do-what-default compile
153+ set do-what-limit link
154 }
155 } elseif [istarget ia64-*-*] {
156 set dg-do-what-default run
157@@ -10873,6 +10854,7 @@ proc check_vect_support_and_set_flags {
158 set dg-do-what-default run
159 } else {
160 set dg-do-what-default compile
161+ set do-what-limit link
162 }
163 } elseif [istarget aarch64*-*-*] {
164 set dg-do-what-default run
165@@ -10897,6 +10879,7 @@ proc check_vect_support_and_set_flags {
166 } else {
167 lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
168 set dg-do-what-default compile
169+ set do-what-limit link
170 }
171 } elseif [istarget amdgcn-*-*] {
172 set dg-do-what-default run
173Index: gcc-13.2.0/gcc/testsuite/gcc.target/mips/mips.exp
174===================================================================
175--- gcc-13.2.0.orig/gcc/testsuite/gcc.target/mips/mips.exp
176+++ gcc-13.2.0/gcc/testsuite/gcc.target/mips/mips.exp
177@@ -709,7 +709,23 @@ proc mips_first_unsupported_option { ups
178 global mips_option_tests
179 upvar $upstatus status
180
181+ if { [mips_have_test_option_p status "-mmsa"] } {
182+ verbose -log "Found -mmsa"
183+ if { ![check_mips_msa_hw_available] } {
184+ verbose -log "No MSA avail"
185+ return "-mmsa"
186+ }
187+ }
188+ if { [mips_have_test_option_p status "-mloongson-mmi"] } {
189+ verbose -log "Found -mloonson-mmi"
190+ if { ![check_mips_loongson_mmi_hw_available] } {
191+ verbose -log "No MMI avail"
192+ return "-mloonson-mmi"
193+ }
194+ }
195+
196 foreach { option code } [array get mips_option_tests] {
197+
198 if { [mips_have_test_option_p status $option] } {
199 regsub -all "\n" $code "\\n\\\n" asm
200 # Use check_runtime from target-supports.exp, which caches
201Index: gcc-13.2.0/gcc/testsuite/lib/gcc-dg.exp
202===================================================================
203--- gcc-13.2.0.orig/gcc/testsuite/lib/gcc-dg.exp
204+++ gcc-13.2.0/gcc/testsuite/lib/gcc-dg.exp
205@@ -240,9 +240,20 @@ proc schedule-cleanups { opts } {
206
207 proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
208 # Set up the compiler flags, based on what we're going to do.
209+ global do-what-limit
210
211 set options [list]
212
213+ if [info exists do-what-limit] then {
214+ # Demote run tests to $do-what-limit if set
215+ switch $do_what {
216+ run {
217+ set do_what $do-what-limit
218+ set dg-do-what $do-what-limit
219+ }
220+ }
221+ }
222+
223 switch $do_what {
224 "preprocess" {
225 set compile_type "preprocess"