Skip to content

Commit b0eba8e

Browse files
authored
[RISCV] Support STRICT_FP_ROUND and STRICT_FP_EXTEND when only have Zvfhmin (#68559)
This patch supports STRICT_FP_ROUND and STRICT_FP_EXTEND when we only have Zvfhmin but no Zvfh.
1 parent 3694697 commit b0eba8e

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
942942
if (!isTypeLegal(VT))
943943
continue;
944944
setOperationAction({ISD::FP_ROUND, ISD::FP_EXTEND}, VT, Custom);
945+
setOperationAction({ISD::STRICT_FP_ROUND, ISD::STRICT_FP_EXTEND}, VT,
946+
Custom);
945947
setOperationAction({ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND}, VT, Custom);
946948
setOperationAction({ISD::VP_MERGE, ISD::VP_SELECT, ISD::SELECT}, VT,
947949
Custom);
@@ -1154,6 +1156,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
11541156
if (VT.getVectorElementType() == MVT::f16 &&
11551157
!Subtarget.hasVInstructionsF16()) {
11561158
setOperationAction({ISD::FP_ROUND, ISD::FP_EXTEND}, VT, Custom);
1159+
setOperationAction({ISD::STRICT_FP_ROUND, ISD::STRICT_FP_EXTEND}, VT,
1160+
Custom);
11571161
setOperationAction({ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND}, VT, Custom);
11581162
setOperationAction(
11591163
{ISD::VP_MERGE, ISD::VP_SELECT, ISD::VSELECT, ISD::SELECT}, VT,

llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vfptrunc-constrained-sdnode.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
; RUN: -verify-machineinstrs < %s | FileCheck %s
44
; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
55
; RUN: -verify-machineinstrs < %s | FileCheck %s
6+
; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=ilp32d \
7+
; RUN: -verify-machineinstrs < %s | FileCheck %s
8+
; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=lp64d \
9+
; RUN: -verify-machineinstrs < %s | FileCheck %s
610

711
declare <2 x float> @llvm.experimental.constrained.fptrunc.v2f32.v2f64(<2 x double>, metadata, metadata)
812
define <2 x float> @vfptrunc_v2f64_v2f32(<2 x double> %va) strictfp {

llvm/test/CodeGen/RISCV/rvv/vfptrunc-constrained-sdnode.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
; RUN: -verify-machineinstrs < %s | FileCheck %s
44
; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
55
; RUN: -verify-machineinstrs < %s | FileCheck %s
6+
; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=ilp32d \
7+
; RUN: -verify-machineinstrs < %s | FileCheck %s
8+
; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=lp64d \
9+
; RUN: -verify-machineinstrs < %s | FileCheck %s
610

711
declare <vscale x 1 x float> @llvm.experimental.constrained.fptrunc.nxv1f32.nxv1f64(<vscale x 1 x double>, metadata, metadata)
812
define <vscale x 1 x float> @vfptrunc_nxv1f64_nxv1f32(<vscale x 1 x double> %va) strictfp {

0 commit comments

Comments
 (0)