[PATCH] D101074: [X86] Canonicalize SGT/UGT compares with constants to use SGE/UGE to reduce the number of EFLAGs reads. (PR48760)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 05:14:09 PDT 2021


lebedev.ri added a comment.

What about the case where the active bit width decreases, e.g. `-129` is i9, incremented it is `-128`, which is i8.



================
Comment at: llvm/test/CodeGen/X86/sdiv_fix_sat.ll:478-484
+; X86-NEXT:    cmpl $-2147483647, %esi # imm = 0x80000001
+; X86-NEXT:    movl $-2147483648, %ecx # imm = 0x80000000
+; X86-NEXT:    cmovael %esi, %ecx
+; X86-NEXT:    movl $0, %edx
+; X86-NEXT:    cmovael %eax, %edx
 ; X86-NEXT:    cmpl $-2147483648, %esi # imm = 0x80000000
+; X86-NEXT:    cmovel %eax, %edx
----------------
lebedev.ri wrote:
> This is the clamp regression i guess?
And it's still here. Do we believe that the addition materialization cost is hidden
by the cmp improvement?
Can't we not do this if the `SETCC` is used by a `SELECT` with one hand matching the unchanged immediate?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101074/new/

https://reviews.llvm.org/D101074



More information about the llvm-commits mailing list