Skip to content

Commit 14d8c45

Browse files
authored
[RISCV] Add more intrinsics into canSplatOperand. (#83106)
This patch adds smin/smax/umin/umax/sadd_sat/ssub_sat/uadd_sat/usub_sat into canSplatOperand. It can help llvm fold vv instructions with one splat operand to vx instructions.
1 parent d7d564b commit 14d8c45

File tree

2 files changed

+1582
-592
lines changed

2 files changed

+1582
-592
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,10 @@ bool RISCVTargetLowering::canSplatOperand(Instruction *I, int Operand) const {
19991999
case Intrinsic::vp_sdiv:
20002000
case Intrinsic::vp_urem:
20012001
case Intrinsic::vp_srem:
2002+
case Intrinsic::ssub_sat:
2003+
case Intrinsic::vp_ssub_sat:
2004+
case Intrinsic::usub_sat:
2005+
case Intrinsic::vp_usub_sat:
20022006
return Operand == 1;
20032007
// These intrinsics are commutative.
20042008
case Intrinsic::vp_add:
@@ -2010,6 +2014,18 @@ bool RISCVTargetLowering::canSplatOperand(Instruction *I, int Operand) const {
20102014
case Intrinsic::vp_fmul:
20112015
case Intrinsic::vp_icmp:
20122016
case Intrinsic::vp_fcmp:
2017+
case Intrinsic::smin:
2018+
case Intrinsic::vp_smin:
2019+
case Intrinsic::umin:
2020+
case Intrinsic::vp_umin:
2021+
case Intrinsic::smax:
2022+
case Intrinsic::vp_smax:
2023+
case Intrinsic::umax:
2024+
case Intrinsic::vp_umax:
2025+
case Intrinsic::sadd_sat:
2026+
case Intrinsic::vp_sadd_sat:
2027+
case Intrinsic::uadd_sat:
2028+
case Intrinsic::vp_uadd_sat:
20132029
// These intrinsics have 'vr' versions.
20142030
case Intrinsic::vp_sub:
20152031
case Intrinsic::vp_fsub:

0 commit comments

Comments
 (0)