File tree Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Expand file tree Collapse file tree 3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -198,16 +198,17 @@ float nearbyintf(float x) { return __nv_nearbyintf(x); }
198198extern " C" SYCL_EXTERNAL float __nv_rintf (float );
199199DEVICE_EXTERN_C_INLINE
200200float rintf (float x) { return __nv_rintf (x); }
201- #endif // __NVPTX__
202-
203- #ifdef __AMDGCN__
201+ #elif defined(__AMDGCN__)
204202extern " C" SYCL_EXTERNAL float __ocml_nearbyint_f32 (float );
205203DEVICE_EXTERN_C_INLINE
206204float nearbyintf (float x) { return __ocml_nearbyint_f32 (x); }
207205
208206extern " C" SYCL_EXTERNAL float __ocml_rint_f32 (float );
209207DEVICE_EXTERN_C_INLINE
210208float rintf (float x) { return __ocml_rint_f32 (x); }
211- #endif // __AMDGCN__
209+ #else
210+ DEVICE_EXTERN_C_INLINE
211+ float rintf (float x) { return __spirv_ocl_rint (x); }
212+ #endif
212213
213214#endif // __SPIR__ || __SPIRV__ || __NVPTX__ || __AMDGCN__
Original file line number Diff line number Diff line change @@ -188,17 +188,18 @@ double nearbyint(double x) { return __nv_nearbyint(x); }
188188extern " C" SYCL_EXTERNAL double __nv_rint (double );
189189DEVICE_EXTERN_C_INLINE
190190double rint (double x) { return __nv_rint (x); }
191- #endif // __NVPTX__
192-
193- #ifdef __AMDGCN__
191+ #elif defined(__AMDGCN__)
194192extern " C" SYCL_EXTERNAL double __ocml_nearbyint_f64 (double );
195193DEVICE_EXTERN_C_INLINE
196194double nearbyint (double x) { return __ocml_nearbyint_f64 (x); }
197195
198196extern " C" SYCL_EXTERNAL double __ocml_rint_f64 (double );
199197DEVICE_EXTERN_C_INLINE
200198double rint (double x) { return __ocml_rint_f64 (x); }
201- #endif // __AMDGCN__
199+ #else
200+ DEVICE_EXTERN_C_INLINE
201+ double rint (double x) { return __spirv_ocl_rint (x); }
202+ #endif
202203
203204#if defined(_MSC_VER)
204205#include < math.h>
Original file line number Diff line number Diff line change 1+ REQUIRES: libsycldevice
2+
3+ Check functions in fp32 libdevice spirv file.
4+
5+ RUN: llvm-spirv --spirv-target-env=SPV-IR -r %libsycldevice_spv_dir/libsycl-cmath.spv -o %t.bc
6+ RUN: llvm-dis %t.bc -o %t.ll
7+ RUN: FileCheck %s --input-file %t.ll
8+
9+ CHECK: target triple ={{.*}}spir64
10+
11+ CHECK-LABEL: define spir_func float @rintf(
12+ CHECK: call spir_func float @_Z16__spirv_ocl_rintf(
You can’t perform that action at this time.
0 commit comments