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

Reid Spencer reid at x10sys.com
Tue Oct 24 17:59:15 PDT 2006



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.1	Tue Oct 24 19:27:48 2006
+++ llvm-test/SingleSource/UnitTests/SignlessTypes/div.c	Tue Oct 24 19:59:01 2006
@@ -8,51 +8,92 @@
 
 #include <stdio.h>
 
-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<<C2"  -->  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<<C2"  -->  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) = %u\n", uDivTest15(42,3));
+  printf("uDivTest16(42,3) = %u\n", uDivTest16(42,3));
+  printf("uDivTest17(42,3) = %u\n", uDivTest17(42,3));
+  return 0;
 }






More information about the llvm-commits mailing list