Skip to content

Commit 9e7defc

Browse files
committed
[X86] Add test case to check computeKnownBitsForPMADDWD doesn't assume add nsw
1 parent e9b8cd0 commit 9e7defc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/test/CodeGen/X86/combine-pmadd.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ define i32 @combine_pmaddwd_constant() {
9898
ret i32 %2
9999
}
100100

101+
; ensure we don't assume pmaddwd performs add nsw
102+
define i32 @combine_pmaddwd_constant_nsw() {
103+
; CHECK-LABEL: combine_pmaddwd_constant_nsw:
104+
; CHECK: # %bb.0:
105+
; CHECK-NEXT: movl $-2147483648, %eax # imm = 0x80000000
106+
; CHECK-NEXT: retq
107+
%1 = insertelement <8 x i16> undef, i16 32768, i32 0
108+
%2 = shufflevector <8 x i16> %1, <8 x i16> undef, <8 x i32> zeroinitializer
109+
%3 = call <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16> %2, <8 x i16> %2)
110+
%4 = extractelement <4 x i32> %3, i32 0 ; (-32768*-32768)+(-32768*-32768) = 0x80000000
111+
ret i32 %4
112+
}
113+
101114
define <8 x i16> @combine_pmaddubsw_zero(<16 x i8> %a0, <16 x i8> %a1) {
102115
; SSE-LABEL: combine_pmaddubsw_zero:
103116
; SSE: # %bb.0:

0 commit comments

Comments
 (0)