[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/sign2.c sign2.reference_output arith.c
Guoling Han
han at autoesl.com
Fri Jan 26 19:02:29 PST 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer:
sign2.c added (r1.1)
sign2.reference_output added (r1.1)
arith.c updated: 1.7 -> 1.8
---
Log message:
---
Diffs of the changes: (+59 -0)
arith.c | 3 +++
sign2.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
sign2.reference_output | 7 +++++++
3 files changed, 59 insertions(+)
Index: llvm-test/SingleSource/UnitTests/Integer/sign2.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/sign2.c:1.1
*** /dev/null Fri Jan 26 21:02:23 2007
--- llvm-test/SingleSource/UnitTests/Integer/sign2.c Fri Jan 26 21:02:13 2007
***************
*** 0 ****
--- 1,49 ----
+ //===--- sign.c --- Test Cases for Bit Accurate Types --------------------===//
+ //
+ // This file was developed by Guoling Han and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This is another test for arithmetic operations with signed and
+ // unsigned operands.
+ //
+ //===----------------------------------------------------------------------===//
+ #include <stdio.h>
+
+ typedef int __attribute__ ((bitwidth(24))) int24;
+ typedef unsigned int __attribute__ ((bitwidth(24))) uint24;
+
+
+ int
+ main ( int argc, char** argv)
+ {
+ int num, r;
+ int24 x, y, z;
+ uint24 ux, uy, uz;
+
+ r = rand();
+ ux = r;
+ x = r;
+ printf("rand() = %d\n", r);
+
+ printf("ux = %u, x = %d\n", ux, x);
+
+ z = x / 4321;
+ uz = ux / (unsigned)4321;
+ printf("uz = %u, z = %d\n", uz, z);
+
+ y = x + 0x800000;
+ uy = x + 0x800000u;
+ printf("uy = %u, y = %d\n", uy, y);
+
+ z = y / x ;
+ uz = uy / ux ;
+ printf("ux = %u, x = %d\n", uz, z);
+
+ z = x / y ;
+ uz = ux / uy ;
+ printf("ux = %u, x = %d\n", uz, z);
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/sign2.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/sign2.reference_output:1.1
*** /dev/null Fri Jan 26 21:02:29 2007
--- llvm-test/SingleSource/UnitTests/Integer/sign2.reference_output Fri Jan 26 21:02:13 2007
***************
*** 0 ****
--- 1,7 ----
+ rand() = 1804289383
+ ux = 9127271, x = -7649945
+ uz = 2112, z = -1770
+ uy = 738663, y = 738663
+ ux = 0, x = 0
+ ux = 12, x = -10
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/arith.c
diff -u llvm-test/SingleSource/UnitTests/Integer/arith.c:1.7 llvm-test/SingleSource/UnitTests/Integer/arith.c:1.8
--- llvm-test/SingleSource/UnitTests/Integer/arith.c:1.7 Wed Jan 24 14:39:44 2007
+++ llvm-test/SingleSource/UnitTests/Integer/arith.c Fri Jan 26 21:02:13 2007
@@ -17,6 +17,8 @@
int21 y = 0x0fffff;
+
+
int my_test()
{
uint10 i = 0;
@@ -70,6 +72,7 @@
ui_y = y;
i_temp = ui_x - ui_y;
printf("i_temp = %x\n", i_temp);
+
return 0;
}
More information about the llvm-commits
mailing list