[llvm-commits] [test-suite] r105240 - in /test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath: Makefile automotive-basicmath.reference_output basicmath.c isqrt.c snipmath.h

Daniel Dunbar daniel at zuster.org
Mon May 31 11:49:41 PDT 2010


Author: ddunbar
Date: Mon May 31 13:49:41 2010
New Revision: 105240

URL: http://llvm.org/viewvc/llvm-project?rev=105240&view=rev
Log:
Rewrite automotive-basicmath to use int instead of long for usqrt. It seemed to
be off by one on x86_64, and the code has things like '#define BITSPERLONG 32'
in it. This fixes the x86/x86_64 reference output mismatch.

Modified:
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/Makefile
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/automotive-basicmath.reference_output
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/basicmath.c
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/isqrt.c
    test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/snipmath.h

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/Makefile?rev=105240&r1=105239&r2=105240&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/Makefile (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/Makefile Mon May 31 13:49:41 2010
@@ -5,10 +5,4 @@
 FP_TOLERANCE :=  0.00000000001
 HASH_PROGRAM_OUTPUT = 1
 
-ifeq ($(ARCH),x86)
-ifdef USE_REFERENCE_OUTPUT
-EXEC_XFAILS = automative-basicmath
-endif
-endif
-
 include $(LEVEL)/MultiSource/Makefile.multisrc

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/automotive-basicmath.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/automotive-basicmath.reference_output?rev=105240&r1=105239&r2=105240&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/automotive-basicmath.reference_output (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/automotive-basicmath.reference_output Mon May 31 13:49:41 2010
@@ -1 +1 @@
-5f6171e839c432f37f60772635964b67
+e2f8545d34c3463584ce36ac6c00bd4a

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/basicmath.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/basicmath.c?rev=105240&r1=105239&r2=105240&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/basicmath.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/basicmath.c Mon May 31 13:49:41 2010
@@ -10,7 +10,7 @@
   double X;
   int     solutions;
   int i;
-  unsigned long l = 0x3fed0169L;
+  unsigned int l = 0x3fed0169;
   struct int_sqrt q;
   long n = 0;
 
@@ -100,7 +100,7 @@
 	     i, q.sqrt);
     }
   printf("\n");
-  for (l = 0x3fed0169L; l < 0x3fed4169L; l++)
+  for (l = 0x3fed0169; l < 0x3fed4169; l++)
     {
 	 usqrt(l, &q);
 	 //printf("\nsqrt(%lX) = %X, remainder = %X\n", l, q.sqrt, q.frac);

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/isqrt.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/isqrt.c?rev=105240&r1=105239&r2=105240&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/isqrt.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/isqrt.c Mon May 31 13:49:41 2010
@@ -5,11 +5,11 @@
 
 #define BITSPERLONG 32
 
-#define TOP2BITS(x) ((x & (3L << (BITSPERLONG-2))) >> (BITSPERLONG-2))
+#define TOP2BITS(x) ((x & (3 << (BITSPERLONG-2))) >> (BITSPERLONG-2))
 
 
 /* usqrt:
-    ENTRY x: unsigned long
+    ENTRY x: unsigned int
     EXIT  returns floor(sqrt(x) * pow(2, BITSPERLONG/2))
 
     Since the square root never uses more than half the bits
@@ -42,11 +42,11 @@
         This means it'll be fast on a wide range of processors.
 */
 
-void usqrt(unsigned long x, struct int_sqrt *q)
+void usqrt(unsigned int x, struct int_sqrt *q)
 {
-      unsigned long a = 0L;                   /* accumulator      */
-      unsigned long r = 0L;                   /* remainder        */
-      unsigned long e = 0L;                   /* trial product    */
+      unsigned int a = 0;                   /* accumulator      */
+      unsigned int r = 0;                   /* remainder        */
+      unsigned int e = 0;                   /* trial product    */
 
       int i;
 
@@ -61,7 +61,7 @@
                   a++;
             }
       }
-      memcpy(q, &a, sizeof(long));
+      memcpy(q, &a, sizeof(int));
 }
 
 #ifdef TEST

Modified: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/snipmath.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/snipmath.h?rev=105240&r1=105239&r2=105240&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/snipmath.h (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/snipmath.h Mon May 31 13:49:41 2010
@@ -69,7 +69,7 @@
                frac;
 };
 
-void usqrt(unsigned long x, struct int_sqrt *q);
+void usqrt(unsigned int x, struct int_sqrt *q);
 
 
 #endif /* SNIPMATH__H */





More information about the llvm-commits mailing list