Skip to content

Commit d2c0459

Browse files
authored
[RISCV] Support f16 vmv.v.v and vmerge.vvm intrinsics with Zvfhmin. (#101457)
Clang expects that this works.
1 parent e7630a0 commit d2c0459

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7034,7 +7034,8 @@ defm : VPatBinaryV_VM_XM_IM<"int_riscv_vmerge", "PseudoVMERGE">;
70347034
// 11.16. Vector Integer Move Instructions
70357035
//===----------------------------------------------------------------------===//
70367036
foreach vti = AllVectors in {
7037-
let Predicates = GetVTypePredicates<vti>.Predicates in {
7037+
let Predicates = !if(!eq(vti.Scalar, f16), [HasVInstructionsF16Minimal],
7038+
GetVTypePredicates<vti>.Predicates) in {
70387039
def : Pat<(vti.Vector (int_riscv_vmv_v_v (vti.Vector vti.RegClass:$passthru),
70397040
(vti.Vector vti.RegClass:$rs1),
70407041
VLOpFrag)),
@@ -7229,19 +7230,20 @@ defm : VPatConversionVI_VF<"int_riscv_vfclass", "PseudoVFCLASS">;
72297230
// NOTE: Clang previously used int_riscv_vfmerge for vector-vector, but now uses
72307231
// int_riscv_vmerge. Support both for compatibility.
72317232
foreach vti = AllFloatVectors in {
7232-
let Predicates = GetVTypePredicates<vti>.Predicates in {
7233+
let Predicates = !if(!eq(vti.Scalar, f16), [HasVInstructionsF16Minimal],
7234+
GetVTypePredicates<vti>.Predicates) in
72337235
defm : VPatBinaryCarryInTAIL<"int_riscv_vmerge", "PseudoVMERGE", "VVM",
72347236
vti.Vector,
72357237
vti.Vector, vti.Vector, vti.Mask,
72367238
vti.Log2SEW, vti.LMul, vti.RegClass,
72377239
vti.RegClass, vti.RegClass>;
7240+
let Predicates = GetVTypePredicates<vti>.Predicates in
72387241
defm : VPatBinaryCarryInTAIL<"int_riscv_vfmerge", "PseudoVFMERGE",
72397242
"V"#vti.ScalarSuffix#"M",
72407243
vti.Vector,
72417244
vti.Vector, vti.Scalar, vti.Mask,
72427245
vti.Log2SEW, vti.LMul, vti.RegClass,
72437246
vti.RegClass, vti.ScalarRegClass>;
7244-
}
72457247
}
72467248

72477249
foreach fvti = AllFloatVectors in {

llvm/test/CodeGen/RISCV/rvv/vmerge.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+zfh,+zvfh \
2+
; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+zvfhmin \
33
; RUN: -verify-machineinstrs -target-abi=ilp32d | FileCheck %s
4-
; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+zfh,+zvfh \
4+
; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+zvfhmin \
55
; RUN: -verify-machineinstrs -target-abi=lp64d | FileCheck %s
66

77
declare <vscale x 1 x i8> @llvm.riscv.vmerge.nxv1i8.nxv1i8(

llvm/test/CodeGen/RISCV/rvv/vmv.v.v.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+d,+zfh,+zvfh \
2+
; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+zvfhmin \
33
; RUN: -verify-machineinstrs | FileCheck %s
4-
; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+d,+zfh,+zvfh \
4+
; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+zvfhmin \
55
; RUN: -verify-machineinstrs | FileCheck %s
66

77
declare <vscale x 1 x i8> @llvm.riscv.vmv.v.v.nxv1i8(

0 commit comments

Comments
 (0)