[PATCH] D123109: [x86] Improve select lowering for smin(x, 0) & smax(x, 0)

Wei Xiao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 07:37:44 PDT 2022


wxiao3 marked an inline comment as done.
wxiao3 added inline comments.


================
Comment at: llvm/test/CodeGen/X86/fpclamptosat_vec.ll:2986-3006
+; CHECK-NEXT:    movq %rdx, %rsi
+; CHECK-NEXT:    sarq $63, %rsi
+; CHECK-NEXT:    andq %rdx, %rsi
+; CHECK-NEXT:    movq %r14, %rdx
+; CHECK-NEXT:    sarq $63, %rdx
+; CHECK-NEXT:    andq %r14, %rdx
 ; CHECK-NEXT:    movabsq $-9223372036854775808, %rbx # imm = 0x8000000000000000
----------------
pengfei wrote:
> I see the right side has more instructions, is this still better in performance?
Good catch!
We can do the transformation only when CMP has a single user. Otherwise, the total instruction number will be increased like here. I have updated patch to add the restriction.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123109



More information about the llvm-commits mailing list