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