Skip to content

Commit e1fa30d

Browse files
committed
clang/HIP: Inline frexp/frexpf implementations
Don't bother calling ocml. This stops setting the appropriate fast math flags, and requires this junk for passing to a private pointer.
1 parent 6269b8b commit e1fa30d

File tree

3 files changed

+472
-497
lines changed

3 files changed

+472
-497
lines changed

clang/lib/Headers/__clang_hip_math.h

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,15 +257,8 @@ float fmodf(float __x, float __y) { return __ocml_fmod_f32(__x, __y); }
257257

258258
__DEVICE__
259259
float frexpf(float __x, int *__nptr) {
260-
int __tmp;
261-
#ifdef __OPENMP_AMDGCN__
262-
#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
263-
#endif
264-
float __r =
265-
__ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
266-
*__nptr = __tmp;
267-
268-
return __r;
260+
*__nptr = __builtin_amdgcn_frexp_expf(__x);
261+
return __builtin_amdgcn_frexp_mantf(__x);
269262
}
270263

271264
__DEVICE__
@@ -813,14 +806,8 @@ double fmod(double __x, double __y) { return __ocml_fmod_f64(__x, __y); }
813806

814807
__DEVICE__
815808
double frexp(double __x, int *__nptr) {
816-
int __tmp;
817-
#ifdef __OPENMP_AMDGCN__
818-
#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
819-
#endif
820-
double __r =
821-
__ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
822-
*__nptr = __tmp;
823-
return __r;
809+
*__nptr = __builtin_amdgcn_frexp_exp(__x);
810+
return __builtin_amdgcn_frexp_mant(__x);
824811
}
825812

826813
__DEVICE__

0 commit comments

Comments
 (0)