diff options
| author | Martin Jansa <martin.jansa@gmail.com> | 2023-09-15 22:42:47 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-20 08:57:26 +0100 |
| commit | b1650772a269f0c939662237bc3a1db953acf9f4 (patch) | |
| tree | 0b267b75a2251a200191b2abf5313c857de6626f /meta | |
| parent | 83051d0d69f146739c24024f0fbb257fcd9e58d7 (diff) | |
| download | poky-b1650772a269f0c939662237bc3a1db953acf9f4.tar.gz | |
gcc: backport a fix for ICE caused by CVE-2023-4039.patch
* see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111418
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111411
* add git headers to 0025-gcc-testsuite-mips.patch so that it does
easily apply with other patches with git am
(From OE-Core rev: 760068c5868380b0e833155020365735f55314c3)
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-13.2.inc | 3 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch (renamed from meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch) | 148 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch | 117 |
3 files changed, 197 insertions, 71 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-13.2.inc b/meta/recipes-devtools/gcc/gcc-13.2.inc index 0922251e18..d96f3171e4 100644 --- a/meta/recipes-devtools/gcc/gcc-13.2.inc +++ b/meta/recipes-devtools/gcc/gcc-13.2.inc | |||
| @@ -64,8 +64,9 @@ 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 | file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ |
| 68 | file://CVE-2023-4039.patch \ | 68 | file://CVE-2023-4039.patch \ |
| 69 | file://0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch \ | ||
| 69 | " | 70 | " |
| 70 | SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da" | 71 | SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da" |
| 71 | 72 | ||
diff --git a/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch b/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch index 49eaece923..c405d8d484 100644 --- a/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-mips.patch +++ b/meta/recipes-devtools/gcc/gcc/0025-gcc-testsuite-tweaks-for-mips-OE.patch | |||
| @@ -1,4 +1,7 @@ | |||
| 1 | gcc testsuite tweaks for mips/OE | 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 | ||
| 2 | 5 | ||
| 3 | Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some | 6 | Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some |
| 4 | of the instruction decoding is there. | 7 | of the instruction decoding is there. |
| @@ -27,12 +30,70 @@ Upstream-Status: Pending | |||
| 27 | discussion. Need to investigate why qemu-user passes the 'bad' instructions'] | 30 | discussion. Need to investigate why qemu-user passes the 'bad' instructions'] |
| 28 | 31 | ||
| 29 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | 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(-) | ||
| 30 | 38 | ||
| 31 | Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | 39 | diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp |
| 32 | =================================================================== | 40 | index 15d574202d3..2cef9709774 100644 |
| 33 | --- gcc-13.2.0.orig/gcc/testsuite/lib/target-supports.exp | 41 | --- a/gcc/testsuite/gcc.target/mips/mips.exp |
| 34 | +++ gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | 42 | +++ b/gcc/testsuite/gcc.target/mips/mips.exp |
| 35 | @@ -2155,14 +2155,7 @@ proc check_mips_loongson_mmi_hw_availabl | 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 { } { | ||
| 36 | if { !([istarget mips*-*-*]) } { | 97 | if { !([istarget mips*-*-*]) } { |
| 37 | expr 0 | 98 | expr 0 |
| 38 | } else { | 99 | } else { |
| @@ -79,7 +140,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 79 | } | 140 | } |
| 80 | }] | 141 | }] |
| 81 | } | 142 | } |
| 82 | @@ -9187,6 +9158,7 @@ proc is-effective-target-keyword { arg } | 143 | @@ -9187,6 +9158,7 @@ proc is-effective-target-keyword { arg } { |
| 83 | 144 | ||
| 84 | proc et-dg-runtest { runtest testcases flags default-extra-flags } { | 145 | proc et-dg-runtest { runtest testcases flags default-extra-flags } { |
| 85 | global dg-do-what-default | 146 | global dg-do-what-default |
| @@ -87,7 +148,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 87 | global EFFECTIVE_TARGETS | 148 | global EFFECTIVE_TARGETS |
| 88 | global et_index | 149 | global et_index |
| 89 | 150 | ||
| 90 | @@ -9194,6 +9166,7 @@ proc et-dg-runtest { runtest testcases f | 151 | @@ -9194,6 +9166,7 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } { |
| 91 | foreach target $EFFECTIVE_TARGETS { | 152 | foreach target $EFFECTIVE_TARGETS { |
| 92 | set target_flags $flags | 153 | set target_flags $flags |
| 93 | set dg-do-what-default compile | 154 | set dg-do-what-default compile |
| @@ -95,7 +156,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 95 | set et_index [lsearch -exact $EFFECTIVE_TARGETS $target] | 156 | set et_index [lsearch -exact $EFFECTIVE_TARGETS $target] |
| 96 | if { [info procs add_options_for_${target}] != [list] } { | 157 | if { [info procs add_options_for_${target}] != [list] } { |
| 97 | set target_flags [add_options_for_${target} "$flags"] | 158 | set target_flags [add_options_for_${target} "$flags"] |
| 98 | @@ -9201,8 +9174,10 @@ proc et-dg-runtest { runtest testcases f | 159 | @@ -9201,8 +9174,10 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } { |
| 99 | if { [info procs check_effective_target_${target}_runtime] | 160 | if { [info procs check_effective_target_${target}_runtime] |
| 100 | != [list] && [check_effective_target_${target}_runtime] } { | 161 | != [list] && [check_effective_target_${target}_runtime] } { |
| 101 | set dg-do-what-default run | 162 | set dg-do-what-default run |
| @@ -106,7 +167,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 106 | } | 167 | } |
| 107 | } else { | 168 | } else { |
| 108 | set et_index 0 | 169 | set et_index 0 |
| 109 | @@ -10789,6 +10764,7 @@ proc check_effective_target_sigsetjmp {} | 170 | @@ -10789,6 +10764,7 @@ proc check_effective_target_sigsetjmp {} { |
| 110 | proc check_vect_support_and_set_flags { } { | 171 | proc check_vect_support_and_set_flags { } { |
| 111 | global DEFAULT_VECTCFLAGS | 172 | global DEFAULT_VECTCFLAGS |
| 112 | global dg-do-what-default | 173 | global dg-do-what-default |
| @@ -114,7 +175,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 114 | global EFFECTIVE_TARGETS | 175 | global EFFECTIVE_TARGETS |
| 115 | 176 | ||
| 116 | if [istarget powerpc-*paired*] { | 177 | if [istarget powerpc-*paired*] { |
| 117 | @@ -10797,6 +10773,7 @@ proc check_vect_support_and_set_flags { | 178 | @@ -10797,6 +10773,7 @@ proc check_vect_support_and_set_flags { } { |
| 118 | set dg-do-what-default run | 179 | set dg-do-what-default run |
| 119 | } else { | 180 | } else { |
| 120 | set dg-do-what-default compile | 181 | set dg-do-what-default compile |
| @@ -122,7 +183,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 122 | } | 183 | } |
| 123 | } elseif [istarget powerpc*-*-*] { | 184 | } elseif [istarget powerpc*-*-*] { |
| 124 | # Skip targets not supporting -maltivec. | 185 | # Skip targets not supporting -maltivec. |
| 125 | @@ -10821,6 +10798,7 @@ proc check_vect_support_and_set_flags { | 186 | @@ -10821,6 +10798,7 @@ proc check_vect_support_and_set_flags { } { |
| 126 | lappend DEFAULT_VECTCFLAGS "-mcpu=970" | 187 | lappend DEFAULT_VECTCFLAGS "-mcpu=970" |
| 127 | } | 188 | } |
| 128 | set dg-do-what-default compile | 189 | set dg-do-what-default compile |
| @@ -130,7 +191,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 130 | } | 191 | } |
| 131 | } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } { | 192 | } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } { |
| 132 | lappend DEFAULT_VECTCFLAGS "-msse2" | 193 | lappend DEFAULT_VECTCFLAGS "-msse2" |
| 133 | @@ -10828,6 +10806,7 @@ proc check_vect_support_and_set_flags { | 194 | @@ -10828,6 +10806,7 @@ proc check_vect_support_and_set_flags { } { |
| 134 | set dg-do-what-default run | 195 | set dg-do-what-default run |
| 135 | } else { | 196 | } else { |
| 136 | set dg-do-what-default compile | 197 | set dg-do-what-default compile |
| @@ -138,7 +199,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 138 | } | 199 | } |
| 139 | } elseif { [istarget mips*-*-*] | 200 | } elseif { [istarget mips*-*-*] |
| 140 | && [check_effective_target_nomips16] } { | 201 | && [check_effective_target_nomips16] } { |
| 141 | @@ -10847,6 +10826,7 @@ proc check_vect_support_and_set_flags { | 202 | @@ -10847,6 +10826,7 @@ proc check_vect_support_and_set_flags { } { |
| 142 | set dg-do-what-default run | 203 | set dg-do-what-default run |
| 143 | } else { | 204 | } else { |
| 144 | set dg-do-what-default compile | 205 | set dg-do-what-default compile |
| @@ -146,7 +207,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 146 | } | 207 | } |
| 147 | } elseif [istarget alpha*-*-*] { | 208 | } elseif [istarget alpha*-*-*] { |
| 148 | # Alpha's vectorization capabilities are extremely limited. | 209 | # Alpha's vectorization capabilities are extremely limited. |
| 149 | @@ -10860,6 +10840,7 @@ proc check_vect_support_and_set_flags { | 210 | @@ -10860,6 +10840,7 @@ proc check_vect_support_and_set_flags { } { |
| 150 | set dg-do-what-default run | 211 | set dg-do-what-default run |
| 151 | } else { | 212 | } else { |
| 152 | set dg-do-what-default compile | 213 | set dg-do-what-default compile |
| @@ -154,7 +215,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 154 | } | 215 | } |
| 155 | } elseif [istarget ia64-*-*] { | 216 | } elseif [istarget ia64-*-*] { |
| 156 | set dg-do-what-default run | 217 | set dg-do-what-default run |
| 157 | @@ -10873,6 +10854,7 @@ proc check_vect_support_and_set_flags { | 218 | @@ -10873,6 +10854,7 @@ proc check_vect_support_and_set_flags { } { |
| 158 | set dg-do-what-default run | 219 | set dg-do-what-default run |
| 159 | } else { | 220 | } else { |
| 160 | set dg-do-what-default compile | 221 | set dg-do-what-default compile |
| @@ -162,7 +223,7 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 162 | } | 223 | } |
| 163 | } elseif [istarget aarch64*-*-*] { | 224 | } elseif [istarget aarch64*-*-*] { |
| 164 | set dg-do-what-default run | 225 | set dg-do-what-default run |
| 165 | @@ -10897,6 +10879,7 @@ proc check_vect_support_and_set_flags { | 226 | @@ -10897,6 +10879,7 @@ proc check_vect_support_and_set_flags { } { |
| 166 | } else { | 227 | } else { |
| 167 | lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch" | 228 | lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch" |
| 168 | set dg-do-what-default compile | 229 | set dg-do-what-default compile |
| @@ -170,56 +231,3 @@ Index: gcc-13.2.0/gcc/testsuite/lib/target-supports.exp | |||
| 170 | } | 231 | } |
| 171 | } elseif [istarget amdgcn-*-*] { | 232 | } elseif [istarget amdgcn-*-*] { |
| 172 | set dg-do-what-default run | 233 | set dg-do-what-default run |
| 173 | Index: 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 | ||
| 201 | Index: 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" | ||
diff --git a/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch b/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch new file mode 100644 index 0000000000..a408a98698 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | From adb60dc78e0da4877747f32347cee339364775be Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
| 3 | Date: Fri, 15 Sep 2023 09:19:14 +0100 | ||
| 4 | Subject: [PATCH] aarch64: Fix loose ldpstp check [PR111411] | ||
| 5 | |||
| 6 | aarch64_operands_ok_for_ldpstp contained the code: | ||
| 7 | |||
| 8 | /* One of the memory accesses must be a mempair operand. | ||
| 9 | If it is not the first one, they need to be swapped by the | ||
| 10 | peephole. */ | ||
| 11 | if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
| 12 | && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
| 13 | return false; | ||
| 14 | |||
| 15 | But the requirement isn't just that one of the accesses must be a | ||
| 16 | valid mempair operand. It's that the lower access must be, since | ||
| 17 | that's the access that will be used for the instruction operand. | ||
| 18 | |||
| 19 | gcc/ | ||
| 20 | PR target/111411 | ||
| 21 | * config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require | ||
| 22 | the lower memory access to a mem-pair operand. | ||
| 23 | |||
| 24 | gcc/testsuite/ | ||
| 25 | PR target/111411 | ||
| 26 | * gcc.dg/rtl/aarch64/pr111411.c: New test. | ||
| 27 | |||
| 28 | Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d38f45bcca62ca0c7afef4b579f82c5c2a01610] | ||
| 29 | Signed-off-by: Martin Jansa <martin.jansa@gmail.com> | ||
| 30 | --- | ||
| 31 | gcc/config/aarch64/aarch64.cc | 8 ++- | ||
| 32 | gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | 57 +++++++++++++++++++++ | ||
| 33 | 2 files changed, 60 insertions(+), 5 deletions(-) | ||
| 34 | create mode 100644 gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 35 | |||
| 36 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
| 37 | index 6118a3354ac..9b1f791ca8b 100644 | ||
| 38 | --- a/gcc/config/aarch64/aarch64.cc | ||
| 39 | +++ b/gcc/config/aarch64/aarch64.cc | ||
| 40 | @@ -26154,11 +26154,9 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load, | ||
| 41 | gcc_assert (known_eq (GET_MODE_SIZE (GET_MODE (mem_1)), | ||
| 42 | GET_MODE_SIZE (GET_MODE (mem_2)))); | ||
| 43 | |||
| 44 | - /* One of the memory accesses must be a mempair operand. | ||
| 45 | - If it is not the first one, they need to be swapped by the | ||
| 46 | - peephole. */ | ||
| 47 | - if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
| 48 | - && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
| 49 | + /* The lower memory access must be a mem-pair operand. */ | ||
| 50 | + rtx lower_mem = reversed ? mem_2 : mem_1; | ||
| 51 | + if (!aarch64_mem_pair_operand (lower_mem, GET_MODE (lower_mem))) | ||
| 52 | return false; | ||
| 53 | |||
| 54 | if (REG_P (reg_1) && FP_REGNUM_P (REGNO (reg_1))) | ||
| 55 | diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 56 | new file mode 100644 | ||
| 57 | index 00000000000..ad07e9c6c89 | ||
| 58 | --- /dev/null | ||
| 59 | +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 60 | @@ -0,0 +1,57 @@ | ||
| 61 | +/* { dg-do compile { target aarch64*-*-* } } */ | ||
| 62 | +/* { dg-require-effective-target lp64 } */ | ||
| 63 | +/* { dg-options "-O -fdisable-rtl-postreload -fpeephole2 -fno-schedule-fusion" } */ | ||
| 64 | + | ||
| 65 | +extern int data[]; | ||
| 66 | + | ||
| 67 | +void __RTL (startwith ("ira")) foo (void *ptr) | ||
| 68 | +{ | ||
| 69 | + (function "foo" | ||
| 70 | + (param "ptr" | ||
| 71 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
| 72 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
| 73 | + ) ;; param "ptr" | ||
| 74 | + (insn-chain | ||
| 75 | + (block 2 | ||
| 76 | + (edge-from entry (flags "FALLTHRU")) | ||
| 77 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
| 78 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
| 79 | + (insn 5 (set (reg:DI <1>) | ||
| 80 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
| 81 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <0>) | ||
| 82 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
| 83 | + (const_int 0))) | ||
| 84 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <1>) | ||
| 85 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
| 86 | + (const_int 0))) | ||
| 87 | + (edge-to exit (flags "FALLTHRU")) | ||
| 88 | + ) ;; block 2 | ||
| 89 | + ) ;; insn-chain | ||
| 90 | + ) ;; function | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +void __RTL (startwith ("ira")) bar (void *ptr) | ||
| 94 | +{ | ||
| 95 | + (function "bar" | ||
| 96 | + (param "ptr" | ||
| 97 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
| 98 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
| 99 | + ) ;; param "ptr" | ||
| 100 | + (insn-chain | ||
| 101 | + (block 2 | ||
| 102 | + (edge-from entry (flags "FALLTHRU")) | ||
| 103 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
| 104 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
| 105 | + (insn 5 (set (reg:DI <1>) | ||
| 106 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
| 107 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <1>) | ||
| 108 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
| 109 | + (const_int 0))) | ||
| 110 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <0>) | ||
| 111 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
| 112 | + (const_int 0))) | ||
| 113 | + (edge-to exit (flags "FALLTHRU")) | ||
| 114 | + ) ;; block 2 | ||
| 115 | + ) ;; insn-chain | ||
| 116 | + ) ;; function | ||
| 117 | +} | ||
