Skip to content

Commit d5029de

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

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
@@ -3035,6 +3035,14 @@ let hasSideEffects = false in {
30353035
(ins Int64Regs:$s),
30363036
"{{ .reg .b32 tmp; mov.b64 {$low, tmp}, $s; }}",
30373037
[]>;
3038+
def I64toF32H : NVPTXInst<(outs Float32Regs:$high),
3039+
(ins Int64Regs:$s),
3040+
"{{ .reg .b32 tmp; mov.b64 {tmp, $high}, $s; }}",
3041+
[]>;
3042+
def I64toF32L : NVPTXInst<(outs Float32Regs:$low),
3043+
(ins Int64Regs:$s),
3044+
"{{ .reg .b32 tmp; mov.b64 {$low, tmp}, $s; }}",
3045+
[]>;
30383046

30393047
}
30403048

@@ -3058,6 +3066,12 @@ def : Pat<(extractelt vt:$src, 0),
30583066
def : Pat<(extractelt vt:$src, 1),
30593067
(I32toI16H $src)>;
30603068
}
3069+
3070+
def : Pat<(extractelt v2f32:$src, 0),
3071+
(I64toF32L $src)>;
3072+
def : Pat<(extractelt v2f32:$src, 1),
3073+
(I64toF32H $src)>;
3074+
30613075
def : Pat<(v2f16 (build_vector f16:$a, f16:$b)),
30623076
(V2I16toI32 $a, $b)>;
30633077
def : Pat<(v2bf16 (build_vector bf16:$a, bf16:$b)),

0 commit comments

Comments
 (0)