Skip to content

Commit be9a152

Browse files
Add test for half and bfloat vectors
1 parent b95492f commit be9a152

File tree

2 files changed

+63
-3
lines changed

2 files changed

+63
-3
lines changed

llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,9 @@ static bool isSupportedArgumentType(Type *T, const RISCVSubtarget &Subtarget,
309309
return true;
310310
if (T->isPointerTy())
311311
return true;
312-
// TODO: support 16bit FPtypes.
313312
// TODO: Support fixed vector types.
314313
if (IsLowerArgs && T->isVectorTy() && Subtarget.hasVInstructions() &&
315-
!T->is16bitFPTy() && T->isScalableTy())
314+
T->isScalableTy())
316315
return true;
317316
return false;
318317
}
@@ -401,7 +400,8 @@ bool RISCVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
401400
const RISCVSubtarget &Subtarget =
402401
MIRBuilder.getMF().getSubtarget<RISCVSubtarget>();
403402
for (auto &Arg : F.args()) {
404-
if (!isSupportedArgumentType(Arg.getType(), Subtarget, /*IsLowerArgs*/true))
403+
if (!isSupportedArgumentType(Arg.getType(), Subtarget,
404+
/*IsLowerArgs=*/true))
405405
return false;
406406
}
407407

llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/vec-args.ll

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,3 +691,63 @@ define void @test_args_nxv8f64(<vscale x 8 x double> %a) {
691691
entry:
692692
ret void
693693
}
694+
695+
define void @test_args_nxv1f16(<vscale x 1 x half> %a) {
696+
entry:
697+
ret void
698+
}
699+
700+
define void @test_args_nxv2f16(<vscale x 2 x half> %a) {
701+
entry:
702+
ret void
703+
}
704+
705+
define void @test_args_nxv4f16(<vscale x 4 x half> %a) {
706+
entry:
707+
ret void
708+
}
709+
710+
define void @test_args_nxv8f16(<vscale x 8 x half> %a) {
711+
entry:
712+
ret void
713+
}
714+
715+
define void @test_args_nxv16f16(<vscale x 16 x half> %a) {
716+
entry:
717+
ret void
718+
}
719+
720+
define void @test_args_nxv32f16(<vscale x 32 x half> %a) {
721+
entry:
722+
ret void
723+
}
724+
725+
define void @test_args_nxv1b16(<vscale x 1 x bfloat> %a) {
726+
entry:
727+
ret void
728+
}
729+
730+
define void @test_args_nxv2b16(<vscale x 2 x bfloat> %a) {
731+
entry:
732+
ret void
733+
}
734+
735+
define void @test_args_nxv4b16(<vscale x 4 x bfloat> %a) {
736+
entry:
737+
ret void
738+
}
739+
740+
define void @test_args_nxv8b16(<vscale x 8 x bfloat> %a) {
741+
entry:
742+
ret void
743+
}
744+
745+
define void @test_args_nxv16b16(<vscale x 16 x bfloat> %a) {
746+
entry:
747+
ret void
748+
}
749+
750+
define void @test_args_nxv32b16(<vscale x 32 x bfloat> %a) {
751+
entry:
752+
ret void
753+
}

0 commit comments

Comments
 (0)