Skip to content

Commit 62d6c10

Browse files
committed
[X86] Add test showing the failure to fold FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
1 parent ddb36a8 commit 62d6c10

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,34 @@ define i32 @or_pmovmskb_pmovmskb(<16 x i8> %a0, <8 x i16> %a1) {
489489
ret i32 %7
490490
}
491491

492+
; TODO: FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
493+
define i32 @movmskps_freeze(<4 x i32> %a0) {
494+
; SSE-LABEL: movmskps_freeze:
495+
; SSE: # %bb.0:
496+
; SSE-NEXT: movmskps %xmm0, %eax
497+
; SSE-NEXT: andl $15, %eax
498+
; SSE-NEXT: retq
499+
;
500+
; AVX-LABEL: movmskps_freeze:
501+
; AVX: # %bb.0:
502+
; AVX-NEXT: vmovmskps %xmm0, %eax
503+
; AVX-NEXT: andl $15, %eax
504+
; AVX-NEXT: retq
505+
;
506+
; ADL-LABEL: movmskps_freeze:
507+
; ADL: # %bb.0:
508+
; ADL-NEXT: vmovmskps %xmm0, %eax
509+
; ADL-NEXT: andl $15, %eax
510+
; ADL-NEXT: retq
511+
%1 = icmp slt <4 x i32> %a0, zeroinitializer
512+
%2 = sext <4 x i1> %1 to <4 x i32>
513+
%3 = bitcast <4 x i32> %2 to <4 x float>
514+
%4 = tail call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %3)
515+
%5 = freeze i32 %4
516+
%6 = and i32 %5, 15
517+
ret i32 %6
518+
}
519+
492520
; We can't fold to ptest if we're not checking every pcmpeq result
493521
define i32 @movmskps_ptest_numelts_mismatch(<16 x i8> %a0) {
494522
; SSE-LABEL: movmskps_ptest_numelts_mismatch:

0 commit comments

Comments
 (0)