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); }
198
198
extern " C" SYCL_EXTERNAL float __nv_rintf (float );
199
199
DEVICE_EXTERN_C_INLINE
200
200
float rintf (float x) { return __nv_rintf (x); }
201
- #endif // __NVPTX__
202
-
203
- #ifdef __AMDGCN__
201
+ #elif defined(__AMDGCN__)
204
202
extern " C" SYCL_EXTERNAL float __ocml_nearbyint_f32 (float );
205
203
DEVICE_EXTERN_C_INLINE
206
204
float nearbyintf (float x) { return __ocml_nearbyint_f32 (x); }
207
205
208
206
extern " C" SYCL_EXTERNAL float __ocml_rint_f32 (float );
209
207
DEVICE_EXTERN_C_INLINE
210
208
float 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
212
213
213
214
#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); }
188
188
extern " C" SYCL_EXTERNAL double __nv_rint (double );
189
189
DEVICE_EXTERN_C_INLINE
190
190
double rint (double x) { return __nv_rint (x); }
191
- #endif // __NVPTX__
192
-
193
- #ifdef __AMDGCN__
191
+ #elif defined(__AMDGCN__)
194
192
extern " C" SYCL_EXTERNAL double __ocml_nearbyint_f64 (double );
195
193
DEVICE_EXTERN_C_INLINE
196
194
double nearbyint (double x) { return __ocml_nearbyint_f64 (x); }
197
195
198
196
extern " C" SYCL_EXTERNAL double __ocml_rint_f64 (double );
199
197
DEVICE_EXTERN_C_INLINE
200
198
double 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
202
203
203
204
#if defined(_MSC_VER)
204
205
#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