[test-suite] r318492 - [CUDA] [test-suite] Remove references to nexttoward in CUDA tests.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 17:14:04 PST 2017


Author: jlebar
Date: Thu Nov 16 17:14:04 2017
New Revision: 318492

URL: http://llvm.org/viewvc/llvm-project?rev=318492&view=rev
Log:
[CUDA] [test-suite] Remove references to nexttoward in CUDA tests.

Summary:
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.

Reviewers: tra

Subscribers: sanjoy, cfe-commits

Differential Revision: https://reviews.llvm.org/D40151

Modified:
    test-suite/trunk/External/CUDA/cmath.cu
    test-suite/trunk/External/CUDA/math_h.cu

Modified: test-suite/trunk/External/CUDA/cmath.cu
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/cmath.cu?rev=318492&r1=318491&r2=318492&view=diff
==============================================================================
--- test-suite/trunk/External/CUDA/cmath.cu (original)
+++ test-suite/trunk/External/CUDA/cmath.cu Thu Nov 16 17:14:04 2017
@@ -89,7 +89,6 @@ __device__ Ambiguous lrint(Ambiguous){ r
 __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 @@ __device__ void test_nextafter()
     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);
-
-    std::nextafter(0., 1);
-    std::nextafter(0., 1.);
-    std::nextafter(0., 1.f);
-
-    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);
+    // 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);
+
+    assert(std::nextafter(0., 1) != 0);
+    assert(std::nextafter(0., 1.) != 0);
+    assert(std::nextafter(0., 1.f) != 0);
+
+    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 @@ __global__ void tests()
     test_nan();
     test_nearbyint();
     test_nextafter();
-    test_nexttoward();
     test_remainder();
     test_remquo();
     test_rint();

Modified: test-suite/trunk/External/CUDA/math_h.cu
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/math_h.cu?rev=318492&r1=318491&r2=318492&view=diff
==============================================================================
--- test-suite/trunk/External/CUDA/math_h.cu (original)
+++ test-suite/trunk/External/CUDA/math_h.cu Thu Nov 16 17:14:04 2017
@@ -87,7 +87,6 @@ __device__ Ambiguous lrint(Ambiguous){ r
 __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 @@ __device__ void test_nextafter()
     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);
-
-    nextafter(0., 1);
-    nextafter(0., 1.);
-    nextafter(0., 1.f);
-
-    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);
+    // 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);
+
+    assert(nextafter(0., 1) != 0);
+    assert(nextafter(0., 1.) != 0);
+    assert(nextafter(0., 1.f) != 0);
+
+    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 @@ __global__ void tests()
     test_nan();
     test_nearbyint();
     test_nextafter();
-    test_nexttoward();
     test_remainder();
     test_remquo();
     test_rint();




More information about the llvm-commits mailing list