[PATCH] D52669: [X86] Improve test instruction shrinking when the sign flag is used and the output of the and is truncated

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 29 04:13:04 PDT 2018


RKSimon added inline comments.


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:3394
     // Look past the truncate if CMP is the only use of it.
     if (N0.getOpcode() == ISD::AND &&
         N0.getNode()->hasOneUse() &&
----------------
Can you add the explanation in the summary to the comments please?


================
Comment at: lib/Target/X86/X86ISelDAGToDAG.cpp:3408
+          (!(Mask & 0x80) || CmpVT == MVT::i8 ||
+           hasNoSignedComparisonUses(Node))) {
         // For example, convert "testl %eax, $8" to "testb %al, $8"
----------------
Possible to pull this repeated hasNoSignedComparisonUses(Node) call out?


================
Comment at: test/CodeGen/X86/test-shrink.ll:693
+; CHECK-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; CHECK-X86-NEXT:    testb $-128, %al
 ; CHECK-X86-NEXT:    jg .LBB15_2
----------------
Missed folding opportunity ?


================
Comment at: test/CodeGen/X86/test-shrink.ll:737
+; CHECK-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; CHECK-X86-NEXT:    testw $-32768, %ax # imm = 0x8000
 ; CHECK-X86-NEXT:    jg .LBB16_2
----------------
Missed folding opportunity?


================
Comment at: test/CodeGen/X86/test-shrink.ll:781
+; CHECK-X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; CHECK-X86-NEXT:    testw $-32768, %ax # imm = 0x8000
 ; CHECK-X86-NEXT:    jg .LBB17_2
----------------
Missed folding opportunity?


https://reviews.llvm.org/D52669





More information about the llvm-commits mailing list