diff options
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-15.1.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0027-aarch64-Fix-fma-steering-when-rename-fails-PR120119.patch | 69 |
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-15.1.inc b/meta/recipes-devtools/gcc/gcc-15.1.inc index af29db8e5b..25688aab34 100644 --- a/meta/recipes-devtools/gcc/gcc-15.1.inc +++ b/meta/recipes-devtools/gcc/gcc-15.1.inc | |||
| @@ -73,6 +73,7 @@ SRC_URI = "${BASEURI} \ | |||
| 73 | file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ | 73 | file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ |
| 74 | file://0026-arm-fully-validate-mem_noofs_operand-PR120351.patch \ | 74 | file://0026-arm-fully-validate-mem_noofs_operand-PR120351.patch \ |
| 75 | file://0026-fix-incorrect-preprocessor-line-numbers.patch \ | 75 | file://0026-fix-incorrect-preprocessor-line-numbers.patch \ |
| 76 | file://0027-aarch64-Fix-fma-steering-when-rename-fails-PR120119.patch \ | ||
| 76 | " | 77 | " |
| 77 | 78 | ||
| 78 | UNPACKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/sources" | 79 | UNPACKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/sources" |
diff --git a/meta/recipes-devtools/gcc/gcc/0027-aarch64-Fix-fma-steering-when-rename-fails-PR120119.patch b/meta/recipes-devtools/gcc/gcc/0027-aarch64-Fix-fma-steering-when-rename-fails-PR120119.patch new file mode 100644 index 0000000000..a59cb45524 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0027-aarch64-Fix-fma-steering-when-rename-fails-PR120119.patch | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | From b28d5f51e1ec75f6878593ef084e9cfb836b9db4 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrew Pinski <quic_apinski@quicinc.com> | ||
| 3 | Date: Tue, 22 Jul 2025 10:32:42 -0700 | ||
| 4 | Subject: [PATCH] aarch64: Fix fma steering when rename fails [PR120119] | ||
| 5 | |||
| 6 | Regrename can fail in some case and `insn_rr[INSN_UID (insn)].op_info` | ||
| 7 | will be null. The FMA steering code was not expecting the failure to happen. | ||
| 8 | This started to happen after early RA was added but it has been a latent bug | ||
| 9 | before that. | ||
| 10 | |||
| 11 | Build and tested for aarch64-linux-gnu. | ||
| 12 | |||
| 13 | PR target/120119 | ||
| 14 | |||
| 15 | gcc/ChangeLog: | ||
| 16 | |||
| 17 | * config/aarch64/cortex-a57-fma-steering.cc (func_fma_steering::analyze): | ||
| 18 | Skip if renaming fails. | ||
| 19 | |||
| 20 | gcc/testsuite/ChangeLog: | ||
| 21 | |||
| 22 | * g++.dg/torture/pr120119-1.C: New test. | ||
| 23 | |||
| 24 | Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2025-July/690239.html] | ||
| 25 | Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com> | ||
| 26 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 27 | --- | ||
| 28 | gcc/config/aarch64/cortex-a57-fma-steering.cc | 5 +++++ | ||
| 29 | gcc/testsuite/g++.dg/torture/pr120119-1.C | 15 +++++++++++++++ | ||
| 30 | 2 files changed, 20 insertions(+) | ||
| 31 | create mode 100644 gcc/testsuite/g++.dg/torture/pr120119-1.C | ||
| 32 | |||
| 33 | diff --git a/gcc/config/aarch64/cortex-a57-fma-steering.cc b/gcc/config/aarch64/cortex-a57-fma-steering.cc | ||
| 34 | index fd6da66d855..f7675bed13d 100644 | ||
| 35 | --- a/gcc/config/aarch64/cortex-a57-fma-steering.cc | ||
| 36 | +++ b/gcc/config/aarch64/cortex-a57-fma-steering.cc | ||
| 37 | @@ -948,6 +948,11 @@ func_fma_steering::analyze () | ||
| 38 | |||
| 39 | /* Search the chain where this instruction is (one of) the root. */ | ||
| 40 | dest_op_info = insn_rr[INSN_UID (insn)].op_info; | ||
| 41 | + | ||
| 42 | + /* Register rename could fail. */ | ||
| 43 | + if (!dest_op_info) | ||
| 44 | + continue; | ||
| 45 | + | ||
| 46 | dest_regno = REGNO (SET_DEST (PATTERN (insn))); | ||
| 47 | for (i = 0; i < dest_op_info->n_chains; i++) | ||
| 48 | { | ||
| 49 | diff --git a/gcc/testsuite/g++.dg/torture/pr120119-1.C b/gcc/testsuite/g++.dg/torture/pr120119-1.C | ||
| 50 | new file mode 100644 | ||
| 51 | index 00000000000..1206feb310b | ||
| 52 | --- /dev/null | ||
| 53 | +++ b/gcc/testsuite/g++.dg/torture/pr120119-1.C | ||
| 54 | @@ -0,0 +1,15 @@ | ||
| 55 | +// { dg-do compile } | ||
| 56 | +// { dg-additional-options "-mcpu=cortex-a57" { target aarch64*-*-* } } | ||
| 57 | + | ||
| 58 | +// PR target/120119 | ||
| 59 | + | ||
| 60 | +struct a { | ||
| 61 | + float operator()(int b, int c) { return d[c * 4 + b]; } | ||
| 62 | + float *d; | ||
| 63 | +}; | ||
| 64 | +float e(float *); | ||
| 65 | +auto f(a b) { | ||
| 66 | + float g[]{b(1, 1), b(2, 1), b(3, 1), b(1, 2), b(2, 2), b(3, 2), b(1, 3), | ||
| 67 | + b(2, 3), b(3, 3), b(3, 2), b(1, 3), b(2, 3), b(3, 3)}; | ||
| 68 | + return b.d[0] * e(g); | ||
| 69 | +} | ||
