diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index e8f001e491cdc..30dc9cb561d06 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -17000,6 +17000,7 @@ SDValue RISCVTargetLowering::LowerFormalArguments( report_fatal_error("Unsupported calling convention"); case CallingConv::C: case CallingConv::Fast: + case CallingConv::SPIR_KERNEL: break; case CallingConv::GHC: if (!Subtarget.hasStdExtFOrZfinx() || !Subtarget.hasStdExtDOrZdinx()) diff --git a/llvm/test/CodeGen/RISCV/spir-kernel-cc.ll b/llvm/test/CodeGen/RISCV/spir-kernel-cc.ll new file mode 100644 index 0000000000000..283f397373566 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/spir-kernel-cc.ll @@ -0,0 +1,16 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 < %s | FileCheck %s -check-prefix=RV32 +; RUN: llc -mtriple=riscv64 < %s | FileCheck %s -check-prefix=RV64 + +; Check the SPIR_KERNEL call convention works. + +define dso_local spir_kernel void @foo() { +; RV32-LABEL: foo: +; RV32: # %bb.0: +; RV32-NEXT: ret +; +; RV64-LABEL: foo: +; RV64: # %bb.0: +; RV64-NEXT: ret + ret void +}