Skip to content

Commit d569e12

Browse files
authored
[SYCL][SPIR-V] Register llvm.fpbuiltin.* in the list of known intrinsics (#19656)
Otherwise their declarations would be left in the module. This patch is intel/llvm customization as these intrinsics are not part of upstream llvm. --------- Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
1 parent b53f646 commit d569e12

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,6 +3984,17 @@ bool LLVMToSPIRVBase::isKnownIntrinsic(Intrinsic::ID Id) {
39843984
case Intrinsic::masked_gather:
39853985
case Intrinsic::masked_scatter:
39863986
case Intrinsic::modf:
3987+
// INTEL_CUSTOMIZATION begin
3988+
// fpbuiltin intrinsics are not part of upstream LLVM, yet we have to register
3989+
// them as known.
3990+
case Intrinsic::fpbuiltin_fadd:
3991+
case Intrinsic::fpbuiltin_fsub:
3992+
case Intrinsic::fpbuiltin_fmul:
3993+
case Intrinsic::fpbuiltin_fdiv:
3994+
case Intrinsic::fpbuiltin_frem:
3995+
case Intrinsic::fpbuiltin_sqrt:
3996+
case Intrinsic::fpbuiltin_ldexp:
3997+
// INTEL_CUSTOMIZATION end
39873998
return true;
39883999
default:
39894000
// Unknown intrinsics' declarations should always be translated

llvm-spirv/test/extensions/INTEL/SPV_INTEL_fp_max_error/IntelFPMaxError.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
1515
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
1616

17+
; INTEL_CUSTOMIZATION begin
18+
; CHECK-SPIRV-NOT: Name [[#]] "llvm.fpbuiltin."
19+
; INTEL_CUSTOMIZATION end
20+
1721
; CHECK-SPIRV: Capability FPMaxErrorINTEL
1822
; CHECK-SPIRV: Extension "SPV_INTEL_fp_max_error"
1923
; CHECK-SPIRV: ExtInstImport [[#OCLEXTID:]] "OpenCL.std"

0 commit comments

Comments
 (0)