Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions libdevice/fallback-complex-fp64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ double __complex__ __devicelib_cexp(double __complex__ z) {
} else if (__spirv_IsNan(z_real)) {
if (z_imag == 0.0)
return z;
else /* z_imag != 0.0 */
return CMPLX(NAN, NAN);
} else if (__spirv_IsFinite(z_real)) {
if (__spirv_IsNan(z_imag) || __spirv_IsInf(z_imag))
return CMPLX(NAN, NAN);
return CMPLX(NAN, NAN);
} else if (__spirv_IsFinite(z_real) &&
(__spirv_IsNan(z_imag) || __spirv_IsInf(z_imag))) {
return CMPLX(NAN, NAN);
}
double __e = __spirv_ocl_exp(z_real);
double ret_real = __e * __spirv_ocl_cos(z_imag);
Expand Down
9 changes: 7 additions & 2 deletions libdevice/fallback-complex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ float __complex__ __devicelib_cexpf(float __complex__ z) {
z_imag = NAN;
return CMPLXF(z_real, z_imag);
}
} else if (__spirv_IsNan(z_real) && (z_imag == 0.0f)) {
return z;
} else if (__spirv_IsNan(z_real)) {
if (z_imag == 0.0f)
return z;
return CMPLX(NAN, NAN);
} else if (__spirv_IsFinite(z_real) &&
(__spirv_IsNan(z_imag) || __spirv_IsInf(z_imag))) {
return CMPLX(NAN, NAN);
}
float __e = __spirv_ocl_exp(z_real);
float ret_real = __e * __spirv_ocl_cos(z_imag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//
// REQUIRES: aspect-fp64
// UNSUPPORTED: hip || cuda
// UNSUPPORTED-INTENDED: This test is intended for backends with SPIR-V support.
//
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This test checks edge cases handling for std::exp(std::complex<float>) used
// in SYCL kernels.
//
// UNSUPPORTED: hip || cuda
// UNSUPPORTED-INTENDED: This test is intended for backends with SPIR-V support.
//
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include "exp-std-complex-edge-cases.hpp"

int main() { return test<float>(); }
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// tests to match the required format and in that case you should just update
// (i.e. reduce) the number and the list below.
//
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 478
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 477
//
// List of improperly UNSUPPORTED tests.
// Remove the CHECK once the test has been properly UNSUPPORTED.
Expand Down Expand Up @@ -113,7 +113,6 @@
// CHECK-NEXT: DeviceLib/cmath-aot.cpp
// CHECK-NEXT: DeviceLib/cmath_fp64_test.cpp
// CHECK-NEXT: DeviceLib/complex-fpga.cpp
// CHECK-NEXT: DeviceLib/exp/exp-std-complex-double-edge-cases.cpp
// CHECK-NEXT: DeviceLib/imf_bfloat16_integeral_convesions.cpp
// CHECK-NEXT: DeviceLib/imf_bfloat16_integeral_convesions.cpp
// CHECK-NEXT: DeviceLib/imf_double2bfloat16.cpp
Expand Down
Loading