[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp bigint.cpp bitlogic.cpp sign.cpp

Zhou Sheng zhousheng00 at gmail.com
Mon Feb 5 19:02:31 PST 2007



Changes in directory llvm-test/SingleSource/UnitTests/Integer/APInt:

arith.cpp updated: 1.1 -> 1.2
bigint.cpp updated: 1.1 -> 1.2
bitlogic.cpp updated: 1.1 -> 1.2
sign.cpp updated: 1.1 -> 1.2
---
Log message:

Modify these test cases as APInt changed.


---
Diffs of the changes:  (+41 -40)

 arith.cpp    |   36 ++++++++++++++++++------------------
 bigint.cpp   |   16 ++++++++--------
 bitlogic.cpp |   10 +++++-----
 sign.cpp     |   19 ++++++++++---------
 4 files changed, 41 insertions(+), 40 deletions(-)


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.2
--- llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp:1.1	Mon Jan 29 17:07:32 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/arith.cpp	Mon Feb  5 21:02:16 2007
@@ -14,61 +14,61 @@
 
 using namespace llvm;
 
-APInt x(21,0x1fffff);
+APInt x(0x1fffff, 21);
 
-APInt y(21,0x0fffff);
+APInt y(0x0fffff, 21);
 
 int my_test()
 {
-  APInt i(10,uint64_t(0));
-  APInt j(10);
-  APInt k(10);
-  APInt l(10);
-  APInt result(21);
+  APInt i(uint64_t(0), 10);
+  APInt j(0, 10);
+  APInt k(0, 10);
+  APInt l(0, 10);
+  APInt result(0, 21);
   short temp;
   int i_temp;
   unsigned int ui_x;
   unsigned int ui_y;
   j = i;
   j -= 1;
-  temp = (short)j;
+  temp = (short)j.getValue();
   printf( "temp = %hd\n", temp);
   k = i;
   k += 1;
-  temp = k;
+  temp = k.getValue();
   printf( "temp = %hd\n", temp);
   k = j * k;
-  temp = k;
+  temp = k.getValue();
   printf( "temp = %hd\n", temp);
   j *= 120;
   l = j / k;
-  temp = l;
+  temp = l.getValue();
   printf( "temp = %hd\n", temp);
   j *= (-176); // after truncation, the value should be -384
   l = j / k;
-  temp = l;
+  temp = l.getValue();
   printf( "temp = %hd\n", temp);
   l = 120;
   l = (j * l);
   l %= 4;
-  temp = l;
+  temp = l.getValue();
   printf( "temp = %hd\n", temp);
   l = -217;
   l = (j * l);
   l = l / (++i);
-  temp = l;
+  temp = l.getValue();
   printf( "temp = %hd\n", temp);
   result = ++x;
   
-  i_temp = result;
+  i_temp = result.getValue();
   printf( "i_temp = %x\n", i_temp);
   x--;
  
   result = x + y;
-  i_temp = result;
+  i_temp = result.getValue();
   printf("i_temp = %x\n", i_temp);
-  ui_x = x;
-  ui_y = y;
+  ui_x = x.getValue();
+  ui_y = y.getValue();
   i_temp = ui_x - ui_y;
   printf("i_temp = %x\n", i_temp);
 


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/bigint.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/bigint.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/APInt/bigint.cpp:1.2
--- llvm-test/SingleSource/UnitTests/Integer/APInt/bigint.cpp:1.1	Mon Jan 29 17:07:32 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/bigint.cpp	Mon Feb  5 21:02:16 2007
@@ -13,17 +13,17 @@
 
 using namespace llvm;
 
-const APInt bnd(10,1023);
+const APInt bnd(1023, 10);
 
 
-APInt x(169, 0xffffffffULL);
-APInt y(169, -0xabcdefdeULL);
+APInt x(0xffffffffULL, 169);
+APInt y(-0xabcdefdeULL, 169);
 
 int my_test()
 {
-  APInt i(10,uint64_t(0));
-  APInt result(169);
-  APInt l_result(32);
+  APInt i(uint64_t(0), 10);
+  APInt result(0, 169);
+  APInt l_result(0, 32);
   long long rem;
   long long rem2;
   {
@@ -41,11 +41,11 @@
   }
   result = x*y;
   l_result = result % 0x37015; 
-  rem = l_result;
+  rem = l_result.getValue();
   printf("rem = %lld\n", rem);
 
   l_result = result % -198721;
-  rem2 = l_result;
+  rem2 = l_result.getValue();
   printf("rem2 = %lld\n", rem2);
   return 0;
 }


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp:1.2
--- llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp:1.1	Mon Jan 29 19:10:43 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/bitlogic.cpp	Mon Feb  5 21:02:16 2007
@@ -16,11 +16,11 @@
 
 int my_test()
 {
-  APInt x(1,0x1);
-  APInt y(1);
-  APInt z(9,0x1ff);
-  APInt uz(9,0x1ff);
-  APInt temp(9);
+  APInt x(0x1, 1);
+  APInt y(0, 1);
+  APInt z(0x1ff, 9);
+  APInt uz(0x1ff, 9);
+  APInt temp(0, 9);
   y = x;
   y -= 1;
   if (!y)


Index: llvm-test/SingleSource/UnitTests/Integer/APInt/sign.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/APInt/sign.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/APInt/sign.cpp:1.2
--- llvm-test/SingleSource/UnitTests/Integer/APInt/sign.cpp:1.1	Mon Jan 29 19:08:52 2007
+++ llvm-test/SingleSource/UnitTests/Integer/APInt/sign.cpp	Mon Feb  5 21:02:16 2007
@@ -19,8 +19,8 @@
 main ( int argc, char** argv)
 {
   int num, r;
-  APInt x(24), y(24), z(24);
-  APInt ux(24), uy(24), uz(24);
+  APInt x(0, 24, true), y(0, 24, true), z(0, 24, true);
+  APInt ux(0, 24), uy(0, 24), uz(0, 24);
 
   r = rand();
   r = r - 1804289384; // -1
@@ -36,28 +36,29 @@
 
   x = num;
   ux = num;
-  printf("x = %d, ux = %u, y=%d, uy = %u\n", int(x), (unsigned int)ux, 
-         int(y), (unsigned int)uy);
+  printf("x = %d, ux = %u, y=%d, uy = %u\n", int(x.getValue()), 
+         (unsigned int)ux.getValue(), int(y.getValue()), 
+         (unsigned int)uy.getValue());
     
   z = x * y;  // 0x1000001 * (-1)
   uz = ux * uy;
-  printf("z=%d, uz=%u\n", int(z), (unsigned int)uz);
+  printf("z=%d, uz=%u\n", int(z.getValue()), (unsigned int)uz.getValue());
 
   z = x % 314;
   uz = ux % 314;
-  printf("z=%d, uz=%u\n", int(z), (unsigned int)uz);
+  printf("z=%d, uz=%u\n", int(z.getValue()), (unsigned int)uz.getValue());
 
   z = x / 314;
   uz = ux / 314;
-  printf("z=%d, uz=%u\n", int(z), (unsigned int)uz);
+  printf("z=%d, uz=%u\n", int(z.getValue()), (unsigned int)uz.getValue());
 
   z = (x+0xf28) / 314;
   uz = (ux + 0xf28) / 314;
-  printf("z=%d, uz=%u\n", int(z), (unsigned int)uz);
+  printf("z=%d, uz=%u\n", int(z.getValue()), (unsigned int)uz.getValue());
 
   z = (x - 580) / 314;
   uz = (((ux - 580)) / 314);
-  printf("z=%d, uz=%u\n", int(z), (unsigned int)uz);
+  printf("z=%d, uz=%u\n", int(z.getValue()), (unsigned int)uz.getValue());
 
   return 0;
 }






More information about the llvm-commits mailing list