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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]
            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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to