Author: Joseph Huber Date: 2024-05-03T14:01:09-05:00 New Revision: 70b79a9ccd03f93fc4c8464a91b6bef3aab322d3
URL: https://github.com/llvm/llvm-project/commit/70b79a9ccd03f93fc4c8464a91b6bef3aab322d3 DIFF: https://github.com/llvm/llvm-project/commit/70b79a9ccd03f93fc4c8464a91b6bef3aab322d3.diff LOG: [AMDGPU] Allow the `__builtin_flt_rounds` functions on AMDGPU (#90994) Summary: Previous patches added support for the LLVM rounding intrinsic functions. This patch allows them to me emitted using the clang builtins when targeting AMDGPU. Added: Modified: clang/lib/Sema/SemaChecking.cpp clang/test/CodeGenOpenCL/builtins-amdgcn.cl Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 6d0e93c2b834c0..3179d542b1f926 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2533,18 +2533,18 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID, case Builtin::BI_bittestandset64: case Builtin::BI_interlockedbittestandreset64: case Builtin::BI_interlockedbittestandset64: - if (CheckBuiltinTargetInSupported(*this, BuiltinID, TheCall, - {llvm::Triple::x86_64, llvm::Triple::arm, - llvm::Triple::thumb, - llvm::Triple::aarch64})) + if (CheckBuiltinTargetInSupported( + *this, BuiltinID, TheCall, + {llvm::Triple::x86_64, llvm::Triple::arm, llvm::Triple::thumb, + llvm::Triple::aarch64, llvm::Triple::amdgcn})) return ExprError(); break; case Builtin::BI__builtin_set_flt_rounds: - if (CheckBuiltinTargetInSupported(*this, BuiltinID, TheCall, - {llvm::Triple::x86, llvm::Triple::x86_64, - llvm::Triple::arm, llvm::Triple::thumb, - llvm::Triple::aarch64})) + if (CheckBuiltinTargetInSupported( + *this, BuiltinID, TheCall, + {llvm::Triple::x86, llvm::Triple::x86_64, llvm::Triple::arm, + llvm::Triple::thumb, llvm::Triple::aarch64, llvm::Triple::amdgcn})) return ExprError(); break; diff --git a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl index bdca97c8878670..338d6bc95655a3 100644 --- a/clang/test/CodeGenOpenCL/builtins-amdgcn.cl +++ b/clang/test/CodeGenOpenCL/builtins-amdgcn.cl @@ -839,6 +839,18 @@ unsigned test_wavefrontsize() { return __builtin_amdgcn_wavefrontsize(); } +// CHECK-LABEL test_flt_rounds( +unsigned test_flt_rounds() { + + // CHECK: call i32 @llvm.get.rounding() + unsigned mode = __builtin_flt_rounds(); + + // CHECK: call void @llvm.set.rounding(i32 %0) + __builtin_set_flt_rounds(mode); + + return mode; +} + // CHECK-LABEL test_get_fpenv( unsigned long test_get_fpenv() { // CHECK: call i64 @llvm.get.fpenv.i64() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits