[PATCH] D124756: Update movmsk-cmp.ll to match improvements made to InstCombine

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 2 03:38:12 PDT 2022


deadalnix created this revision.
deadalnix added reviewers: RKSimon, craig.topper, spatel.
Herald added subscribers: StephenFan, pengfei.
Herald added a project: All.
deadalnix requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This reflects the changes in the IR generated by InstCombine as pointed out by @RKSimon in https://reviews.llvm.org/D124743#3485199


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124756

Files:
  llvm/test/CodeGen/X86/movmsk-cmp.ll


Index: llvm/test/CodeGen/X86/movmsk-cmp.ll
===================================================================
--- llvm/test/CodeGen/X86/movmsk-cmp.ll
+++ llvm/test/CodeGen/X86/movmsk-cmp.ll
@@ -4565,35 +4565,28 @@
 ; KNL-NEXT:    # kill: def $xmm1 killed $xmm1 def $zmm1
 ; KNL-NEXT:    # kill: def $xmm0 killed $xmm0 def $zmm0
 ; KNL-NEXT:    vcmpltpd %zmm0, %zmm1, %k0
-; KNL-NEXT:    kshiftrw $1, %k0, %k1
-; KNL-NEXT:    kmovw %k1, %eax
-; KNL-NEXT:    kmovw %k0, %ecx
-; KNL-NEXT:    testb $1, %al
-; KNL-NEXT:    movl $42, %eax
-; KNL-NEXT:    movl $99, %edx
-; KNL-NEXT:    cmovel %edx, %eax
-; KNL-NEXT:    testb $1, %cl
-; KNL-NEXT:    cmovel %edx, %eax
+; KNL-NEXT:    knotw %k0, %k0
+; KNL-NEXT:    kmovw %k0, %eax
+; KNL-NEXT:    testb $3, %al
+; KNL-NEXT:    movl $42, %ecx
+; KNL-NEXT:    movl $99, %eax
+; KNL-NEXT:    cmovel %ecx, %eax
 ; KNL-NEXT:    vzeroupper
 ; KNL-NEXT:    retq
 ;
 ; SKX-LABEL: PR39665_c_ray:
 ; SKX:       # %bb.0:
 ; SKX-NEXT:    vcmpltpd %xmm0, %xmm1, %k0
-; SKX-NEXT:    kshiftrb $1, %k0, %k1
-; SKX-NEXT:    kmovd %k1, %eax
-; SKX-NEXT:    kmovd %k0, %ecx
-; SKX-NEXT:    testb $1, %al
-; SKX-NEXT:    movl $42, %eax
-; SKX-NEXT:    movl $99, %edx
-; SKX-NEXT:    cmovel %edx, %eax
-; SKX-NEXT:    testb $1, %cl
-; SKX-NEXT:    cmovel %edx, %eax
+; SKX-NEXT:    kmovd %k0, %eax
+; SKX-NEXT:    cmpb $3, %al
+; SKX-NEXT:    movl $42, %ecx
+; SKX-NEXT:    movl $99, %eax
+; SKX-NEXT:    cmovel %ecx, %eax
 ; SKX-NEXT:    retq
   %cmp = fcmp ogt <2 x double> %x, %y
-  %e1 = extractelement <2 x i1> %cmp, i32 0
-  %e2 = extractelement <2 x i1> %cmp, i32 1
-  %u = and i1 %e1, %e2
+  %shift = shufflevector <2 x i1> %cmp, <2 x i1> poison, <2 x i32> <i32 1, i32 undef>
+  %1 = and <2 x i1> %cmp, %shift
+  %u = extractelement <2 x i1> %1, i64 0
   %r = select i1 %u, i32 42, i32 99
   ret i32 %r
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124756.426369.patch
Type: text/x-patch
Size: 1839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220502/82bc7640/attachment.bin>


More information about the llvm-commits mailing list