[llvm] 62d6c10 - [X86] Add test showing the failure to fold FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 05:25:53 PDT 2025
Author: Simon Pilgrim
Date: 2025-08-19T13:25:36+01:00
New Revision: 62d6c10b249b1b50978fbfd41c6dd41b74c0d9a6
URL: https://github.com/llvm/llvm-project/commit/62d6c10b249b1b50978fbfd41c6dd41b74c0d9a6
DIFF: https://github.com/llvm/llvm-project/commit/62d6c10b249b1b50978fbfd41c6dd41b74c0d9a6.diff
LOG: [X86] Add test showing the failure to fold FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
Added:
Modified:
llvm/test/CodeGen/X86/combine-movmsk.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/X86/combine-movmsk.ll b/llvm/test/CodeGen/X86/combine-movmsk.ll
index baa0553a34f48..f72567ac3313d 100644
--- a/llvm/test/CodeGen/X86/combine-movmsk.ll
+++ b/llvm/test/CodeGen/X86/combine-movmsk.ll
@@ -489,6 +489,34 @@ define i32 @or_pmovmskb_pmovmskb(<16 x i8> %a0, <8 x i16> %a1) {
ret i32 %7
}
+; TODO: FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
+define i32 @movmskps_freeze(<4 x i32> %a0) {
+; SSE-LABEL: movmskps_freeze:
+; SSE: # %bb.0:
+; SSE-NEXT: movmskps %xmm0, %eax
+; SSE-NEXT: andl $15, %eax
+; SSE-NEXT: retq
+;
+; AVX-LABEL: movmskps_freeze:
+; AVX: # %bb.0:
+; AVX-NEXT: vmovmskps %xmm0, %eax
+; AVX-NEXT: andl $15, %eax
+; AVX-NEXT: retq
+;
+; ADL-LABEL: movmskps_freeze:
+; ADL: # %bb.0:
+; ADL-NEXT: vmovmskps %xmm0, %eax
+; ADL-NEXT: andl $15, %eax
+; ADL-NEXT: retq
+ %1 = icmp slt <4 x i32> %a0, zeroinitializer
+ %2 = sext <4 x i1> %1 to <4 x i32>
+ %3 = bitcast <4 x i32> %2 to <4 x float>
+ %4 = tail call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %3)
+ %5 = freeze i32 %4
+ %6 = and i32 %5, 15
+ ret i32 %6
+}
+
; We can't fold to ptest if we're not checking every pcmpeq result
define i32 @movmskps_ptest_numelts_mismatch(<16 x i8> %a0) {
; SSE-LABEL: movmskps_ptest_numelts_mismatch:
More information about the llvm-commits
mailing list