[llvm] 11c3b97 - [X86][NFC] Add a test case to show wrong memory folding for vinsertps

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 23:30:39 PDT 2023


Author: Phoebe Wang
Date: 2023-09-08T14:30:33+08:00
New Revision: 11c3b979e6512b00a5bd9c3e0d4ed986cf500630

URL: https://github.com/llvm/llvm-project/commit/11c3b979e6512b00a5bd9c3e0d4ed986cf500630
DIFF: https://github.com/llvm/llvm-project/commit/11c3b979e6512b00a5bd9c3e0d4ed986cf500630.diff

LOG: [X86][NFC] Add a test case to show wrong memory folding for vinsertps

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/avx.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/avx.ll b/llvm/test/CodeGen/X86/avx.ll
index 055b2c9373fc331..dc59186d568cc2c 100644
--- a/llvm/test/CodeGen/X86/avx.ll
+++ b/llvm/test/CodeGen/X86/avx.ll
@@ -179,3 +179,19 @@ define <4 x float> @insertps_from_broadcast_multiple_use(<4 x float> %a, <4 x fl
   %13 = fadd <4 x float> %11, %12
   ret <4 x float> %13
 }
+
+define <4 x float> @nofold_insertps(ptr %a, <4 x float> %b) {
+; X86-LABEL: nofold_insertps:
+; X86:       ## %bb.0:
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    vinsertps $176, (%eax), %xmm0, %xmm0 ## xmm0 = xmm0[0,1,2],mem[2]
+; X86-NEXT:    retl
+;
+; X64-LABEL: nofold_insertps:
+; X64:       ## %bb.0:
+; X64-NEXT:    vinsertps $176, (%rdi), %xmm0, %xmm0 ## xmm0 = xmm0[0,1,2],mem[2]
+; X64-NEXT:    retq
+  %1 = load <4 x float>, ptr %a, align 1
+  %2 = shufflevector <4 x float> %b, <4 x float> %1, <4 x i32> <i32 0, i32 1, i32 2, i32 6>
+  ret <4 x float> %2
+}


        


More information about the llvm-commits mailing list