1- // UNSUPPORTED: windows
2- // Disabled on windows due to bug VS 2019 missing math builtins
1+ // REQUIRES: windows
32
4- // REQUIRES: (accelerator || cpu) && windows
5- // RUN: %{build} -c -o %t.o
6- // RUN: %clangxx -fsycl %t.o %sycl_libs_dir/../bin/libsycl-cmath.o -o %t.out
3+ // TODO: Add hypotf case back when the missing symbol is fixed.
4+
5+ // DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}
6+
7+ // RUN: %{build} %{mathflags} -o %t.out
78// RUN: %{run} %t.out
9+
10+ // RUN: %clangxx -fsycl -fsycl-device-lib-jit-link %{mathflags} %s -o %t.out
11+ // RUN: %if !gpu %{ %{run} %t.out %}
12+
813#include " math_utils.hpp"
914#include < iostream>
1015#include < math.h>
@@ -14,11 +19,11 @@ namespace s = sycl;
1419constexpr s::access::mode sycl_read = s::access::mode::read;
1520constexpr s::access::mode sycl_write = s::access::mode::write;
1621
17- #define TEST_NUM 39
22+ #define TEST_NUM 35
1823
19- float ref_val[TEST_NUM] = {1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0.5 , 0 , 0 , 1 ,
20- 0 , 2 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 2 , 0 , 1 ,
21- 2 , 5 , 0 , 0 , 0 , 0 , 0.5 , 0.5 , NAN, NAN, 1 , 2 , 0 };
24+ float ref_val[TEST_NUM] = {1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0.5 , 0 , 0 ,
25+ 1 , 0 , 2 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 2 ,
26+ 0 , 1 , 2 , 0 , 0 , 0 , 0 , 0.5 , 0.5 , NAN, NAN};
2227
2328float refIptr = 1 ;
2429
@@ -33,13 +38,13 @@ void device_math_test(s::queue &deviceQueue) {
3338 int quo = -1 ;
3439
3540 // Varaible enm stores the enum value retured by MSVC function
36- short enm[ 2 ] = { 10 , 10 } ;
41+ short enm = 10 ;
3742
3843 {
3944 s::buffer<float , 1 > buffer1 (result, numOfItems);
4045 s::buffer<float , 1 > buffer2 (&iptr, s::range<1 >{1 });
4146 s::buffer<int , 1 > buffer3 (&quo, s::range<1 >{1 });
42- s::buffer<short , 1 > buffer4 (enm, s::range<1 >{2 });
47+ s::buffer<short , 1 > buffer4 (& enm, s::range<1 >{1 });
4348 deviceQueue.submit ([&](sycl::handler &cgh) {
4449 auto res_access = buffer1.template get_access <sycl_write>(cgh);
4550 auto iptr_access = buffer2.template get_access <sycl_write>(cgh);
@@ -74,7 +79,6 @@ void device_math_test(s::queue &deviceQueue) {
7479 res_access[i++] = expm1f (0 .0f );
7580 res_access[i++] = fdimf (1 .0f , 0 .0f );
7681 res_access[i++] = fmaf (1 .0f , 1 .0f , 1 .0f );
77- res_access[i++] = hypotf (3 .0f , 4 .0f );
7882 res_access[i++] = ilogbf (1 .0f );
7983 res_access[i++] = log1pf (0 .0f );
8084 res_access[i++] = log2f (1 .0f );
@@ -84,12 +88,7 @@ void device_math_test(s::queue &deviceQueue) {
8488 float a = NAN;
8589 res_access[i++] = tgammaf (a);
8690 res_access[i++] = lgammaf (a);
87- enm_access[0 ] = _FDtest (&a);
88- a = 0 .0f ;
89- enm_access[1 ] = _FExp (&a, 1 .0f , 0 );
90- res_access[i++] = a;
91- res_access[i++] = _FCosh (0 .0f , 2 .0f );
92- res_access[i++] = _FSinh (0 .0f , 1 .0f );
91+ enm_access[0 ] = _fdtest (&a);
9392 });
9493 });
9594 }
@@ -106,10 +105,7 @@ void device_math_test(s::queue &deviceQueue) {
106105 assert (quo == 0 );
107106
108107 // Test enum value returned by _FDtest
109- assert (enm[0 ] == _NANCODE);
110-
111- // Test enum value returned by _FExp
112- assert (enm[1 ] == _FINITE);
108+ assert (enm == _NANCODE);
113109}
114110
115111int main () {
0 commit comments