Skip to content

Commit 40a2396

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 088391c commit 40a2396

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
@@ -683,6 +683,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
683683
for (MVT VT : {MVT::bf16, MVT::f16, MVT::v2bf16, MVT::v2f16, MVT::f32,
684684
MVT::v2f32, MVT::f64, MVT::i1, MVT::i8, MVT::i16, MVT::v2i16,
685685
MVT::v4i8, MVT::i32, MVT::i64}) {
686+
setOperationAction(ISD::VSELECT, VT, Expand);
686687
setOperationAction(ISD::SELECT_CC, VT, Expand);
687688
setOperationAction(ISD::BR_CC, VT, Expand);
688689
}

0 commit comments

Comments
 (0)