https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/240703
This reverts commit dbb0418043e246d31aaab324dbe0c1e7097be391. This does not exist in CUDA and I do not think it's appropriate to add extensions in the global namespace with so little discussion >From 66a28927dbd8de01b52392851f65ffabce7c75b0 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Mon, 9 Nov 2026 20:51:22 -0800 Subject: [PATCH] Revert "[HIP] Add __exp2f to the HIP math header (#236328)" This reverts commit dbb0418043e246d31aaab324dbe0c1e7097be391. --- clang/docs/ReleaseNotes.md | 5 ---- clang/lib/Headers/__clang_hip_math.h | 3 --- clang/test/Headers/__clang_hip_math.hip | 34 ------------------------- 3 files changed, 42 deletions(-) diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index 9c36e1e1679457..ae351da057cc8d 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -1412,11 +1412,6 @@ documentation](CIR/index.md) for more information regarding ClangIR's status and link-time failures. `dynamic_cast<void*>` is still allowed because it does not use RTTI. -- The HIP math header now provides `__exp2f`, a fast `exp2` intrinsic that - lowers to a single `v_exp_f32` without the denormal handling that `exp2f` - adds, so results in the denormal range may be flushed to zero. CUDA has no - `__exp2f`, so it is a HIP-only extension. - #### CUDA Support - Fixed missing diagnostics for wrong-side functions reached through constructor diff --git a/clang/lib/Headers/__clang_hip_math.h b/clang/lib/Headers/__clang_hip_math.h index 2b673ed4c5b015..c1fc112c95a4c1 100644 --- a/clang/lib/Headers/__clang_hip_math.h +++ b/clang/lib/Headers/__clang_hip_math.h @@ -166,9 +166,6 @@ float __exp10f(float __x) { return __builtin_amdgcn_exp2f(__log2_10 * __x); } -__DEVICE__ -float __exp2f(float __x) { return __builtin_amdgcn_exp2f(__x); } - __DEVICE__ float __expf(float __x) { const float __log2_e = 0x1.715476p+0; diff --git a/clang/test/Headers/__clang_hip_math.hip b/clang/test/Headers/__clang_hip_math.hip index 9a004ac06f083b..8440b3fa08d37a 100644 --- a/clang/test/Headers/__clang_hip_math.hip +++ b/clang/test/Headers/__clang_hip_math.hip @@ -8335,40 +8335,6 @@ extern "C" __device__ float test___exp10f(float x) { return __exp10f(x); } -// DEFAULT-LABEL: define dso_local noundef float @test___exp2f( -// DEFAULT-SAME: float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR3]] { -// DEFAULT-NEXT: [[ENTRY:.*:]] -// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[X]]) -// DEFAULT-NEXT: ret float [[TMP0]] -// -// FINITEONLY-LABEL: define dso_local noundef nofpclass(nan inf) float @test___exp2f( -// FINITEONLY-SAME: float noundef nofpclass(nan inf) [[X:%.*]]) local_unnamed_addr #[[ATTR3]] { -// FINITEONLY-NEXT: [[ENTRY:.*:]] -// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef nofpclass(nan inf) float @llvm.amdgcn.exp2.f32(float nofpclass(nan inf) [[X]]) -// FINITEONLY-NEXT: ret float [[TMP0]] -// -// APPROX-LABEL: define dso_local noundef float @test___exp2f( -// APPROX-SAME: float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR3]] { -// APPROX-NEXT: [[ENTRY:.*:]] -// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[X]]) -// APPROX-NEXT: ret float [[TMP0]] -// -// NCRDIV-LABEL: define dso_local noundef float @test___exp2f( -// NCRDIV-SAME: float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR3]] { -// NCRDIV-NEXT: [[ENTRY:.*:]] -// NCRDIV-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.amdgcn.exp2.f32(float [[X]]) -// NCRDIV-NEXT: ret float [[TMP0]] -// -// AMDGCNSPIRV-LABEL: define spir_func noundef float @test___exp2f( -// AMDGCNSPIRV-SAME: float noundef [[X:%.*]]) local_unnamed_addr addrspace(4) #[[ATTR3]] { -// AMDGCNSPIRV-NEXT: [[ENTRY:.*:]] -// AMDGCNSPIRV-NEXT: [[TMP0:%.*]] = tail call contract noundef addrspace(4) float @llvm.amdgcn.exp2.f32(float [[X]]) -// AMDGCNSPIRV-NEXT: ret float [[TMP0]] -// -extern "C" __device__ float test___exp2f(float x) { - return __exp2f(x); -} - // DEFAULT-LABEL: define dso_local noundef float @test___expf( // DEFAULT-SAME: float noundef [[X:%.*]]) local_unnamed_addr #[[ATTR3]] { // DEFAULT-NEXT: [[ENTRY:.*:]] _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
