Changes in directory llvm-test/SingleSource/UnitTests/Integer:
SSAtest.c updated: 1.2 -> 1.3 arith.c updated: 1.2 -> 1.3 array.c updated: 1.2 -> 1.3 bigint.c updated: 1.2 -> 1.3 bitbit.c updated: 1.2 -> 1.3 bitlogic.c updated: 1.2 -> 1.3 cond-expr.c updated: 1.2 -> 1.3 enum.cpp updated: 1.2 -> 1.3 exception.cpp updated: 1.1 -> 1.2 extern-inline-redef.c updated: 1.2 -> 1.3 field.c updated: 1.1 -> 1.2 folding.c updated: 1.1 -> 1.2 global.c updated: 1.1 -> 1.2 large-array.c updated: 1.2 -> 1.3 list.c updated: 1.2 -> 1.3 local-array.c updated: 1.2 -> 1.3 local-union.c updated: 1.2 -> 1.3 matrix.c updated: 1.3 -> 1.4 memory.c updated: 1.2 -> 1.3 offset.c updated: 1.2 -> 1.3 override.cpp updated: 1.2 -> 1.3 pointer.c updated: 1.2 -> 1.3 static.c updated: 1.1 -> 1.2 struct1.c updated: 1.2 -> 1.3 struct2.c updated: 1.2 -> 1.3 structInit.c updated: 1.2 -> 1.3 switch.c updated: 1.2 -> 1.3 template.cpp updated: 1.2 -> 1.3 template2.cpp updated: 1.1 -> 1.2 template3.cpp updated: 1.1 -> 1.2 union-init.c updated: 1.2 -> 1.3 union-struct.c updated: 1.2 -> 1.3 union2.c updated: 1.1 -> 1.2 --- Log message: Updates to test cases by Guoling Han. --- Diffs of the changes: (+262 -35) SSAtest.c | 7 +++++++ arith.c | 7 ++++++- array.c | 8 +++++++- bigint.c | 8 ++++++-- bitbit.c | 24 ++++++++++++++---------- bitlogic.c | 18 ++++++++++++------ cond-expr.c | 10 ++++++++-- enum.cpp | 6 ++++++ exception.cpp | 8 ++++++++ extern-inline-redef.c | 6 ++++++ field.c | 8 ++++++++ folding.c | 21 ++++++++++++++++++--- global.c | 7 +++++++ large-array.c | 16 +++++++++++++--- list.c | 7 +++++++ local-array.c | 7 +++++++ local-union.c | 7 +++++++ matrix.c | 12 +++++++++--- memory.c | 6 ++++++ offset.c | 7 +++++++ override.cpp | 6 ++++++ pointer.c | 12 +++++++++--- static.c | 6 ++++++ struct1.c | 8 ++++++++ struct2.c | 8 ++++++++ structInit.c | 6 ++++++ switch.c | 10 +++++++++- template.cpp | 7 +++++++ template2.cpp | 6 ++++++ template3.cpp | 6 ++++++ union-init.c | 7 +++++++ union-struct.c | 8 ++++++++ union2.c | 7 +++++++ 33 files changed, 262 insertions(+), 35 deletions(-) Index: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c diff -u llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.2 llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/SSAtest.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- SSAtest.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// Adopted the test from previous test-cases. Changed it with +// non-regular int data type. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(4))) int4; Index: llvm-test/SingleSource/UnitTests/Integer/arith.c diff -u llvm-test/SingleSource/UnitTests/Integer/arith.c:1.2 llvm-test/SingleSource/UnitTests/Integer/arith.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/arith.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/arith.c Fri Jan 19 16:54:01 2007 @@ -1,5 +1,10 @@ +//===--- arith.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a general test for arithmatic operations. +// +//===------------------------------------------------------------------------===// + -// Date: Fri Jan 12 17:19:09 CST 2007 #include "arith.h" #include <stdio.h> Index: llvm-test/SingleSource/UnitTests/Integer/array.c diff -u llvm-test/SingleSource/UnitTests/Integer/array.c:1.2 llvm-test/SingleSource/UnitTests/Integer/array.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/array.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/array.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- array.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a general test for array data types. +// +//===------------------------------------------------------------------------===// + #include "array.h" #include <stdio.h> @@ -38,4 +44,4 @@ return 0; } -// End of Module | Test + Index: llvm-test/SingleSource/UnitTests/Integer/bigint.c diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.2 llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bigint.c Fri Jan 19 16:54:01 2007 @@ -1,5 +1,9 @@ +//===--- bigint.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a general test for big integer type. +// +//===------------------------------------------------------------------------===// -// Date: Fri Jan 12 17:25:23 CST 2007 #include "bigint.h" #include <stdio.h> @@ -51,4 +55,4 @@ } -// End of Module | Test + Index: llvm-test/SingleSource/UnitTests/Integer/bitbit.c diff -u llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.2 llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bitbit.c Fri Jan 19 16:54:01 2007 @@ -1,9 +1,13 @@ -// Date: Fri Jan 12 17:28:32 CST 2007 +//===--- bitbit.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a general test for bit operations. +// +//===------------------------------------------------------------------------===// + #include "bitbit.h" #include <stdio.h> -// Module | Test -// Thread: int my_test(); + int my_test(){ { int21 x = 0x1fffff; @@ -17,27 +21,27 @@ i_result = result; printf("i_result = %x\n", i_result); result = x & y; - if (result == y/*CPPASTBinaryExpression*/) + if (result == y) printf("ok\n"); else printf("fail\n"); result = x | y; - if (result == x/*CPPASTBinaryExpression*/) + if (result == x) printf("ok\n"); else printf("fail\n"); result = x; result &= y; - if (result == y/*CPPASTBinaryExpression*/) + if (result == y) printf("ok\n"); else printf("fail\n"); result = x; result |= y; - if (result == x/*CPPASTBinaryExpression*/) + if (result == x) printf("ok\n"); else printf("fail\n"); @@ -48,7 +52,7 @@ { result = y << 1; result += 1; - if (result != x/*CPPASTBinaryExpression*/) + if (result != x) printf("fail\n"); else printf("ok\n"); @@ -57,7 +61,7 @@ result <<= 1; ++result; - if (result != x/*CPPASTBinaryExpression*/) + if (result != x) printf("fail\n"); else printf("ok\n"); @@ -72,4 +76,4 @@ my_test(); return 0; } -// End of Module | Test + Index: llvm-test/SingleSource/UnitTests/Integer/bitlogic.c diff -u llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.2 llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/bitlogic.c Fri Jan 19 16:54:01 2007 @@ -1,4 +1,10 @@ -// Date: Fri Jan 12 17:40:34 CST 2007 +//===--- bitlogic.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a general test for logical operations. +// +//===------------------------------------------------------------------------===// + + #include "bitlogic.h" #include <stdio.h> @@ -13,23 +19,23 @@ uint9 temp; y = x; y -= 1; - if (!y/*CPPASTUnaryExpression*/) + if (!y) printf("ok\n"); else printf("fail\n"); - if (y > x/*CPPASTBinaryExpression*/) + if (y > x) printf("fail\n"); else printf("ok\n"); - if (z != uz/*CPPASTBinaryExpression*/) + if (z != uz) printf("ok\n"); else printf("fail\n"); temp = z; - if (temp <= uz/*CPPASTBinaryExpression*/) + if (temp <= uz) printf("ok\n"); else printf("fail\n"); @@ -43,4 +49,4 @@ my_test(); return 0; } -// End of Module | Test + Index: llvm-test/SingleSource/UnitTests/Integer/cond-expr.c diff -u llvm-test/SingleSource/UnitTests/Integer/cond-expr.c:1.2 llvm-test/SingleSource/UnitTests/Integer/cond-expr.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/cond-expr.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/cond-expr.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- cond_expr.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// this is used to test conditional expression with struct type. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; @@ -7,12 +13,12 @@ void split_large_page(int31 addr, pgprot_t prot) { int31 x; - x = (addr ? prot : ((pgprot_t) 0x101 )).pgprot; + x = addr ? (prot : (pgprot_t) {0x101} ).pgprot; printf("%x\n", x); } int main() { - split_large_page(0x7fffffff, (pgprot_t)0x1); + split_large_page(0x7fffffff, (pgprot_t){0x1}); return 0; } Index: llvm-test/SingleSource/UnitTests/Integer/enum.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.3 --- llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/enum.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- enum.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test of bitwidth attribute with enum data. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> class myClass Index: llvm-test/SingleSource/UnitTests/Integer/exception.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.2 --- llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/exception.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- exception.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test of exception handling with non-regular data +// type. The compiler should be able to differentiate int31, int7 etc. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; typedef int __attribute__ ((bitwidth(1))) int1; Index: llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c diff -u llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.2 llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- extern_inline_redef.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// this is used to test redefining inline function. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(61))) int61; Index: llvm-test/SingleSource/UnitTests/Integer/field.c diff -u llvm-test/SingleSource/UnitTests/Integer/field.c:1.1 llvm-test/SingleSource/UnitTests/Integer/field.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/field.c:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/field.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- field.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is used to test struct with field specifier. We suppose the +// data layout of the field should be the same as the corresponding struct using +// bit accurate types. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(7))) int7; typedef int __attribute__ ((bitwidth(17))) int17; Index: llvm-test/SingleSource/UnitTests/Integer/folding.c diff -u llvm-test/SingleSource/UnitTests/Integer/folding.c:1.1 llvm-test/SingleSource/UnitTests/Integer/folding.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/folding.c:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/folding.c Fri Jan 19 16:54:01 2007 @@ -1,5 +1,13 @@ +//===--- folding.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is used to test constant folding optimization. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(7))) int7; +typedef unsigned int __attribute__ ((bitwidth(7))) uint7; typedef int __attribute__ ((bitwidth(15))) int15; const int7 myConst = 1; @@ -10,19 +18,26 @@ int7 x; int7 y; int15 z; + uint7 u; x = myConst << 3; // constant 8 y = x + myConst; // constant 9 if(y -x != 1) - printf("error\n"); + printf("error1: x = %d, y = %d\n", x, y); x = myConst << 7; // constant 0 if(y -x != 9) - printf("error\n"); + printf("error2: x = %d, y = %d\n", x, y); z = (int15) y; z &= myConst2; if(z != 0x9) - printf("error\n"); + printf("error3: x = %d, y = %d\n", x, y); + + u = 0x7f; + u = u + (uint7)myConst; + if(u != 0) + printf("error4: x = %d, y = %d\n", x, y); + return 0; } Index: llvm-test/SingleSource/UnitTests/Integer/global.c diff -u llvm-test/SingleSource/UnitTests/Integer/global.c:1.1 llvm-test/SingleSource/UnitTests/Integer/global.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/global.c:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/global.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- global.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is used to test global arrays. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(7))) int7; typedef int __attribute__ ((bitwidth(14))) int14; Index: llvm-test/SingleSource/UnitTests/Integer/large-array.c diff -u llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.2 llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/large-array.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,12 @@ +//===--- large-array.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is used to test large local arrays. Some local arrays are +// partially initilized. +// +//===------------------------------------------------------------------------===// + + + #include <stdio.h> typedef int __attribute__ ((bitwidth(13))) int13; @@ -8,7 +17,7 @@ const char S [1000] = "foo"; const int13 array[] = { - 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49, + 17, 53, 523, 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, @@ -34,8 +43,9 @@ int main() { - if(test(1) != 23) + if(test(1) != 53) printf("error\n"); - if(test(2) != 123) + if(test(2) != 523) printf("error2\n"); + return 0; } Index: llvm-test/SingleSource/UnitTests/Integer/list.c diff -u llvm-test/SingleSource/UnitTests/Integer/list.c:1.2 llvm-test/SingleSource/UnitTests/Integer/list.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/list.c:1.2 Fri Jan 19 16:25:30 2007 +++ llvm-test/SingleSource/UnitTests/Integer/list.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- list.c --- Test Cases for Bit Accurate Types ---------------------===// +// +// This is a test for simple linked list operation. Data are added to +// and removed from the list. We compare the expected value wehen we +// remove data from the list. +// +//===----------------------------------------------------------------------===// #include <stdio.h> #include <stdlib.h> Index: llvm-test/SingleSource/UnitTests/Integer/local-array.c diff -u llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.2 llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/local-array.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- local-array.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is another test for local arrays. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(4))) int4; @@ -13,6 +19,7 @@ return student_t[X]; } + int main() { int4 result = test(31); Index: llvm-test/SingleSource/UnitTests/Integer/local-union.c diff -u llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.2 llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/local-union.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- local-union.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for local union data type. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(33))) int33; Index: llvm-test/SingleSource/UnitTests/Integer/matrix.c diff -u llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.3 llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.4 --- llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.3 Fri Jan 19 16:28:01 2007 +++ llvm-test/SingleSource/UnitTests/Integer/matrix.c Fri Jan 19 16:54:01 2007 @@ -1,12 +1,18 @@ +//===--- matrix.c --- Test Cases for Bit Accurate Types -------------------===// +// +// This is a test for matrix with non-regular bitwidth data. In +// my_test(A, B) function, we get A=A*B. For each row after +// multiplication, we sort it in non-increasing order. Then the first +// two largest elements are used to get the gcd. +// +//===----------------------------------------------------------------------===// -// Date: Fri Jan 12 17:32:33 CST 2007 #include "matrix.h" #include <stdio.h> #include <stdlib.h> typedef enum bool{false=0, true=1} bool; -// Thread: void mysort(const sc_int<17> X[8], sc_int<17> Y[8]); void mysort(const int17 X[8], int17 Y[8]){ { unsigned int i, j; @@ -113,4 +119,4 @@ return 0; } -// End of Module | Test + Index: llvm-test/SingleSource/UnitTests/Integer/memory.c diff -u llvm-test/SingleSource/UnitTests/Integer/memory.c:1.2 llvm-test/SingleSource/UnitTests/Integer/memory.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/memory.c:1.2 Fri Jan 19 16:28:37 2007 +++ llvm-test/SingleSource/UnitTests/Integer/memory.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- memory.c --- Test Cases for Bit Accurate Types -------------------===// +// +// This is a test for memory malloc and free operations. It tests +// non-regular bitwidth data and structures. +// +//===----------------------------------------------------------------------===// #include <stdio.h> #include <stdlib.h> Index: llvm-test/SingleSource/UnitTests/Integer/offset.c diff -u llvm-test/SingleSource/UnitTests/Integer/offset.c:1.2 llvm-test/SingleSource/UnitTests/Integer/offset.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/offset.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/offset.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- offset.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for data size calculation with non-regular integral type. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(33))) int33; Index: llvm-test/SingleSource/UnitTests/Integer/override.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.3 --- llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.2 Fri Jan 19 16:20:57 2007 +++ llvm-test/SingleSource/UnitTests/Integer/override.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- override.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test of override test. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; typedef int __attribute__ ((bitwidth(32))) int32; Index: llvm-test/SingleSource/UnitTests/Integer/pointer.c diff -u llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.2 llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/pointer.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- pointer.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for address calculation with non-regular integral type. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(3))) int3; @@ -16,11 +22,11 @@ int3 i3; int31 i31; - if(&i3 != (test(i3) + 1)) + if(&i3 != (test(&i3) + 1)) printf("error\n"); - if(&i31 != (test2(i31)+1)) - printf("error2: &i31=%p, ret = %p\n", &i31, test2(i31)); + if(&i31 != (test2(&i31)+1)) + printf("error2: &i31=%p, ret = %p\n", &i31, test2(&i31)); return 0; } Index: llvm-test/SingleSource/UnitTests/Integer/static.c diff -u llvm-test/SingleSource/UnitTests/Integer/static.c:1.1 llvm-test/SingleSource/UnitTests/Integer/static.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/static.c:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/static.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- static.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for static data with non-regular integral data. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; Index: llvm-test/SingleSource/UnitTests/Integer/struct1.c diff -u llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.2 llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/struct1.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- struct1.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for struct data structure. If the data layout for +// non-regular bitwidth data is not correct, it may change the value of another field. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> Index: llvm-test/SingleSource/UnitTests/Integer/struct2.c diff -u llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.2 llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/struct2.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- struct2.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for struct data structure. We test the nested structure +// and pointer to structure. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(33))) int33; Index: llvm-test/SingleSource/UnitTests/Integer/structInit.c diff -u llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.2 llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/structInit.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- structInit.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for struct data structure with initialization. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; Index: llvm-test/SingleSource/UnitTests/Integer/switch.c diff -u llvm-test/SingleSource/UnitTests/Integer/switch.c:1.2 llvm-test/SingleSource/UnitTests/Integer/switch.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/switch.c:1.2 Fri Jan 19 16:30:40 2007 +++ llvm-test/SingleSource/UnitTests/Integer/switch.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- switch.c --- Test Cases for Bit Accurate Types -------------------===// +// +// This is a test for switch statement. The switch value is a +// non-regular bitwidth. test(int3 c) function return the value of the +// argument c. +// +//===----------------------------------------------------------------------===// + #include <stdio.h> typedef unsigned int __attribute__ ((bitwidth(7))) int7; @@ -31,7 +39,7 @@ for(i=0; i< ((unsigned char)zero) + 8; i++) { - c = (unsigned char)test(i); + c = (unsigned char)test((int3)i); if(c != i) printf("error: i=%hhd, c=%hhd\n", i, c); } Index: llvm-test/SingleSource/UnitTests/Integer/template.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.2 llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.3 --- llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/template.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- template.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for template functions. +// +//===------------------------------------------------------------------------===// + + #include <iostream> typedef int __attribute__ ((bitwidth(4))) int4; Index: llvm-test/SingleSource/UnitTests/Integer/template2.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.2 --- llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/template2.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- template2.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for template classes. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(26))) int26; Index: llvm-test/SingleSource/UnitTests/Integer/template3.cpp diff -u llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.1 llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.2 --- llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/template3.cpp Fri Jan 19 16:54:01 2007 @@ -1,3 +1,9 @@ +//===--- template3.cpp --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for partial specialization. +// +//===------------------------------------------------------------------------===// + #include <iostream> using namespace std; Index: llvm-test/SingleSource/UnitTests/Integer/union-init.c diff -u llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.2 llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/union-init.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- union-init.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for union initialization. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> Index: llvm-test/SingleSource/UnitTests/Integer/union-struct.c diff -u llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.2 llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.3 --- llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.2 Thu Jan 18 20:48:16 2007 +++ llvm-test/SingleSource/UnitTests/Integer/union-struct.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,11 @@ +//===--- union-struct.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for struct with union inside. The purpose is to see +// whether the size of the structure is correct. +// +//===------------------------------------------------------------------------===// + + #include <stdio.h> typedef int __attribute__ ((bitwidth(31))) int31; Index: llvm-test/SingleSource/UnitTests/Integer/union2.c diff -u llvm-test/SingleSource/UnitTests/Integer/union2.c:1.1 llvm-test/SingleSource/UnitTests/Integer/union2.c:1.2 --- llvm-test/SingleSource/UnitTests/Integer/union2.c:1.1 Thu Jan 18 20:22:46 2007 +++ llvm-test/SingleSource/UnitTests/Integer/union2.c Fri Jan 19 16:54:01 2007 @@ -1,3 +1,10 @@ +//===--- union2.c --- Test Cases for Bit Accurate Types -------------------------------===// +// +// This is a test for union type. By assigning values to different +// fields, we can check whether the assignment is correctly performed. +// +//===------------------------------------------------------------------------===// + #include <stdio.h> typedef int __attribute__ ((bitwidth(9))) int9; typedef int __attribute__ ((bitwidth(31))) int31; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits