[llvm-bugs] [Bug 49971] New: [X86] 12.0.0 Regression - foldShuffleOfHorizOp doesn't correctly handle 256-bit X86ISD::VBROADCAST

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 15 09:30:35 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49971

            Bug ID: 49971
           Summary: [X86] 12.0.0 Regression - foldShuffleOfHorizOp doesn't
                    correctly handle 256-bit X86ISD::VBROADCAST
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com
            Blocks: 49317

Encountered by an internal test:

define <4 x double> @broadcast_hadd_pd(<4 x double> %0) {
  %2 = tail call <4 x double> @llvm.x86.avx.hadd.pd.256(<4 x double> %0, <4 x
double> %0)
  %3 = shufflevector <4 x double> %2, <4 x double> undef, <4 x i32> <i32 0, i32
1, i32 0, i32 1>
  ret <4 x double> %3
}
declare <4 x double> @llvm.x86.avx.hadd.pd.256(<4 x double>, <4 x double>)


llc -march=znver2

trunk:
broadcast_hadd_pd:
        vhaddpd %xmm0, %xmm0, %xmm0
        vbroadcastsd    %xmm0, %ymm0
        retq

llvm12:
broadcast_hadd_pd:
        vhaddpd %ymm0, %ymm0, %ymm0 ; WHERE DID THE SPLAT GO?
        retq

llvm11:
broadcast_hadd_pd:
        vhaddpd %xmm0, %xmm0, %xmm0
        vpermpd $68, %ymm0, %ymm0               # ymm0 = ymm0[0,1,0,1]
        retq

The issue is that foldShuffleOfHorizOp incorrectly assumes that a 256-bit
broadcast(vhaddpd(x,y)) can be replaced by vhaddpd(x,x).

The safest solution appears to be to drop X86ISD::VBROADCAST handling from
foldShuffleOfHorizOp entirely - canonicalizeShuffleMaskWithHorizOp already
handles it. 

In trunk we've already removed all VBROADCAST/MOVDDUP handling from
foldShuffleOfHorizOp (2a0d5da917f1) but in 12.x we still need the MOVDDUP
support in some cases.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=49317
[Bug 49317] [meta] 12.0.1 Release Blockers
-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210415/538ada64/attachment-0001.html>


More information about the llvm-bugs mailing list