Skip to content

Commit 13e4ab9

Browse files
committed
Post-review fix
1 parent 4cbb7b5 commit 13e4ab9

File tree

3 files changed

+598
-544
lines changed

3 files changed

+598
-544
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
633633
setOperationAction(ISD::FMAXNUM, MVT::f16, Legal);
634634
setOperationAction(ISD::STRICT_FMINNUM, MVT::f16, Legal);
635635
setOperationAction(ISD::STRICT_FMAXNUM, MVT::f16, Legal);
636-
637-
if (Subtarget->hasVFPv3()) {
638-
setOperationAction(ISD::STRICT_FP_EXTEND, MVT::f32, Legal);
639-
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f16, Legal);
640-
}
641636
}
642637

643638
if (Subtarget->hasBF16()) {
@@ -967,6 +962,9 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
967962
if (!Subtarget->hasFP16()) {
968963
setOperationAction(ISD::FP_EXTEND, MVT::f32, Custom);
969964
setOperationAction(ISD::STRICT_FP_EXTEND, MVT::f32, Custom);
965+
} else {
966+
setOperationAction(ISD::STRICT_FP_EXTEND, MVT::f32, Legal);
967+
setOperationAction(ISD::STRICT_FP_ROUND, MVT::f16, Legal);
970968
}
971969

972970
computeRegisterProperties(Subtarget->getRegisterInfo());
@@ -1306,16 +1304,16 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
13061304
if (!Subtarget->hasFPARMv8Base() || !Subtarget->hasFP64()) {
13071305
setOperationAction(ISD::FP16_TO_FP, MVT::f64, Expand);
13081306
setOperationAction(ISD::FP_TO_FP16, MVT::f64, Expand);
1309-
setOperationAction(ISD::STRICT_FP16_TO_FP, MVT::f64, LibCall);
1310-
setOperationAction(ISD::STRICT_FP_TO_FP16, MVT::f64, LibCall);
1307+
setOperationAction(ISD::STRICT_FP16_TO_FP, MVT::f64, Expand);
1308+
setOperationAction(ISD::STRICT_FP_TO_FP16, MVT::f64, Expand);
13111309
}
13121310

13131311
// fp16 is a special v7 extension that adds f16 <-> f32 conversions.
13141312
if (!Subtarget->hasFP16()) {
13151313
setOperationAction(ISD::FP16_TO_FP, MVT::f32, Expand);
13161314
setOperationAction(ISD::FP_TO_FP16, MVT::f32, Expand);
1317-
setOperationAction(ISD::STRICT_FP16_TO_FP, MVT::f32, LibCall);
1318-
setOperationAction(ISD::STRICT_FP_TO_FP16, MVT::f32, LibCall);
1315+
setOperationAction(ISD::STRICT_FP16_TO_FP, MVT::f32, Expand);
1316+
setOperationAction(ISD::STRICT_FP_TO_FP16, MVT::f32, Expand);
13191317
}
13201318

13211319
// Strict floating-point comparisons need custom lowering.

llvm/lib/Target/ARM/ARMInstrVFP.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def VCVTBHS: ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sm),
814814

815815
def : FP16Pat<(f32 (any_fpextend (f16 HPR:$Sm))),
816816
(VCVTBHS (COPY_TO_REGCLASS (f16 HPR:$Sm), SPR))>;
817-
def : FP16Pat<(f16_to_fp GPR:$a),
817+
def : FP16Pat<(any_f16_to_fp GPR:$a),
818818
(VCVTBHS (COPY_TO_REGCLASS GPR:$a, SPR))>;
819819

820820
let hasSideEffects = 0, mayRaiseFPException = 1, Uses = [FPSCR_RM] in
@@ -826,7 +826,7 @@ def VCVTBSH: ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$Sd), (ins SPR:$Sda,
826826

827827
def : FP16Pat<(f16 (any_fpround SPR:$Sm)),
828828
(COPY_TO_REGCLASS (VCVTBSH (IMPLICIT_DEF), SPR:$Sm), HPR)>;
829-
def : FP16Pat<(fp_to_f16 SPR:$a),
829+
def : FP16Pat<(any_fp_to_f16 SPR:$a),
830830
(i32 (COPY_TO_REGCLASS (VCVTBSH (IMPLICIT_DEF), SPR:$a), GPR))>;
831831
def : FP16Pat<(insertelt (v8f16 MQPR:$src1), (f16 (any_fpround (f32 SPR:$src2))), imm_even:$lane),
832832
(v8f16 (INSERT_SUBREG (v8f16 MQPR:$src1),
@@ -891,7 +891,7 @@ def VCVTBHD : ADuI<0b11101, 0b11, 0b0010, 0b01, 0,
891891
def : FullFP16Pat<(f64 (any_fpextend (f16 HPR:$Sm))),
892892
(VCVTBHD (COPY_TO_REGCLASS (f16 HPR:$Sm), SPR))>,
893893
Requires<[HasFPARMv8, HasDPVFP]>;
894-
def : FP16Pat<(f64 (f16_to_fp GPR:$a)),
894+
def : FP16Pat<(f64 (any_f16_to_fp GPR:$a)),
895895
(VCVTBHD (COPY_TO_REGCLASS GPR:$a, SPR))>,
896896
Requires<[HasFPARMv8, HasDPVFP]>;
897897

@@ -917,7 +917,7 @@ def VCVTBDH : ADuI<0b11101, 0b11, 0b0011, 0b01, 0,
917917
def : FullFP16Pat<(f16 (any_fpround DPR:$Dm)),
918918
(COPY_TO_REGCLASS (VCVTBDH (IMPLICIT_DEF), DPR:$Dm), HPR)>,
919919
Requires<[HasFPARMv8, HasDPVFP]>;
920-
def : FP16Pat<(fp_to_f16 (f64 DPR:$a)),
920+
def : FP16Pat<(any_fp_to_f16 (f64 DPR:$a)),
921921
(i32 (COPY_TO_REGCLASS (VCVTBDH (IMPLICIT_DEF), DPR:$a), GPR))>,
922922
Requires<[HasFPARMv8, HasDPVFP]>;
923923

0 commit comments

Comments
 (0)