Skip to content

Commit a4bd7e9

Browse files
committed
[NVPTX] Expand VSELECT on v2f32 and other types
VSELECT instructions are always expanded because the predicate type they use (vNi1) is unsupported by our backend. However, TLI doesn't check the predicate type when determining whether to rewrite certain operations (ex: FMAX/FMIN) as a VSELECT, only the value type. So in the case of FMAX/FMIN on v2f32, the value type is now legal and therefore TLI thinks it can rewrite it as VSELECT. Eventually this is scalarized into setp, which is not what we want.
1 parent 38e07d7 commit a4bd7e9

File tree

2 files changed

+302
-145
lines changed

2 files changed

+302
-145
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
647647
for (MVT VT : {MVT::bf16, MVT::f16, MVT::v2bf16, MVT::v2f16, MVT::f32,
648648
MVT::v2f32, MVT::f64, MVT::i1, MVT::i8, MVT::i16, MVT::v2i16,
649649
MVT::v4i8, MVT::i32, MVT::i64}) {
650+
setOperationAction(ISD::VSELECT, VT, Expand);
650651
setOperationAction(ISD::SELECT_CC, VT, Expand);
651652
setOperationAction(ISD::BR_CC, VT, Expand);
652653
}

0 commit comments

Comments
 (0)