Skip to content

Commit 11c3b97

Browse files
committed
[X86][NFC] Add a test case to show wrong memory folding for vinsertps
1 parent 2eb767c commit 11c3b97

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/test/CodeGen/X86/avx.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,19 @@ define <4 x float> @insertps_from_broadcast_multiple_use(<4 x float> %a, <4 x fl
179179
%13 = fadd <4 x float> %11, %12
180180
ret <4 x float> %13
181181
}
182+
183+
define <4 x float> @nofold_insertps(ptr %a, <4 x float> %b) {
184+
; X86-LABEL: nofold_insertps:
185+
; X86: ## %bb.0:
186+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
187+
; X86-NEXT: vinsertps $176, (%eax), %xmm0, %xmm0 ## xmm0 = xmm0[0,1,2],mem[2]
188+
; X86-NEXT: retl
189+
;
190+
; X64-LABEL: nofold_insertps:
191+
; X64: ## %bb.0:
192+
; X64-NEXT: vinsertps $176, (%rdi), %xmm0, %xmm0 ## xmm0 = xmm0[0,1,2],mem[2]
193+
; X64-NEXT: retq
194+
%1 = load <4 x float>, ptr %a, align 1
195+
%2 = shufflevector <4 x float> %b, <4 x float> %1, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
196+
ret <4 x float> %2
197+
}

0 commit comments

Comments
 (0)