Merge ../mesa into vulkan
[mesa.git] / src / gallium / auxiliary / util / u_format_tests.c
index 9f6d17c607d3f98cee39ce349042e5fede8bdd80..64224cd2e81cd5b870e50c11cf678990ede7195f 100644 (file)
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include <math.h>
 #include <float.h>
 
 #include "pipe/p_config.h"
@@ -66,9 +67,6 @@
        {{ 0,  0,  0,  0}, { 0,  0,  0,  0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
 
 
-#define NAN (0.0 / 0.0)
-#define INF (1.0 / 0.0)
-
 /**
  * Test cases.
  *
@@ -885,8 +883,13 @@ util_format_test_cases[] =
    /* Minimum positive normal */
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0400), UNPACKED_1x1( 6.10352E-5, 0.0, 0.0, 1.0)},
 
+   /* XXX: Now that we disable denormals this test cases fails, except on
+    * IvyBridge processors which have intrinsics dedicated to half-float
+    * packing/unpacking. */
+#if 0
    /* Max denormal */
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x03FF), UNPACKED_1x1( 6.09756E-5, 0.0, 0.0, 1.0)},
+#endif
 
    /* Minimum positive denormal */
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0001), UNPACKED_1x1( 5.96046E-8, 0.0, 0.0, 1.0)},
@@ -897,7 +900,7 @@ util_format_test_cases[] =
    /* Max representable value */
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7bff), UNPACKED_1x1(    65504.0, 0.0, 0.0, 1.0)},
 
-#if defined(PIPE_CC_MSVC)
+#if !defined(PIPE_CC_MSVC)
 
    /* NaNs */
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1(        NAN, 0.0, 0.0, 1.0)},
@@ -906,8 +909,8 @@ util_format_test_cases[] =
    {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(       -NAN, 0.0, 0.0, 1.0)},
 
    /* Inf */
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INF, 0.0, 0.0, 1.0)},
-   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INF, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(        INFINITY, 0.0, 0.0, 1.0)},
+   {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1(       -INFINITY, 0.0, 0.0, 1.0)},
 
 #endif