[PATCH] D123109: [x86] improve select lowering for smin(x, 0) & smax(x, 0)
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 21:24:31 PDT 2022
pengfei added inline comments.
================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:24784
+ } else if ((VT == MVT::i32 || VT == MVT::i64) && isNullConstant(Op2) &&
+ (CmpOp0 == Op1) && ((CondCode == X86::COND_S) || // smin(x, 0)
+ (CondCode == X86::COND_G && hasAndNot(Op1)))) { // smax(x, 0)
----------------
clang-format
================
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
----------------
I see the right side has more instructions, is this still better in performance?
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