Skip to content

Commit 918a987

Browse files
committed
[NVPTX] peroperly expand operations that we do not support on v2i32
v2i32 register class is present to facilitate v2f32's use of integer registers. There are no actual instructions that can apply to v2i32 directly (except bitwise logical ops). Everything else must be done elementwise.
1 parent 7f82996 commit 918a987

File tree

2 files changed

+1628
-3
lines changed

2 files changed

+1628
-3
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
651651
// Custom conversions to/from v2i8.
652652
setOperationAction(ISD::BITCAST, MVT::v2i8, Custom);
653653

654-
// Only logical ops can be done on v4i8 directly, others must be done
654+
// Only logical ops can be done on v4i8/v2i32 directly, others must be done
655655
// elementwise.
656656
setOperationAction(
657657
{ISD::ABS, ISD::ADD, ISD::ADDC, ISD::ADDE,
@@ -669,7 +669,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
669669
ISD::UMIN, ISD::UMULO, ISD::UMUL_LOHI, ISD::UREM,
670670
ISD::USHLSAT, ISD::USUBO, ISD::USUBO_CARRY, ISD::VSELECT,
671671
ISD::USUBSAT},
672-
MVT::v4i8, Expand);
672+
{MVT::v4i8, MVT::v2i32}, Expand);
673673

674674
// Operations not directly supported by NVPTX.
675675
for (MVT VT : {MVT::bf16, MVT::f16, MVT::v2bf16, MVT::v2f16, MVT::f32,
@@ -689,7 +689,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
689689
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16, Legal);
690690
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i8 , Legal);
691691
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand);
692-
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::v2i16, Expand);
692+
setOperationAction(ISD::SIGN_EXTEND_INREG, {MVT::v2i16, MVT::v2i32}, Expand);
693693

694694
setOperationAction(ISD::SHL_PARTS, MVT::i32 , Custom);
695695
setOperationAction(ISD::SRA_PARTS, MVT::i32 , Custom);

0 commit comments

Comments
 (0)