[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile

2006-10-27 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

Makefile updated: 1.3 -> 1.4
---
Log message:

1. Add some comments about the seed values for the random number generate
2. Make the seed a constant value for reliable results.


---
Diffs of the changes:  (+9 -1)

 Makefile |   10 +-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile
diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 
llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.4
--- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.3 Fri Oct 27 
10:45:24 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Fri Oct 27 
11:37:45 2006
@@ -1,6 +1,14 @@
 # SingleSource/UnitTests/Vector/Makefile
 LEVEL = ../../..
+
+# You can use this seed value to get a different test
+# each day, but don't forget to 'make clean' To use it,
+# change RUN_OPTIONS (below) to be $(SEED)
 SEED := $(shell date +%j)
-RUN_OPTIONS := $(SEED)
+
+# Use a consistent seed value for the tests so they produce
+# the same results regardless of whether you make clean or not.
+RUN_OPTIONS := 31415926
+
 include $(LEVEL)/Makefile.config
 include $(LEVEL)/SingleSource/Makefile.singlesrc



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile div.c

2006-10-24 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

Makefile updated: 1.1 -> 1.2
div.c updated: 1.1 -> 1.2
---
Log message:

Fine-grainify the tests so the output will tell us specifically which 
optimization is failing.


---
Diffs of the changes:  (+76 -35)

 Makefile |2 -
 div.c|  109 +++
 2 files changed, 76 insertions(+), 35 deletions(-)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile
diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1 
llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.2
--- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1 Tue Oct 24 
19:27:48 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Tue Oct 24 
19:59:01 2006
@@ -1,5 +1,5 @@
 # SingleSource/UnitTests/Vector/Makefile
 LEVEL = ../../..
-
+PROG=div
 include $(LEVEL)/Makefile.config
 include $(LEVEL)/SingleSource/Makefile.singlesrc


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/div.c
diff -u llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1 
llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.2
--- llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1Tue Oct 24 
19:27:48 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/div.cTue Oct 24 
19:59:01 2006
@@ -8,51 +8,92 @@
 
 #include 
 
-unsigned 
-udivTest1(unsigned X, unsigned Y) {
-
-  unsigned Tally = 0;
+unsigned uDivTest1(unsigned X, unsigned Y) {
   /* 0 / X == 0 */
-  Tally += 0 / X;
-
+  return 0 / X;
+}
+unsigned uDivTest2(unsigned X, unsigned Y) {
   /* div X, 1 == X */
-  Tally += X / 1;
-
+  return X / 1;
+}
+unsigned uDivTest3(unsigned X, unsigned Y) {
   /* div X, -1 == -X */
-  Tally += X / -1;
-
+  return X / -1;
+}
+unsigned uDivTest4(unsigned X, unsigned Y) {
   /* div X, (Cond ? 0 : Y) -> div X, Y.  */
-  Tally += ( X == Y ? 0 : Y );
-  Tally += ( X == Y ? ((unsigned)0) : Y );
-
+  return ( X == Y ? 0 : Y );
+}
+unsigned uDivTest5(unsigned X, unsigned Y) {
+  /* div X, (Cond ? 0 : Y) -> div X, Y.  */
+  return ( X == Y ? ((unsigned)0) : Y );
+}
+unsigned uDivTest6(unsigned X, unsigned Y) {
   /* div X, (Cond ? Y : 0) -> div X, Y */
-  Tally += ( X != Y ? Y : 0 );
-  Tally += ( X != Y ? Y : ((unsigned)0) );
-
+  return ( X != Y ? Y : 0 );
+}
+unsigned uDivTest7(unsigned X, unsigned Y) {
+  /* div X, (Cond ? Y : 0) -> div X, Y */
+  return ( X != Y ? Y : ((unsigned)0) );
+}
+unsigned uDivTest8(unsigned X, unsigned Y) {
   /* (X / C1) / C2  -> X / (C1*C2) */
-  Tally += ( X / 2 ) / 4;
-  Tally += ( X / ((unsigned)2)) / ((unsigned)4);
-
+  return ( X / 2 ) / 4;
+}
+unsigned uDivTest9(unsigned X, unsigned Y) {
+  /* (X / C1) / C2  -> X / (C1*C2) */
+  return ( X / ((unsigned)2)) / ((unsigned)4);
+}
+unsigned uDivTest10(unsigned X, unsigned Y) {
   /* X udiv C^2 -> X >> C */
-  Tally += X / 4;
-  Tally += X / ((unsigned)4);
-
+  return X / 4;
+}
+unsigned uDivTest11(unsigned X, unsigned Y) {
+  /* X udiv C^2 -> X >> C */
+  return X / ((unsigned)4);
+}
+unsigned uDivTest12(unsigned X, unsigned Y) {
   /* X udiv (C1 << N), where C1 is "1<  X >> (N+C2) */
-  Tally += X / (4 << Y);
-  Tally += X / (((unsigned)4) << Y);
-
+  return X / (4 << Y);
+}
+unsigned uDivTest13(unsigned X, unsigned Y) {
+  /* X udiv (C1 << N), where C1 is "1<  X >> (N+C2) */
+  return X / (((unsigned)4) << Y);
+}
+unsigned uDivTest14(unsigned X, unsigned Y) {
   /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) */
-  Tally += X / (X == Y, 2, 4);
-  Tally += X / (X == Y, ((unsigned)2), ((unsigned)4));
-
+  return X / (X == Y, 2, 4);
+}
+unsigned uDivTest15(unsigned X, unsigned Y) {
+  /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) */
+  return X / (X == Y, ((unsigned)2), ((unsigned)4));
+}
+unsigned uDivTest16(unsigned X, unsigned Y) {
   /* -X/C -> X/-C */
-  Tally += -X / 2;
-  Tally += -X / ((unsigned)2);
-
-  return Tally;
+  return -X / 2;
+}
+unsigned uDivTest17(unsigned X, unsigned Y) {
+  /* -X/C -> X/-C */
+  return -X / ((unsigned)2);
 }
 
 int main(int argc, char**argv) {
-  unsigned result = udivTest1(42, 3);
-  printf("udivTest1(42,17) = %u\n", udivTest1(42,17));
+  printf("uDivTest1(42,3) = %u\n", uDivTest1(42,3));
+  printf("uDivTest2(42,3) = %u\n", uDivTest2(42,3));
+  printf("uDivTest3(42,3) = %u\n", uDivTest3(42,3));
+  printf("uDivTest4(42,3) = %u\n", uDivTest4(42,3));
+  printf("uDivTest5(42,3) = %u\n", uDivTest5(42,3));
+  printf("uDivTest6(42,3) = %u\n", uDivTest6(42,3));
+  printf("uDivTest7(42,3) = %u\n", uDivTest7(42,3));
+  printf("uDivTest8(42,3) = %u\n", uDivTest8(42,3));
+  printf("uDivTest9(42,3) = %u\n", uDivTest9(42,3));
+  printf("uDivTest10(42,3) = %u\n", uDivTest10(42,3));
+  printf("uDivTest11(42,3) = %u\n", uDivTest11(42,3));
+  printf("uDivTest12(42,3) = %u\n", uDivTest12(42,3));
+  printf("uDivTest13(42,3) = %u\n", uDivTest13(42,3));
+  printf("uDivTest14(42,3) = %u\n", uDivTest14(42,3));
+  printf("uDivTest15(42,3

[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile div.c

2006-10-24 Thread Reid Spencer


Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes:

Makefile added (r1.1)
div.c added (r1.1)
---
Log message:

Add a unit test directory for testing basic operations affected by the
Signless Types feature. This unit tests are aimed at making sure that
various InstCombine transforms continue to work correctly after the
SignlessTypes feature is implemented.


---
Diffs of the changes:  (+63 -0)

 Makefile |5 +
 div.c|   58 ++
 2 files changed, 63 insertions(+)


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile
diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile:1.1
*** /dev/null   Tue Oct 24 19:27:58 2006
--- llvm-test/SingleSource/UnitTests/SignlessTypes/Makefile Tue Oct 24 
19:27:48 2006
***
*** 0 
--- 1,5 
+ # SingleSource/UnitTests/Vector/Makefile
+ LEVEL = ../../..
+ 
+ include $(LEVEL)/Makefile.config
+ include $(LEVEL)/SingleSource/Makefile.singlesrc


Index: llvm-test/SingleSource/UnitTests/SignlessTypes/div.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/div.c:1.1
*** /dev/null   Tue Oct 24 19:28:03 2006
--- llvm-test/SingleSource/UnitTests/SignlessTypes/div.cTue Oct 24 
19:27:48 2006
***
*** 0 
--- 1,58 
+ /* 
+  * This file is used to test division operations in conjunction with
+  * the Signless Types feature. The DIV instruction was replaced with
+  * UDIV, SDIV and FDIV instructions. The tests here are aimed at
+  * triggering InstructionCombining transforms to exercise them and
+  * ensure they are not altering the computed values.
+  */
+ 
+ #include 
+ 
+ unsigned 
+ udivTest1(unsigned X, unsigned Y) {
+ 
+   unsigned Tally = 0;
+   /* 0 / X == 0 */
+   Tally += 0 / X;
+ 
+   /* div X, 1 == X */
+   Tally += X / 1;
+ 
+   /* div X, -1 == -X */
+   Tally += X / -1;
+ 
+   /* div X, (Cond ? 0 : Y) -> div X, Y.  */
+   Tally += ( X == Y ? 0 : Y );
+   Tally += ( X == Y ? ((unsigned)0) : Y );
+ 
+   /* div X, (Cond ? Y : 0) -> div X, Y */
+   Tally += ( X != Y ? Y : 0 );
+   Tally += ( X != Y ? Y : ((unsigned)0) );
+ 
+   /* (X / C1) / C2  -> X / (C1*C2) */
+   Tally += ( X / 2 ) / 4;
+   Tally += ( X / ((unsigned)2)) / ((unsigned)4);
+ 
+   /* X udiv C^2 -> X >> C */
+   Tally += X / 4;
+   Tally += X / ((unsigned)4);
+ 
+   /* X udiv (C1 << N), where C1 is "1<  X >> (N+C2) */
+   Tally += X / (4 << Y);
+   Tally += X / (((unsigned)4) << Y);
+ 
+   /* udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) 
*/
+   Tally += X / (X == Y, 2, 4);
+   Tally += X / (X == Y, ((unsigned)2), ((unsigned)4));
+ 
+   /* -X/C -> X/-C */
+   Tally += -X / 2;
+   Tally += -X / ((unsigned)2);
+ 
+   return Tally;
+ }
+ 
+ int main(int argc, char**argv) {
+   unsigned result = udivTest1(42, 3);
+   printf("udivTest1(42,17) = %u\n", udivTest1(42,17));
+ }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits