[PATCH] D48970: [DAGCombiner] extend(ifpositive(X)) -> shift-right (not X)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 11:14:56 PDT 2018


spatel added inline comments.


================
Comment at: test/CodeGen/X86/signbit-shift.ll:74
 ; CHECK:       # %bb.0:
-; CHECK-NEXT:    xorl %ecx, %ecx
-; CHECK-NEXT:    testl %edi, %edi
-; CHECK-NEXT:    setns %cl
+; CHECK-NEXT:    notl %edi
+; CHECK-NEXT:    shrl $31, %edi
----------------
spatel wrote:
> craig.topper wrote:
> > Do you have a longer term plan here?
> > 
> > This looks like it could be something like:
> > 
> > ```
> > shrl $31, %edi
> > add $41, %edi
> > mov %edi, %eax
> > ```
> Right. I think the same problem is visible for the 'ifneg' variant below. I have another patch drafted that would have included the trailing add/sub op, but I saw this minimal pattern, so decided we should squash this first. If this works, then I can follow-up by matching this new pattern that includes a shift.
I think these are the ideal results for the select tests (for x86 at least, but hopefully all targets):
https://rise4fun.com/Alive/Avq


https://reviews.llvm.org/D48970





More information about the llvm-commits mailing list