[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c SSAtest.reference_output arith.c arith.h arith.reference_output array.c array.h array.reference_output bigint.c bigint.h bigint.reference_output bitbit.c bitbit.h bitbit.reference_output bitlogic.c bitlogic.h bitlogic.reference_output cond-expr.c cond-expr.reference_output cppfield.cpp cppfield.reference_output enum.cpp enum.reference_output exception.cpp exception.reference_output extern-inline-redef.c extern-inline-redef.reference_output field.c field.reference_output folding.c folding.reference_output global.c global.reference_output large-array.c large-array.reference_output list.c list.reference_output local-array.c local-array.reference_output local-union.c local-union.reference_output matrix.c matrix.h matrix.reference_output memory.c memory.reference_output offset.c offset.reference_output override.cpp override.reference_output pointer.c pointer.reference_output static.c static.reference_output struct1! .c struct1.reference_output struct2.c struct2.reference_output structInit.c structInit.reference_output switch.c switch.reference_output template.cpp template.reference_output template2.cpp template2.reference_output template3.cpp template3.reference_output union-init.c union-init.reference_output union-struct.c union-struct.reference_output union2.c union2.reference_output Makefile
Reid Spencer
reid at x10sys.com
Thu Jan 18 18:23:02 PST 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer:
SSAtest.c added (r1.1)
SSAtest.reference_output added (r1.1)
arith.c added (r1.1)
arith.h added (r1.1)
arith.reference_output added (r1.1)
array.c added (r1.1)
array.h added (r1.1)
array.reference_output added (r1.1)
bigint.c added (r1.1)
bigint.h added (r1.1)
bigint.reference_output added (r1.1)
bitbit.c added (r1.1)
bitbit.h added (r1.1)
bitbit.reference_output added (r1.1)
bitlogic.c added (r1.1)
bitlogic.h added (r1.1)
bitlogic.reference_output added (r1.1)
cond-expr.c added (r1.1)
cond-expr.reference_output added (r1.1)
cppfield.cpp added (r1.1)
cppfield.reference_output added (r1.1)
enum.cpp added (r1.1)
enum.reference_output added (r1.1)
exception.cpp added (r1.1)
exception.reference_output added (r1.1)
extern-inline-redef.c added (r1.1)
extern-inline-redef.reference_output added (r1.1)
field.c added (r1.1)
field.reference_output added (r1.1)
folding.c added (r1.1)
folding.reference_output added (r1.1)
global.c added (r1.1)
global.reference_output added (r1.1)
large-array.c added (r1.1)
large-array.reference_output added (r1.1)
list.c added (r1.1)
list.reference_output added (r1.1)
local-array.c added (r1.1)
local-array.reference_output added (r1.1)
local-union.c added (r1.1)
local-union.reference_output added (r1.1)
matrix.c added (r1.1)
matrix.h added (r1.1)
matrix.reference_output added (r1.1)
memory.c added (r1.1)
memory.reference_output added (r1.1)
offset.c added (r1.1)
offset.reference_output added (r1.1)
override.cpp added (r1.1)
override.reference_output added (r1.1)
pointer.c added (r1.1)
pointer.reference_output added (r1.1)
static.c added (r1.1)
static.reference_output added (r1.1)
struct1.c added (r1.1)
struct1.reference_output added (r1.1)
struct2.c added (r1.1)
struct2.reference_output added (r1.1)
structInit.c added (r1.1)
structInit.reference_output added (r1.1)
switch.c added (r1.1)
switch.reference_output added (r1.1)
template.cpp added (r1.1)
template.reference_output added (r1.1)
template2.cpp added (r1.1)
template2.reference_output added (r1.1)
template3.cpp added (r1.1)
template3.reference_output added (r1.1)
union-init.c added (r1.1)
union-init.reference_output added (r1.1)
union-struct.c added (r1.1)
union-struct.reference_output added (r1.1)
union2.c added (r1.1)
union2.reference_output added (r1.1)
Makefile updated: 1.4 -> 1.5
---
Log message:
C and C++ unit tests for arbitrary precision integers. This test suite
is not functioning yet and is being committed for easier patch generation.
Test suite by Guoling Han (Leo).
---
Diffs of the changes: (+1469 -2)
Makefile | 6 +
SSAtest.c | 25 +++++++
SSAtest.reference_output | 2
arith.c | 73 ++++++++++++++++++++++
arith.h | 9 ++
arith.reference_output | 11 +++
array.c | 40 ++++++++++++
array.h | 6 +
array.reference_output | 10 +++
bigint.c | 54 ++++++++++++++++
bigint.h | 8 ++
bigint.reference_output | 3
bitbit.c | 74 ++++++++++++++++++++++
bitbit.h | 6 +
bitbit.reference_output | 10 +++
bitlogic.c | 45 +++++++++++++
bitlogic.h | 9 ++
bitlogic.reference_output | 5 +
cond-expr.c | 17 +++++
cond-expr.reference_output | 2
cppfield.cpp | 47 ++++++++++++++
cppfield.reference_output | 1
enum.cpp | 29 ++++++++
enum.reference_output | 2
exception.cpp | 46 ++++++++++++++
exception.reference_output | 2
extern-inline-redef.c | 19 +++++
extern-inline-redef.reference_output | 1
field.c | 33 ++++++++++
field.reference_output | 1
folding.c | 28 ++++++++
folding.reference_output | 1
global.c | 28 ++++++++
global.reference_output | 2
large-array.c | 40 ++++++++++++
large-array.reference_output | 1
list.c | 52 +++++++++++++++
list.reference_output | 1
local-array.c | 22 ++++++
local-array.reference_output | 1
local-union.c | 21 ++++++
local-union.reference_output | 2
matrix.c | 114 +++++++++++++++++++++++++++++++++++
matrix.h | 6 +
matrix.reference_output | 65 +++++++++++++++++++
memory.c | 40 ++++++++++++
memory.reference_output | 1
offset.c | 17 +++++
offset.reference_output | 2
override.cpp | 19 +++++
override.reference_output | 2
pointer.c | 25 +++++++
pointer.reference_output | 1
static.c | 24 +++++++
static.reference_output | 1
struct1.c | 19 +++++
struct1.reference_output | 2
struct2.c | 29 ++++++++
struct2.reference_output | 1
structInit.c | 24 +++++++
structInit.reference_output | 4 +
switch.c | 39 +++++++++++
switch.reference_output | 1
template.cpp | 47 ++++++++++++++
template.reference_output | 4 +
template2.cpp | 53 ++++++++++++++++
template2.reference_output | 3
template3.cpp | 38 +++++++++++
template3.reference_output | 7 ++
union-init.c | 32 +++++++++
union-init.reference_output | 2
union-struct.c | 21 ++++++
union-struct.reference_output | 1
union2.c | 31 +++++++++
union2.reference_output | 1
75 files changed, 1469 insertions(+), 2 deletions(-)
Index: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.1
*** /dev/null Thu Jan 18 20:22:56 2007
--- llvm-test/SingleSource/UnitTests/Integer/SSAtest.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,25 ----
+
+ typedef int __attribute__ ((bitwidth(4))) int4;
+
+ int4 bar()
+ {
+ return 0xf;
+ }
+
+ int4 foo()
+ {
+ int4 a,b,c;
+ b = 0;
+ c = 0;
+ a = b + c;
+ b = bar();
+ c = bar();
+ printf("result = %d\n", a + b + c);
+ }
+
+
+ int main()
+ {
+ foo();
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/SSAtest.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/SSAtest.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/SSAtest.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ result = -2
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/arith.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/arith.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/arith.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,73 ----
+
+ // Date: Fri Jan 12 17:19:09 CST 2007
+ #include "arith.h"
+
+
+ int21 x = 0x1fffff;
+
+ int21 y = 0x0fffff;
+ // Module | Test
+ // Thread: int my_test();
+ int my_test(){
+ {
+ uint10 i = 0;
+ int10 j;
+ int10 k;
+ int10 l;
+ int21 result;
+ short temp;
+ int i_temp;
+ unsigned int ui_x;
+ unsigned int ui_y;
+ j = i;
+ j -= 1;
+ temp = j;
+ printf( "temp = %hd\n", temp);
+ k = i;
+ k += 1;
+ temp = k;
+ printf( "temp = %hd\n", temp);
+ k = j * k;
+ temp = k;
+ printf( "temp = %hd\n", temp);
+ j *= 120;
+ l = j / k;
+ temp = l;
+ printf( "temp = %hd\n", temp);
+ j *= (-176);
+ l = j / k;
+ temp = l;
+ printf( "temp = %hd\n", temp);
+ l = 120;
+ l = (j * l);
+ l %= 4;
+ temp = l;
+ printf( "temp = %hd\n", temp);
+ l = -217;
+ l = (j * l);
+ l = l / (++i);
+ temp = l;
+ printf( "temp = %hd\n", temp);
+ result = ++x;
+
+ i_temp = result;
+ printf( "i_temp = %x\n", i_temp);
+ x--;
+
+ result = x + y;
+ i_temp = result;
+ printf("i_temp = %x\n", i_temp);
+ ui_x = x;
+ ui_y = y;
+ i_temp = ui_x - ui_y;
+ printf("i_temp = %x\n", i_temp);
+ return 0;
+ }
+ }
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/arith.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/arith.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/arith.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,9 ----
+
+ // Date: Fri Jan 12 17:19:09 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef int __attribute__ ((bitwidth(21))) int21;
+ typedef unsigned int __attribute__ ((bitwidth(10))) uint10;
+ typedef int __attribute__ ((bitwidth(10))) int10;
+
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/arith.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/arith.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/arith.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,11 ----
+ temp = -1
+ temp = 1
+ temp = -1
+ temp = 120
+ temp = 384
+ temp = 0
+ temp = 384
+ i_temp = 0
+ i_temp = ffffe
+ i_temp = fff00000
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/array.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/array.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/array.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,40 ----
+
+ #include "array.h"
+
+ typedef enum bool{false=0, true=1} bool;
+
+ int my_test(){
+ {
+ int33 array[8];
+ unsigned int i = 0;
+ long long tmp;
+ {
+ i = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_1 = (i < 8);
+ if (!ssdm_tmp_1) break;
+ {
+ array[i] = -(i + 1);
+ tmp = array[i];
+ printf("i=%u: %x\n", i, tmp);
+ }
+ ++i;
+ }
+ }
+ int33* ptr;
+ ptr = &array[7];
+ *ptr = array[1] % array[0];
+ tmp = *ptr;
+ printf("%x\n", tmp);
+ return 0;
+ }
+ }
+
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/array.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/array.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/array.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,6 ----
+
+ // Date: Fri Jan 12 17:41:26 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef int __attribute__ ((bitwidth(33))) int33;
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/array.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/array.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/array.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,10 ----
+ i=0: ffffffff
+ i=1: fffffffe
+ i=2: fffffffd
+ i=3: fffffffc
+ i=4: fffffffb
+ i=5: fffffffa
+ i=6: fffffff9
+ i=7: fffffff8
+ fffffffe
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/bigint.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bigint.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,54 ----
+
+ // Date: Fri Jan 12 17:25:23 CST 2007
+ #include "bigint.h"
+
+ typedef enum bool{false=0, true=1} bool;
+
+ const uint10 bnd = 1023;
+
+
+ int169 x = 0xffffffff;
+
+ int169 y = -0xabcdefde;
+ // Module | Test
+ // Thread: int my_test();
+ int my_test(){
+ {
+ uint10 i = 0;
+ int169 result;
+ int32 l_result;
+ long long rem;
+ long long rem2;
+ {
+ ;/*NULL statement*/
+ for ( ; ; ) {
+ bool ssdm_tmp_1 = (i < bnd);
+ if (!ssdm_tmp_1) break;
+ if (i % 2 == 0
+ x = x + 1;
+ else
+ y = y - x;
+
+ ++i;
+ }
+ }
+ result = x*y;
+ l_result = result % 0x37015;
+ rem = l_result;
+ printf("rem = %lld\n", rem);
+
+ l_result = result % -198721;
+ rem2 = l_result;
+ printf("rem2 = %lld\n", rem2);
+ return 0;
+ }
+ }
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+
+
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/bigint.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bigint.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bigint.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,8 ----
+
+ // Date: Fri Jan 12 17:25:23 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef unsigned int __attribute__ ((bitwidth(10))) uint10;
+ typedef int __attribute__ ((bitwidth(169))) int169;
+ typedef int __attribute__ ((bitwidth(32))) int32;
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bigint.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,3 ----
+ rem = -56805
+ rem2 = -97569
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/bitbit.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitbit.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,74 ----
+ // Date: Fri Jan 12 17:28:32 CST 2007
+ #include "bitbit.h"
+
+ // Module | Test
+ // Thread: int my_test();
+ int my_test(){
+ {
+ int21 x = 0x1fffff;
+ int21 y = 0x0fffff;
+ int21 result;
+ int i_result;
+ result = ~x;
+ i_result = result;
+ printf("i_result = %x\n", i_result);
+ result = x ^ y;
+ i_result = result;
+ printf("i_result = %x\n", i_result);
+ result = x & y;
+ if (result == y/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ result = x | y;
+ if (result == x/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ result = x;
+ result &= y;
+ if (result == y/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ result = x;
+ result |= y;
+ if (result == x/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ result = x >> 20;
+ i_result = result;
+ printf("i_result = %x\n", i_result);
+ {
+ result = y << 1;
+ result += 1;
+ if (result != x/*CPPASTBinaryExpression*/)
+ printf("fail\n");
+ else
+ printf("ok\n");
+
+ result = y;
+ result <<= 1;
+ ++result;
+
+ if (result != x/*CPPASTBinaryExpression*/)
+ printf("fail\n");
+ else
+ printf("ok\n");
+
+ }
+ return 0;
+ }
+ }
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/bitbit.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitbit.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitbit.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,6 ----
+
+ // Date: Fri Jan 12 17:28:32 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef int __attribute__ ((bitwidth(21))) int21;
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/bitbit.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitbit.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitbit.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,10 ----
+ i_result = 0
+ i_result = fff00000
+ ok
+ ok
+ ok
+ ok
+ i_result = ffffffff
+ ok
+ ok
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/bitlogic.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitlogic.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,45 ----
+ // Date: Fri Jan 12 17:40:34 CST 2007
+ #include "bitlogic.cpp.ssdm.h"
+
+ // Module | Test
+ // Thread: int my_test();
+ int my_test(){
+ {
+ uint1 x = 0x1;
+ uint1 y;
+ int9 z = 0x1ff;
+ uint9 uz = 0x1ff;
+ uint9 temp;
+ y = x;
+ y -= 1;
+ if (!y/*CPPASTUnaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ if (y > x/*CPPASTBinaryExpression*/)
+ printf("fail\n");
+ else
+ printf("ok\n");
+
+ if (z != uz/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ temp = z;
+ if (temp <= uz/*CPPASTBinaryExpression*/)
+ printf("ok\n");
+ else
+ printf("fail\n");
+
+ return 0;
+ }
+ }
+
+ int main()
+ {
+ my_test();
+ return 0;
+ }
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/bitlogic.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitlogic.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitlogic.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,9 ----
+
+
+ // Date: Fri Jan 12 17:40:34 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef unsigned int __attribute__ ((bitwidth(1))) uint1;
+ typedef int __attribute__ ((bitwidth(9))) int9;
+ typedef unsigned int __attribute__ ((bitwidth(9))) uint9;
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/bitlogic.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/bitlogic.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/bitlogic.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,5 ----
+ ok
+ ok
+ ok
+ ok
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/cond-expr.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/cond-expr.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/cond-expr.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,17 ----
+
+ typedef int __attribute__ ((bitwidth(31))) int31;
+
+ typedef struct { int31 pgprot; } pgprot_t;
+
+ void split_large_page(int31 addr, pgprot_t prot)
+ {
+ int31 x;
+ x = (addr ? prot : ((pgprot_t) { 0x101 } )).pgprot;
+ printf("%x\n", x);
+ }
+
+ int main()
+ {
+ split_large_page(0x7fffffff, (pgprot_t){0x1});
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/cond-expr.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/cond-expr.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/cond-expr.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ 1
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,47 ----
+ #include <stdio.h>
+ typedef unsigned int __attribute__ ((bitwidth(7))) int7;
+ typedef unsigned int __attribute__ ((bitwidth(17))) int17;
+ typedef unsigned int __attribute__ ((bitwidth(32))) int32;
+ typedef unsigned int __attribute__ ((bitwidth(8))) int8;
+
+ class myStruct{
+ public:
+ int i;
+ unsigned char c :7;
+ int s: 17;
+ char c2;
+ };
+
+ class myStruct2{
+ public:
+ int32 i;
+ int7 c;
+ int17 s;
+ int8 c2;
+ };
+
+ int main()
+ {
+ myStruct x;
+ myStruct2 y;
+
+ char* ptrc, *ptrc1, *ptrc2, *ptrc3;
+ unsigned int offset, offset1;
+
+ ptrc = (char*)&(x.i);
+ ptrc1 = (char*)&(x.c2);
+
+
+
+ ptrc2 = (char*)&(y.i);
+ ptrc3 = (char*)&(y.c2);
+
+ offset = ptrc1 - ptrc;
+ offset1 = ptrc3 - ptrc2;
+
+
+ if(offset != offset1 || sizeof(myStruct) != sizeof(myStruct2))
+ printf("error\n");
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/cppfield.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/cppfield.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/cppfield.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/enum.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/enum.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,29 ----
+
+
+
+ #include <stdio.h>
+
+
+
+ class myClass
+ {
+ public:
+ enum X {R= 0x1, G=0x100, B=0x1ff} __attribute__ ((bitwidth(9))) x;
+
+ void set_X(enum X t) {x = t;}
+
+ enum X get_X(void) {return x;}
+ };
+
+ int main()
+ {
+ myClass c;
+ c.set_X(myClass::B);
+ c.set_X((myClass::X)0x2ff);
+ int i = (int)c.get_X();
+ printf("%x\n", i);
+
+ return 0;
+ }
+
+
Index: llvm-test/SingleSource/UnitTests/Integer/enum.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/enum.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/enum.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ 2ff
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/exception.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/exception.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,46 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(31))) int31;
+ typedef int __attribute__ ((bitwidth(1))) int1;
+ typedef int __attribute__ ((bitwidth(7))) int7;
+ typedef int __attribute__ ((bitwidth(17))) int17;
+
+ const int31 ex_num = 10;
+
+ double throw_test(double x, int31 y)
+ {
+ if(y==0)
+ throw ex_num;
+
+
+ if(y==1)
+ throw (int1)true;
+
+ if(y==2)
+ throw (int7)2;
+
+ if(y == 3)
+ throw (int17)3;
+
+ return x;
+ }
+
+ int main()
+ {
+ try{
+ throw_test(10, 3);
+ }
+ catch(int31 i){
+ printf("int31 branch\n");
+ }
+ catch(int1 b){
+ printf("int1 branch\n");
+ }
+ catch(int7 c){
+ printf("int7 branch\n");
+ }
+ catch(int17 s){
+ printf("int17 branch\n");
+ }
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/exception.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/exception.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/exception.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ int17 branch
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,19 ----
+
+ typedef int __attribute__ ((bitwidth(61))) int61;
+
+ extern __inline int61
+ __strtol_l (int a)
+ {
+ return 0;
+ }
+
+ int61
+ __strtol_l (int a)
+ {
+ return 0;
+ }
+
+ int main()
+ {
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/field.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/field.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/field.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,33 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(7))) int7;
+ typedef int __attribute__ ((bitwidth(17))) int17;
+ typedef int __attribute__ ((bitwidth(32))) int32;
+ typedef int __attribute__ ((bitwidth(8))) int8;
+
+ typedef struct myStruct{int i; unsigned char c :7; int s: 17; char c2;} myStruct;
+ typedef struct myStruct2{int32 i; int7 c; int17 s; int8 c2;} myStruct2;
+
+ int main()
+ {
+ myStruct x;
+ myStruct2 y;
+
+ void* ptr, *ptr1, *ptr2, *ptr3;
+ unsigned int offset, offset1;
+
+ ptr = &(x.i);
+ ptr1 = &(x.c2);
+
+ ptr2 = &(y.i);
+ ptr3 = &(y.c2);
+
+ offset = ptr1 - ptr;
+ offset1 = ptr3 - ptr2;
+
+ if(offset != offset1)
+ printf("error: offset=%x, offset1=%x\n", offset, offset1);
+ if(sizeof(myStruct) != sizeof(myStruct2))
+ printf("error2: sizeof myStruct = %d, sizeof myStruct2 = %d\n", sizeof(myStruct), sizeof(myStruct2));
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/field.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/field.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/field.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/folding.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/folding.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/folding.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,28 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(7))) int7;
+ typedef int __attribute__ ((bitwidth(15))) int15;
+
+ const int7 myConst = 1;
+ const int15 myConst2 = 0x7fff;
+
+ int main()
+ {
+ int7 x;
+ int7 y;
+ int15 z;
+
+ x = myConst << 3; // constant 8
+ y = x + myConst; // constant 9
+ if(y -x != 1)
+ printf("error\n");
+
+ x = myConst << 7; // constant 0
+ if(y -x != 9)
+ printf("error\n");
+
+ z = (int15) y;
+ z &= myConst2;
+ if(z != 0x9)
+ printf("error\n");
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/folding.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/folding.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/folding.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/global.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/global.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/global.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,28 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(7))) int7;
+ typedef int __attribute__ ((bitwidth(14))) int14;
+
+ int7 array[4] = {127, -1, 100 -28};
+ int14 array2[4][4];
+
+ void test()
+ {
+ int i = 0;
+ int j = 0;
+ for(i=0; i<4; ++i)
+ for(j=0; j<4; ++j)
+ {
+ array2[i][j] = array[i] * array[j];
+ if(array2[i][j] <= 0)
+ printf("error: i=%d, j=%d, result = %d\n", i, j, array2[i][j]);
+ }
+ }
+
+ int main()
+ {
+ int7 a = 127;
+ int7 b = 100;
+ printf("a=%d b=%d a*a=%d\n",a, b, a*a);
+ test();
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/global.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/global.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/global.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ a=-1 b=-28 a*a=1
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/large-array.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/large-array.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,40 ----
+
+ typedef int __attribute__ ((bitwidth(13))) int13;
+
+
+ int13 test(int13 x) {
+ const int13 XX[1000] = { 0, 0 };
+ const char S [1000] = "foo";
+
+ const int13 array[] = {
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
+ };
+ return array[x];
+ }
+
+ int main()
+ {
+ if(test(1) != 23)
+ printf("error\n");
+ if(test(2) != 123)
+ printf("error2\n");
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/large-array.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/large-array.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/large-array.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/list.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/list.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/list.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,52 ----
+ #include <stdio.h>
+
+ typedef int __attribute__ ((bitwidth(9))) int9;
+ typedef int __attribute__ ((bitwidth(7))) int7;
+
+ typedef struct myStruct{int9 x; int7 y; } myStruct;
+ typedef struct myList{myStruct s; struct myList* next;} myList;
+
+ int array[64*3] = {103, 198, 105, 115, 81, 255, 74, 236, 41, 205, 186, 171, 242, 251, 227, 70, 124, 194, 84, 248, 27, 232, 231, 141, 118, 90, 46, 99, 51, 159, 201, 154, 102, 50, 13, 183, 49, 88, 163, 90, 37, 93, 5, 23, 88, 233, 94, 212, 171, 178, 205, 198, 155, 180, 84, 17, 14, 130, 116, 65, 33, 61, 220, 135, 112, 233, 62, 161, 65, 225, 252, 103, 62, 1, 126, 151, 234, 220, 107, 150, 143, 56, 92, 42, 236, 176, 59, 251, 50, 175, 60, 84, 236, 24, 219, 92, 2, 26, 254, 67, 251, 250, 170, 58, 251, 41, 209, 230, 5, 60, 124, 148, 117, 216, 190, 97, 137, 249, 92, 187, 168, 153, 15, 149, 177, 235, 241, 179, 5, 239, 247, 0, 233, 161, 58, 229, 202, 11, 203, 208, 72, 71, 100, 189, 31, 35, 30, 168, 28, 123, 100, 197, 20, 115, 90, 197, 94, 75, 121, 99, 59, 112, 100, 36, 17, 158, 9, 220, 170, 212, 172, 242, 27, 16, 175, 59, 51, 205, 227, 80, 72, 71, 21, 92, 187, 111, 34, 25, 186, 155, 125, 245
+ };
+
+ void test()
+ {
+ unsigned int i=0;
+ unsigned int cnt = sizeof(array)/sizeof(*array);
+
+ myList* head = 0;
+
+
+ for(i; i<cnt; ++i)
+ {
+ myList* elem = malloc(sizeof(myList));
+
+ elem->next = head;
+ head = elem;
+ (*elem).s.x = array[i];
+ (*elem).s.y = array[i] - 1;
+ }
+
+
+ i = 0;
+ while(head)
+ {
+ myList* tmp;
+ i+=1;
+ if(head->s.x != array[64*3 - i])
+ printf("error: i = %d, x = %d, array = %d\n", i,head->s.x, array[64*3 - i]);
+ if( (head->s.y ^ (int7)((array[64*3 - i] - 1)&0x7f)) != 0 )
+ printf("error: i = %d, y = %hhd, expected = %hhd\n", i, (unsigned char)(head->s.y), ((array[64*3 - i] - 1)&0x7f));
+ //remove from the list
+ tmp = head;
+ head = head->next;
+ free(tmp);
+ }
+
+ }
+
+ int main()
+ {
+ test();
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/list.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/list.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/list.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/local-array.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/local-array.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,22 ----
+
+ typedef int __attribute__ ((bitwidth(4))) int4;
+ typedef int __attribute__ ((bitwidth(6))) int6;
+
+ int4 test(int6 X) {
+ int4 student_t[32]={0 , 12 , 4 , 3 , 2 , 2 ,
+ 2 , 2 , 2 , 2 , 2 ,
+ 2 , 2 , 2 , 2 , 2 ,
+ 2 , 2 , 2 , 2 , 2 ,
+ 2 , 2 , 2 , 2 , 2 ,
+ 2 , 2 , 2 , 2, 3, 4 };
+ return student_t[X];
+ }
+
+ int main()
+ {
+ int4 result = test(31);
+ if(result != 4)
+ printf("error: return = %d\n", result);
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/local-array.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/local-array.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/local-array.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/local-union.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/local-union.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,21 ----
+
+ typedef int __attribute__ ((bitwidth(33))) int33;
+
+ union foo { int X; int33 Y;};
+
+ double test(union foo* F) {
+ {
+ union foo { float X; int33 Y;} A;
+ A.Y = 0x1ffffffff;
+ return A.X;
+ }
+ }
+
+ int main()
+ {
+ union foo F;
+
+ printf("return = %f\n", test(&F));
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/local-union.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/local-union.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/local-union.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ return = nan
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/matrix.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/matrix.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,114 ----
+
+ // Date: Fri Jan 12 17:32:33 CST 2007
+ #include "matrix.h"
+
+ typedef enum bool{false=0, true=1} bool;
+
+ // Module | Test
+ // Thread: int my_test(sc_int<17> A[8][8], sc_int<17> B[8][8] );
+ int my_test(int17 A[8][8], int17 B[8][8]){
+ {
+ unsigned int i, j, k;
+ int17 C[8];
+ int t;
+ {
+ i = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_1 = (i < 8);
+ if (!ssdm_tmp_1) break;
+ {
+ j = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_2 = (j < 8);
+ if (!ssdm_tmp_2) break;
+ {
+ {
+ k = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_3 = (k < 8);
+ if (!ssdm_tmp_3) break;
+ A[i][j] = A[i][k] * B[j][k];
+ ++k;
+ }
+ }
+ sort(A[i], C);
+ t = get_gcd(C[0], C[1]);
+ printf("t=%d\n", t);
+ }
+ ++j;
+ }
+ }
+ ++i;
+ }
+ }
+ return 0;
+ }
+ }
+ // Thread: int get_gcd(const int& a, const int& b);
+ int get_gcd(const int a, const int b){
+ {
+ if (b == 0/*CPPASTBinaryExpression*/)
+ return a;
+
+ return get_gcd( b, a % b );
+ }
+ }
+ // Thread: void sort(const sc_int<17> X[8], sc_int<17> Y[8]);
+ void sort(const int17 X[8], int17 Y[8]){
+ {
+ unsigned int i, j;
+ int17 temp;
+ {
+ j = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_4 = (j < 8);
+ if (!ssdm_tmp_4) break;
+ Y[j] = X[j];
+ j++;
+ }
+ }
+ {
+ j = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_5 = (j < 8);
+ if (!ssdm_tmp_5) break;
+ {
+ temp = -0xffff;
+ {
+ i = j;
+ for ( ; ; ) {
+ bool ssdm_tmp_6 = (i < 8);
+ if (!ssdm_tmp_6) break;
+ {
+ temp = Y[i] > temp ? Y[i] : temp;
+ }
+ ++i;
+ }
+ }
+ Y[j] = temp;
+ }
+ j++;
+ }
+ }
+ }
+ }
+
+
+ int main()
+ {
+ unsigned int i, j;
+
+ int17 X[8][8];
+ int17 Y[8][8];
+
+ for(i=0; i<8; i++)
+ for(j=0; j<8; j++){
+ X[i][j] = (i+1) * (j + 79);
+ Y[i][j] = (i-1) * (j + 255);
+ }
+ my_test(X, Y);
+
+ return 0;
+ }
+
+ // End of Module | Test
Index: llvm-test/SingleSource/UnitTests/Integer/matrix.h
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/matrix.h:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/matrix.h Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,6 ----
+
+ // Date: Fri Jan 12 17:32:33 CST 2007
+ #ifndef DATATYPE_DEFINE
+ #define DATATYPE_DEFINE
+ typedef int __attribute__ ((bitwidth(17))) int17;
+ #endif
Index: llvm-test/SingleSource/UnitTests/Integer/matrix.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/matrix.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/matrix.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,65 ----
+ t=86
+ t=86
+ t=22532
+ t=45064
+ t=45064
+ t=45064
+ t=45064
+ t=45064
+ t=172
+ t=172
+ t=45064
+ t=45064
+ t=45064
+ t=49184
+ t=49184
+ t=49184
+ t=2
+ t=2
+ t=2
+ t=4
+ t=4
+ t=4
+ t=4
+ t=4
+ t=8
+ t=8
+ t=8
+ t=49184
+ t=49184
+ t=49184
+ t=57424
+ t=57424
+ t=2
+ t=2
+ t=2
+ t=2
+ t=2
+ t=57424
+ t=57424
+ t=57424
+ t=516
+ t=516
+ t=4120
+ t=8240
+ t=12360
+ t=16480
+ t=20600
+ t=20600
+ t=602
+ t=602
+ t=26652
+ t=53304
+ t=53304
+ t=53304
+ t=53304
+ t=53304
+ t=688
+ t=688
+ t=49184
+ t=49184
+ t=49184
+ t=49184
+ t=49184
+ t=49184
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/memory.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/memory.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/memory.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,40 ----
+ #include <stdio.h>
+
+ typedef int __attribute__ ((bitwidth(31))) int31;
+ typedef int __attribute__ ((bitwidth(3))) int3;
+
+ typedef struct myStruct{int31 x; int3 y;} myStruct;
+
+ void mem_test(int31 num)
+ {
+ int inum = num;
+ unsigned int i = 0;
+
+ int31* array = malloc(sizeof(int3) * inum);
+ for(i=0; i< num; ++i)
+ {
+ array[i] = i;
+ }
+
+ free(array);
+ }
+
+ void mem_test2()
+ {
+ myStruct* ptr = malloc(sizeof(myStruct));
+ ptr->y = 8; // constant 0
+ if(ptr->y != 0)
+ printf("error\n");
+ ptr->x = ++(ptr->y);
+ ptr->x *= 2;
+ if(ptr->x - ptr->y != 1)
+ printf("error\n");
+ free(ptr);
+ }
+
+ int main()
+ {
+ mem_test(0xff);
+ mem_test2();
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/memory.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/memory.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/memory.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/offset.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/offset.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/offset.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,17 ----
+
+ typedef int __attribute__ ((bitwidth(33))) int33;
+
+ struct s {
+ int33 field[0];
+ };
+
+ #define OFFS \
+ (((char *) &((struct s *) 0)->field[1]) - (char *) 0)
+
+ int foo[OFFS];
+
+ int main()
+ {
+ printf("%d\n", OFFS);
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/offset.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/offset.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/offset.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ 5
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/override.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/override.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,19 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(31))) int31;
+ typedef int __attribute__ ((bitwidth(32))) int32;
+
+ void func(int32 i)
+ {
+ printf("call func with int32");
+ }
+
+ void func(int31 s)
+ {
+ printf("call func with int31\n");
+ }
+
+ int main()
+ {
+ func( (int31) 1);
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/override.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/override.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/override.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ call func with int31
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/pointer.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/pointer.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,25 ----
+
+ typedef int __attribute__ ((bitwidth(3))) int3;
+ typedef int __attribute__ ((bitwidth(31))) int31;
+
+ int3 *test(int3* C) {
+ return C-1;
+ }
+
+ int31 *test2(int31* I) {
+ return I-1;
+ }
+
+ int main()
+ {
+ int3 i3;
+ int31 i31;
+
+ if(&i3 != (test(i3) + 1))
+ printf("error\n");
+
+ if(&i31 != (test2(i31)+1))
+ printf("error2: &i31=%p, ret = %p\n", &i31, test2(i31));
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/pointer.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/pointer.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/pointer.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/static.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/static.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/static.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,24 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(31))) int31;
+
+
+ int31 test(int31 y, int31* z)
+ {
+ static int31 x = 0;
+ *z = x;
+ x = y;
+ return x;
+ }
+
+ int main()
+ {
+ int31 a, b;
+ a = test(1, &b);
+ if(b != 0 || a != 1)
+ printf("error\n");
+ a = test(-1, &b);
+ if(b != 1 || a != -1)
+ printf("error\n");
+ return 0;
+
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/static.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/static.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/static.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/struct1.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/struct1.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,19 ----
+
+
+ typedef int __attribute__ ((bitwidth(33))) int33;
+
+ struct foo A;
+
+ struct foo {
+ int33 x;
+ double D;
+ };
+
+ int main()
+ {
+ A.D = -3.141593;
+ A.x = -1;
+ printf("%f\n", A.D);
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/struct1.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/struct1.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/struct1.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ -3.141593
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/struct2.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/struct2.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,29 ----
+
+ typedef int __attribute__ ((bitwidth(33))) int33;
+ typedef int __attribute__ ((bitwidth(9))) int9;
+
+ typedef struct min_info {
+ int33 offset;
+ int9 file_attr;
+ } min_info;
+
+ typedef struct Globals {
+ char answerbuf;
+ min_info info[1];
+ min_info *pInfo;
+ } Uz_Globs;
+
+ Uz_Globs G;
+
+ int assign() {
+ G.pInfo = G.info;
+ }
+
+ int main()
+ {
+ assign();
+ if(G.pInfo != G.info)
+ printf("error\n");
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/struct2.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/struct2.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/struct2.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/structInit.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/structInit.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,24 ----
+
+ typedef int __attribute__ ((bitwidth(31))) int31;
+ typedef int __attribute__ ((bitwidth(24))) int24;
+
+ typedef struct Connection_Type {
+ int24 to;
+ char type[10];
+ int31 length;
+ } Connection;
+
+ Connection link[3]
+ = { {1, "link1", 10},
+ {2, "link2", 20},
+ {3, "link3", 30} };
+
+
+ int main()
+ {
+ int24 l;
+ for(l=0; l<3; l++)
+ printf("%d, %s, %d\n", link[l].to, link[l].type, link[l].length);
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/structInit.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/structInit.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/structInit.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,4 ----
+ 1, link1, 10
+ 2, link2, 20
+ 3, link3, 30
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/switch.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/switch.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/switch.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,39 ----
+ #include <stdio.h>
+
+ typedef unsigned int __attribute__ ((bitwidth(7))) int7;
+ typedef unsigned int __attribute__ ((bitwidth(3))) int3;
+
+ const int7 zero = 1 << 8; // constant 0;
+ static int3 seven = 0xf; // constant 7;
+
+ int3 test(unsigned char c)
+ {
+
+ switch(c){
+ case 0: return seven >> 3;
+ case 1: return seven >>2;
+ case 2: return (seven >> 1) & 2;
+ case 3: return (seven >> 1);
+ case 4: return seven & 4;
+ case 5: return seven & 5;
+ case 6: return seven & 6;
+ case 7: return seven;
+ default: printf("error\n"); return -1;
+ }
+ return 0;
+ }
+
+ int main()
+ {
+ unsigned char c;
+ unsigned char i;
+
+
+ for(i=0; i< ((unsigned char)zero) + 8; i++)
+ {
+ c = (unsigned char)test(i);
+ if(c != i)
+ printf("error: i=%hhd, c=%hhd\n", i, c);
+ }
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/switch.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/switch.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/switch.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/template.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,47 ----
+ #include <iostream>
+
+ typedef int __attribute__ ((bitwidth(4))) int4;
+ typedef unsigned int __attribute__ ((bitwidth(5))) int5;
+
+ template <class T>
+ T& min(T &tParam1, T &tParam2)
+ {
+ if(tParam1 < tParam2)
+ return tParam1;
+ else
+ return tParam2;
+ }
+
+ template <class T>
+ T& min(T &tParam1, T &tParam2, T &tParam3)
+ {
+ if(min(tParam1, tParam2) < tParam3)
+ return min(tParam1, tParam2) ;
+ else
+ return tParam3;
+ }
+
+
+
+
+ int main()
+ {
+ int4 x , y, z;
+
+ x = 12;
+ y = 2;
+ z = 7;
+
+ int m = min(x, y);
+ printf("min = %d\n", m);
+
+ m = min(x, y, z);
+ printf("min = %d\n", m);
+
+ int5 f, g;
+ f = 0x1f;
+ g = 0x0f;
+
+ m = min(f, g);
+ printf("min = %x\n", m);
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/template.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,4 ----
+ min = -4
+ min = -4
+ min = f
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/template2.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template2.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,53 ----
+ #include <stdio.h>
+
+ typedef int __attribute__ ((bitwidth(26))) int26;
+
+ template <typename T>
+ class MyQueue
+ {
+ T data[128];
+ unsigned int idx;
+ public:
+ MyQueue(): idx(0){}
+ void Add(T const &);
+ void Remove();
+ void Print();
+ };
+
+ template <typename T> void MyQueue<T> ::Add(T const &d)
+ {
+ if(idx < 128 ){
+ data[idx] = d;
+ idx += 1;
+ }
+ }
+
+ template <typename T> void MyQueue<T>::Remove()
+ {
+ if(idx != 0)
+ idx -= 1;
+
+ }
+
+ template <typename T> void MyQueue<T>::Print()
+ {
+ for(unsigned int i = 0; i< idx; i++){
+ int m = data[i];
+ printf("%d, ", m);
+ }
+ printf("\n");
+ }
+
+ int main()
+ {
+ MyQueue<int26> q;
+
+ q.Add(-1);
+ q.Add(2);
+ q.Print();
+
+ q.Remove();
+ q.Print();
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/template2.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template2.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template2.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,3 ----
+ -1, 2,
+ -1,
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/template3.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template3.cpp Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,38 ----
+ #include <iostream>
+ using namespace std;
+
+ typedef int __attribute__ ((bitwidth(17))) int17;
+ typedef int __attribute__ ((bitwidth(15))) int15;
+
+ template<class T, class U, int I> struct X
+ { void f() { cout << "Primary template" << endl; } };
+
+ template<class T, int I> struct X<T, T*, I>
+ { void f() { cout << "Partial specialization 1" << endl;
+ } };
+
+ template<class T, class U, int I> struct X<T*, U, I>
+ { void f() { cout << "Partial specialization 2" << endl;
+ } };
+
+ template<class T> struct X<int, T*, 10>
+ { void f() { cout << "Partial specialization 3" << endl;
+ } };
+
+ template<class T, class U, int I> struct X<T, U*, I>
+ { void f() { cout << "Partial specialization 4" << endl;
+ } };
+
+ int main() {
+ X<int17, int17, 10> a;
+ X<int15, int15*, 5> b;
+ X<int17, int15*, 5> bb;
+
+ X<int17*, float, 10> c;
+ X<int15, char*, 10> d;
+ X<float, int15*, 10> e;
+ // X<int, int*, 10> f;
+ a.f(); b.f(); bb.f(); c.f(); d.f(); e.f();
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/template3.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/template3.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/template3.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,7 ----
+ Primary template
+ Partial specialization 1
+ Partial specialization 4
+ Partial specialization 2
+ Partial specialization 4
+ Partial specialization 4
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/union-init.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union-init.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,32 ----
+
+
+ typedef int __attribute__ ((bitwidth(33))) int33;
+
+
+ struct Foo {
+ int33 a;
+ int33 b;
+ int33 c;
+ };
+
+ struct Bar {
+ union {
+ void **a;
+ struct Foo b;
+ }u;
+ };
+
+ struct Bar test = {0};
+
+ int main()
+ {
+ if(test.u.b.a != 0)
+ printf("error: a = %d\n", test.u.b.a);
+ if(test.u.b.b != 0)
+ printf("error: a = %d\n", test.u.b.b);
+ if(test.u.b.c != 0)
+ printf("error: a = %d\n", test.u.b.c);
+ printf("%p\n", test.u.a);
+
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/union-init.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union-init.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union-init.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,2 ----
+ (nil)
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/union-struct.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union-struct.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,21 ----
+
+ typedef int __attribute__ ((bitwidth(31))) int31;
+
+ struct Blend_Map_Entry {
+ union {
+ float Colour[5];
+ double Point_Slope[2];
+ int31 weight[5];
+ } Vals;
+ };
+
+ void test(struct Blend_Map_Entry* Foo)
+ {
+ }
+
+ int main()
+ {
+ if( sizeof(struct Blend_Map_Entry) == 5 * sizeof(int) )
+ printf("error: %d\n", sizeof(struct Blend_Map_Entry));
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/union-struct.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union-struct.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union-struct.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/union2.c
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union2.c:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union2.c Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1,31 ----
+ #include <stdio.h>
+ typedef int __attribute__ ((bitwidth(9))) int9;
+ typedef int __attribute__ ((bitwidth(31))) int31;
+ typedef union {short i; int9 i9; int31 i31;} myUnion;
+ typedef struct myStruct {int9* ptr; short i;} myStruct;
+
+ myStruct test(myUnion u)
+ {
+ myStruct x;
+
+ u.i31 = 0;
+ u.i = 0xffff;
+ int9* ptr = &(u.i9);
+ *ptr= 0x00;
+
+ x.ptr = ptr;
+ x.i = u.i;
+
+ return x;
+
+ }
+
+ static myUnion uu;
+
+ int main()
+ {
+ myStruct s = test(uu);
+ if(s.i == 0x0)
+ printf("error: s.i=%x\n", s.i);
+ return 0;
+ }
Index: llvm-test/SingleSource/UnitTests/Integer/union2.reference_output
diff -c /dev/null llvm-test/SingleSource/UnitTests/Integer/union2.reference_output:1.1
*** /dev/null Thu Jan 18 20:23:02 2007
--- llvm-test/SingleSource/UnitTests/Integer/union2.reference_output Thu Jan 18 20:22:46 2007
***************
*** 0 ****
--- 1 ----
+ exit 0
Index: llvm-test/SingleSource/UnitTests/Integer/Makefile
diff -u llvm-test/SingleSource/UnitTests/Integer/Makefile:1.4 llvm-test/SingleSource/UnitTests/Integer/Makefile:1.5
--- llvm-test/SingleSource/UnitTests/Integer/Makefile:1.4 Wed Jan 17 19:33:27 2007
+++ llvm-test/SingleSource/UnitTests/Integer/Makefile Thu Jan 18 20:22:46 2007
@@ -15,7 +15,7 @@
# integer types. Consequently, we must disable the LLI, LLC,
# LLC-BETA, and JIT test cases. This leaves the CBE which can
# handle the arbitrary precision integers.
-#
+
DISABLE_LLC := 1
DISABLE_JIT := 1
ENABLE_LLI := 1
@@ -25,7 +25,9 @@
# should be "faked" by copying the reference output. This is
# necessary because gcc doesn't support the bitwidth attribute and
# therefore can't generate correct output.
+
USE_REFERENCE_OUTPUT := 1
-include $(LEVEL)/Makefile.config
include $(LEVEL)/SingleSource/Makefile.singlesrc
+
+LDFLAGS += -lstdc++
More information about the llvm-commits
mailing list