jlebar created this revision. Herald added a subscriber: sanjoy. This function never worked -- the only reason the tests passed is because calls to this function were being DCE'ed. We're going to remove this broken function from clang, but first we need to remove it from the test-suite.
https://reviews.llvm.org/D40151 Files: External/CUDA/cmath.cu External/CUDA/math_h.cu
Index: External/CUDA/math_h.cu =================================================================== --- External/CUDA/math_h.cu +++ External/CUDA/math_h.cu @@ -87,7 +87,6 @@ __device__ Ambiguous lround(Ambiguous){ return Ambiguous(); } __device__ Ambiguous nearbyint(Ambiguous){ return Ambiguous(); } __device__ Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); } -__device__ Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); } __device__ Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); } __device__ Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); } __device__ Ambiguous rint(Ambiguous){ return Ambiguous(); } @@ -1363,39 +1362,20 @@ static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), ""); //assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074)); - // Invoke all our overloads, even if we can't be bothered to check the - // results. - nextafter(0, 1); - nextafter(0, 1.); - nextafter(0, 1.f); + // Invoke all our overloads. Even though we don't check the exact result + // (this is pretty annoying to do for this function), we make sure to *use* + // the results so that these function calls can't be DCE'ed. + assert(nextafter(0, 1) != 0); + assert(nextafter(0, 1.) != 0); + assert(nextafter(0, 1.f) != 0); - nextafter(0., 1); - nextafter(0., 1.); - nextafter(0., 1.f); + assert(nextafter(0., 1) != 0); + assert(nextafter(0., 1.) != 0); + assert(nextafter(0., 1.f) != 0); - nextafter(0.f, 1); - nextafter(0.f, 1.); - nextafter(0.f, 1.f); -} - -__device__ void test_nexttoward() -{ - static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), ""); - //assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074)); - - // Invoke all our overloads, even if we can't be bothered to check the - // results. - nexttoward(0, 1); - nexttoward(0, 1.); - nexttoward(0, 1.f); - - nexttoward(0., 1); - nexttoward(0., 1.); - nexttoward(0., 1.f); - - nexttoward(0.f, 1); - nexttoward(0.f, 1.); - nexttoward(0.f, 1.f); + assert(nextafter(0.f, 1) != 0); + assert(nextafter(0.f, 1.) != 0); + assert(nextafter(0.f, 1.f) != 0); } __device__ void test_remainder() @@ -1648,7 +1628,6 @@ test_nan(); test_nearbyint(); test_nextafter(); - test_nexttoward(); test_remainder(); test_remquo(); test_rint(); Index: External/CUDA/cmath.cu =================================================================== --- External/CUDA/cmath.cu +++ External/CUDA/cmath.cu @@ -89,7 +89,6 @@ __device__ Ambiguous lround(Ambiguous){ return Ambiguous(); } __device__ Ambiguous nearbyint(Ambiguous){ return Ambiguous(); } __device__ Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); } -__device__ Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); } __device__ Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); } __device__ Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); } __device__ Ambiguous rint(Ambiguous){ return Ambiguous(); } @@ -1387,38 +1386,20 @@ static_assert((std::is_same<decltype(std::nextafter((int)0, (int)0)), double>::value), ""); static_assert((std::is_same<decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous>::value), ""); - // Invoke all our overloads, even if we can't be bothered to check the - // results. - std::nextafter(0, 1); - std::nextafter(0, 1.); - std::nextafter(0, 1.f); + // Invoke all our overloads. Even though we don't check the exact result + // (this is pretty annoying to do for this function), we make sure to *use* + // the results so that these function calls can't be DCE'ed. + assert(std::nextafter(0, 1) != 0); + assert(std::nextafter(0, 1.) != 0); + assert(std::nextafter(0, 1.f) != 0); - std::nextafter(0., 1); - std::nextafter(0., 1.); - std::nextafter(0., 1.f); + assert(std::nextafter(0., 1) != 0); + assert(std::nextafter(0., 1.) != 0); + assert(std::nextafter(0., 1.f) != 0); - std::nextafter(0.f, 1); - std::nextafter(0.f, 1.); - std::nextafter(0.f, 1.f); -} - -__device__ void test_nexttoward() -{ - static_assert((std::is_same<decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous>::value), ""); - - // Invoke all our overloads, even if we can't be bothered to check the - // results. - std::nexttoward(0, 1); - std::nexttoward(0, 1.); - std::nexttoward(0, 1.f); - - std::nexttoward(0., 1); - std::nexttoward(0., 1.); - std::nexttoward(0., 1.f); - - std::nexttoward(0.f, 1); - std::nexttoward(0.f, 1.); - std::nexttoward(0.f, 1.f); + assert(std::nextafter(0.f, 1) != 0); + assert(std::nextafter(0.f, 1.) != 0); + assert(std::nextafter(0.f, 1.f) != 0); } __device__ void test_remainder() @@ -1671,7 +1652,6 @@ test_nan(); test_nearbyint(); test_nextafter(); - test_nexttoward(); test_remainder(); test_remquo(); test_rint();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits