Skip to content

Commit afa467b

Browse files
committed
handle fdiv and other instructions where v2f32 is illegal
Requires us to lower EXTRACT_VECTOR_ELT as well.
1 parent 087b3c6 commit afa467b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
933933
{ISD::FDIV, ISD::FREM, ISD::FSQRT, ISD::FSIN, ISD::FCOS}) {
934934
setOperationAction(Op, MVT::f16, Promote);
935935
setOperationAction(Op, MVT::f32, Legal);
936+
setOperationAction(Op, MVT::v2f32, Expand);
936937
setOperationAction(Op, MVT::f64, Legal);
937938
setOperationAction(Op, MVT::v2f16, Expand);
938939
setOperationAction(Op, MVT::v2bf16, Expand);

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,14 @@ let hasSideEffects = false in {
30443044
(ins Int64Regs:$s),
30453045
"{{ .reg .b32 tmp; mov.b64 {$low, tmp}, $s; }}",
30463046
[]>;
3047+
def I64toF32H : NVPTXInst<(outs Float32Regs:$high),
3048+
(ins Int64Regs:$s),
3049+
"{{ .reg .b32 tmp; mov.b64 {tmp, $high}, $s; }}",
3050+
[]>;
3051+
def I64toF32L : NVPTXInst<(outs Float32Regs:$low),
3052+
(ins Int64Regs:$s),
3053+
"{{ .reg .b32 tmp; mov.b64 {$low, tmp}, $s; }}",
3054+
[]>;
30473055

30483056
}
30493057

@@ -3067,6 +3075,12 @@ def : Pat<(extractelt vt:$src, 0),
30673075
def : Pat<(extractelt vt:$src, 1),
30683076
(I32toI16H $src)>;
30693077
}
3078+
3079+
def : Pat<(extractelt v2f32:$src, 0),
3080+
(I64toF32L $src)>;
3081+
def : Pat<(extractelt v2f32:$src, 1),
3082+
(I64toF32H $src)>;
3083+
30703084
def : Pat<(v2f16 (build_vector f16:$a, f16:$b)),
30713085
(V2I16toI32 $a, $b)>;
30723086
def : Pat<(v2bf16 (build_vector bf16:$a, bf16:$b)),

0 commit comments

Comments
 (0)