Skip to content

Commit 85cf2a6

Browse files
AlexVlxAnthony Tran
authored andcommitted
[Clang][SPIRV][AMDGPU] Override supportsLibCall for AMDGCNSPIRV (llvm#143814)
The `supportsLibCall` predicate is used to select whether some math builtins get expanded in the FE or they get lowered into libcalls. The default implementation unconditionally returns true, which is problematic for AMDGCN-flavoured SPIRV, as AMDGPU does not support any libcalls at the moment. This change overrides the predicate in order to reflect this and correctly do the expected FE expansion when targeting AMDGCN-flavoured SPIRV.
1 parent 73b2447 commit 85cf2a6

File tree

2 files changed

+877
-0
lines changed

2 files changed

+877
-0
lines changed

clang/lib/CodeGen/Targets/SPIR.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ class SPIRVTargetCodeGenInfo : public CommonSPIRTargetCodeGenInfo {
7575
SyncScope Scope,
7676
llvm::AtomicOrdering Ordering,
7777
llvm::LLVMContext &Ctx) const override;
78+
bool supportsLibCall() const override {
79+
return getABIInfo().getTarget().getTriple().getVendor() !=
80+
llvm::Triple::AMD;
81+
}
7882
};
7983

8084
inline StringRef mapClangSyncScopeToLLVM(SyncScope Scope) {

0 commit comments

Comments
 (0)