https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102227
Bug ID: 102227 Summary: [12 Regression] Likely wrong code since r12-3376-g13beaf9e8d2d8264c0ad8f6504793fdcf26f3f73 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: hjl.tools at gmail dot com Blocks: 26163 Target Milestone: --- Since the revision, 434.zeusmp and other SPEC benchmarks do fail with -march=native -Ofast on AMD znver1 and Intel skylake. I isolated that the affected source file is tranx3.f, where I can see a couple of assembly changes like: Before: vmulsd gridcomr_+44688(,%rax,8), %xmm2, %xmm2 vaddsd %xmm2, %xmm0, %xmm1 vmulsd %xmm2, %xmm0, %xmm0 vxorpd %xmm2, %xmm2, %xmm2 vmaxsd %xmm2, %xmm0, %xmm0 vmovsd %xmm1, %xmm1, %xmm2 vandpd .LC1(%rip), %xmm2, %xmm2 vxorpd %xmm0, %xmm2, %xmm2 vandpd .LC2(%rip), %xmm1, %xmm0 vmovsd .LC3(%rip), %xmm1 vmaxsd %xmm1, %xmm0, %xmm0 vdivsd %xmm0, %xmm2, %xmm0 vmovsd %xmm0, 856(%rsp,%rbx,8) .L102: After: vmulsd gridcomr_+44688(,%rbx,8), %xmm0, %xmm0 vsubsd %xmm2, %xmm1, %xmm2 vmulsd gridcomr_+44688(,%rax,8), %xmm2, %xmm2 vaddsd %xmm2, %xmm0, %xmm1 vandpd .LC1(%rip), %xmm1, %xmm1 vmulsd %xmm2, %xmm0, %xmm0 vxorpd %xmm2, %xmm2, %xmm2 vmaxsd %xmm2, %xmm0, %xmm0 vmovsd .LC3(%rip), %xmm2 vxorpd %xmm0, %xmm1, %xmm0 vandpd .LC2(%rip), %xmm1, %xmm1 vmaxsd %xmm2, %xmm1, %xmm1 vdivsd %xmm1, %xmm0, %xmm0 vmovsd %xmm0, 856(%rsp,%rbx,8) .L102: @H.J. Can you please take a look? It's not easy to reproduce a smaller test-case .. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26163 [Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)