[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c arith.c array.c bigint.c bitbit.c bitlogic.c cppfield.cpp enum.cpp exception.cpp extern-inline-redef.c field.c folding.c global.c large-array.c list.c local-array.c local-union.c matrix.c memory.c offset.c override.cpp pointer.c static.c struct1.c struct2.c structInit.c switch.c template.cpp template2.cpp template3.cpp union-init.c union-struct.c union2.c
Guoling Han
han at autoesl.com
Mon Jan 22 16:17:37 PST 2007
Changes in directory llvm-test/SingleSource/UnitTests/Integer:
SSAtest.c updated: 1.5 -> 1.6
arith.c updated: 1.5 -> 1.6
array.c updated: 1.5 -> 1.6
bigint.c updated: 1.5 -> 1.6
bitbit.c updated: 1.5 -> 1.6
bitlogic.c updated: 1.5 -> 1.6
cppfield.cpp updated: 1.3 -> 1.4
enum.cpp updated: 1.5 -> 1.6
exception.cpp updated: 1.4 -> 1.5
extern-inline-redef.c updated: 1.5 -> 1.6
field.c updated: 1.4 -> 1.5
folding.c updated: 1.4 -> 1.5
global.c updated: 1.4 -> 1.5
large-array.c updated: 1.5 -> 1.6
list.c updated: 1.5 -> 1.6
local-array.c updated: 1.5 -> 1.6
local-union.c updated: 1.5 -> 1.6
matrix.c updated: 1.6 -> 1.7
memory.c updated: 1.5 -> 1.6
offset.c updated: 1.5 -> 1.6
override.cpp updated: 1.5 -> 1.6
pointer.c updated: 1.5 -> 1.6
static.c updated: 1.4 -> 1.5
struct1.c updated: 1.5 -> 1.6
struct2.c updated: 1.5 -> 1.6
structInit.c updated: 1.5 -> 1.6
switch.c updated: 1.5 -> 1.6
template.cpp updated: 1.6 -> 1.7
template2.cpp updated: 1.4 -> 1.5
template3.cpp updated: 1.5 -> 1.6
union-init.c updated: 1.5 -> 1.6
union-struct.c updated: 1.5 -> 1.6
union2.c updated: 1.4 -> 1.5
---
Log message:
Change the files to make them fit the required coding style
---
Diffs of the changes: (+665 -647)
SSAtest.c | 12 ++-
arith.c | 19 ++---
array.c | 50 +++++++--------
bigint.c | 36 +++++------
bitbit.c | 27 ++++----
bitlogic.c | 25 +++----
cppfield.cpp | 59 +++++++++---------
enum.cpp | 30 ++++-----
exception.cpp | 59 ++++++++----------
extern-inline-redef.c | 14 ++--
field.c | 44 +++++++------
folding.c | 56 +++++++++--------
global.c | 36 +++++------
large-array.c | 63 ++++++++++---------
list.c | 70 +++++++++++-----------
local-array.c | 26 ++++----
local-union.c | 24 +++----
matrix.c | 159 ++++++++++++++++++++++++--------------------------
memory.c | 46 +++++++-------
offset.c | 18 ++---
override.cpp | 19 +++--
pointer.c | 28 +++++---
static.c | 34 +++++-----
struct1.c | 17 ++---
struct2.c | 15 ++--
structInit.c | 20 +++---
switch.c | 49 +++++++--------
template.cpp | 59 +++++++++---------
template2.cpp | 58 +++++++++---------
template3.cpp | 44 +++++++------
union-init.c | 39 +++++-------
union-struct.c | 23 +++----
union2.c | 34 +++++-----
33 files changed, 665 insertions(+), 647 deletions(-)
Index: llvm-test/SingleSource/UnitTests/Integer/SSAtest.c
diff -u llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.5 llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/SSAtest.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/SSAtest.c Mon Jan 22 18:17:21 2007
@@ -1,14 +1,16 @@
//===--- SSAtest.c --- Test Cases for Bit Accurate Types ------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// This file was developed by Guoling Han and is distributed under the
+// University of Illinois Open Source License. See LICENSE.TXT for details.
+//
//===----------------------------------------------------------------------===//
//
// Adopted the test from previous test-cases. Changed it with
// non-regular int data type.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(4))) int4;
@@ -32,6 +34,6 @@
int main()
{
- foo();
- return 0;
+ foo();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/arith.c
diff -u llvm-test/SingleSource/UnitTests/Integer/arith.c:1.5 llvm-test/SingleSource/UnitTests/Integer/arith.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/arith.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/arith.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- arith.c --- Test Cases for Bit Accurate Types --------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a general test for arithmetic operations.
@@ -16,9 +16,8 @@
int21 x = 0x1fffff;
int21 y = 0x0fffff;
-// Module | Test
-// Thread: int my_test();
-int my_test(){
+
+int my_test()
{
uint10 i = 0;
int10 j;
@@ -72,12 +71,12 @@
i_temp = ui_x - ui_y;
printf("i_temp = %x\n", i_temp);
return 0;
-}
+
}
int main()
{
- my_test();
- return 0;
+ my_test();
+ return 0;
}
-// End of Module | Test
+
Index: llvm-test/SingleSource/UnitTests/Integer/array.c
diff -u llvm-test/SingleSource/UnitTests/Integer/array.c:1.5 llvm-test/SingleSource/UnitTests/Integer/array.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/array.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/array.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- array.c --- Test Cases for Bit Accurate Types --------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a general test for array data types.
@@ -15,37 +15,37 @@
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;
+ int33 array[8];
+ unsigned int i = 0;
+ long long tmp;
{
- array[i] = -(i + 1);
- tmp = array[i];
- printf("i=%u: %x\n", i, 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;
+ }
}
- ++i;
- }
+ int33* ptr;
+ ptr = &array[7];
+ *ptr = array[1] % array[0];
+ tmp = *ptr;
+ printf("%x\n", tmp);
+ return 0;
}
- int33* ptr;
- ptr = &array[7];
- *ptr = array[1] % array[0];
- tmp = *ptr;
- printf("%x\n", tmp);
- return 0;
-}
}
int main()
{
- my_test();
- return 0;
+ my_test();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/bigint.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.5 llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/bigint.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bigint.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- bigint.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a general test for big integer type.
@@ -16,12 +16,10 @@
const uint10 bnd = 1023;
-int169 x = 0xffffffff;
+int169 x = 0xffffffffULL;
+int169 y = -0xabcdefdeULL;
-int169 y = -0xabcdefde;
-// Module | Test
-// Thread: int my_test();
-int my_test(){
+int my_test()
{
uint10 i = 0;
int169 result;
@@ -29,17 +27,17 @@
long long rem;
long long rem2;
{
- ;/*NULL statement*/
- for ( ; ; ) {
- bool ssdm_tmp_1 = (i < bnd);
- if (!ssdm_tmp_1) break;
- if (i % 2 == 0)
+ ;
+ for ( ; ; ) {
+ bool ssdm_tmp_1 = (i < bnd);
+ if (!ssdm_tmp_1) break;
+ if (i % 2 == 0)
x = x + 1;
- else
- y = y - x;
+ else
+ y = y - x;
- ++i;
- }
+ ++i;
+ }
}
result = x*y;
l_result = result % 0x37015;
@@ -54,8 +52,8 @@
int main()
{
- my_test();
- return 0;
+ my_test();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/bitbit.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.5 llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/bitbit.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bitbit.c Mon Jan 22 18:17:21 2007
@@ -1,18 +1,19 @@
//===--- bitbit.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a general test for bit operations.
//
//===----------------------------------------------------------------------===//
+
#include "bitbit.h"
#include <stdio.h>
-int my_test(){
+int my_test()
{
int21 x = 0x1fffff;
int21 y = 0x0fffff;
@@ -27,27 +28,27 @@
result = x & y;
if (result == y)
printf("ok\n");
- else
+ else
printf("fail\n");
result = x | y;
if (result == x)
printf("ok\n");
- else
+ else
printf("fail\n");
result = x;
result &= y;
if (result == y)
printf("ok\n");
- else
+ else
printf("fail\n");
result = x;
result |= y;
if (result == x)
printf("ok\n");
- else
+ else
printf("fail\n");
result = x >> 20;
@@ -58,7 +59,7 @@
result += 1;
if (result != x)
printf("fail\n");
- else
+ else
printf("ok\n");
result = y;
@@ -67,17 +68,17 @@
if (result != x)
printf("fail\n");
- else
+ else
printf("ok\n");
}
return 0;
-}
+
}
int main()
{
- my_test();
- return 0;
+ my_test();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/bitlogic.c
diff -u llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.5 llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/bitlogic.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/bitlogic.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- bitlogic.c --- Test Cases for Bit Accurate Types -----------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a general test for logical operations.
@@ -12,9 +12,8 @@
#include "bitlogic.h"
#include <stdio.h>
-// Module | Test
-// Thread: int my_test();
-int my_test(){
+
+int my_test()
{
uint1 x = 0x1;
uint1 y;
@@ -25,32 +24,32 @@
y -= 1;
if (!y)
printf("ok\n");
- else
+ else
printf("fail\n");
if (y > x)
printf("fail\n");
- else
+ else
printf("ok\n");
if (z != uz)
printf("ok\n");
- else
+ else
printf("fail\n");
temp = z;
if (temp <= uz)
printf("ok\n");
- else
+ else
printf("fail\n");
return 0;
-}
+
}
int main()
{
- my_test();
- return 0;
+ my_test();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp:1.3 llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp:1.4
--- llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp:1.3 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/cppfield.cpp Mon Jan 22 18:17:21 2007
@@ -1,54 +1,57 @@
//===-- cppfield.cpp - Test C++ Fields With Bit Accurate Types ------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for conversion between different int types.
//
+//===----------------------------------------------------------------------===//
+
+
#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;
+ public:
+ int i;
+ unsigned char c:7;
+ int s:17;
+ char c2;
};
class myStruct2{
- public:
- int32 i;
- int7 c;
- int17 s;
- int8 c2;
+ public:
+ int32 i;
+ int7 c;
+ int17 s;
+ int8 c2;
};
int main()
{
- myStruct x;
- myStruct2 y;
-
- char* ptrc, *ptrc1, *ptrc2, *ptrc3;
- unsigned int offset, offset1;
+ myStruct x;
+ myStruct2 y;
- ptrc = (char*)&(x.i);
- ptrc1 = (char*)&(x.c2);
+ 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);
+ ptrc2 = (char*)&(y.i);
+ ptrc3 = (char*)&(y.c2);
- offset = ptrc1 - ptrc;
- offset1 = ptrc3 - ptrc2;
+ offset = ptrc1 - ptrc;
+ offset1 = ptrc3 - ptrc2;
- if(offset != offset1 || sizeof(myStruct) != sizeof(myStruct2))
- printf("error\n");
+ if(offset != offset1 || sizeof(myStruct) != sizeof(myStruct2))
+ printf("error\n");
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/enum.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.5 llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.6
--- llvm-test/SingleSource/UnitTests/Integer/enum.cpp:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/enum.cpp Mon Jan 22 18:17:21 2007
@@ -1,34 +1,34 @@
//===--- enum.cpp --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test of bitwidth attribute with enum data.
//
//===----------------------------------------------------------------------===//
+
+
#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;}
+ 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);
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/exception.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.4 llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.5
--- llvm-test/SingleSource/UnitTests/Integer/exception.cpp:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/exception.cpp Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- exception.cpp --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test of exception handling with non-regular data
@@ -10,7 +10,9 @@
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
+
typedef int __attribute__ ((bitwidth(31))) int31;
typedef int __attribute__ ((bitwidth(1))) int1;
typedef int __attribute__ ((bitwidth(7))) int7;
@@ -20,39 +22,30 @@
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;
+ 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");
- }
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c
diff -u llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.5 llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/extern-inline-redef.c Mon Jan 22 18:17:21 2007
@@ -1,30 +1,32 @@
//===--- extern_inline_redef.c --- Test Cases for Bit Accurate Types ------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 used to test redefining inline function.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(61))) int61;
extern __inline int61
-__strtol_l (int a)
+ __strtol_l (int a)
{
return 0;
}
int61
-__strtol_l (int a)
+ __strtol_l (int a)
{
return 0;
}
int main()
{
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/field.c
diff -u llvm-test/SingleSource/UnitTests/Integer/field.c:1.4 llvm-test/SingleSource/UnitTests/Integer/field.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/field.c:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/field.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- field.c --- Test Cases for Bit Accurate Types --------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 used to test struct with field specifier. We suppose the
@@ -10,7 +10,11 @@
// struct using bit accurate types.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
+
+
typedef int __attribute__ ((bitwidth(7))) int7;
typedef int __attribute__ ((bitwidth(17))) int17;
typedef int __attribute__ ((bitwidth(32))) int32;
@@ -26,28 +30,26 @@
int main()
{
- myStruct x;
- myStruct2 y;
+ myStruct x;
+ myStruct2 y;
- void* ptr, *ptr1, *ptr2, *ptr3;
- unsigned int offset, offset1;
+ void* ptr, *ptr1, *ptr2, *ptr3;
+ unsigned int offset, offset1;
- // printf("sizeof(int7) = %d, sizeof(int17) = %d, sizeof(int33) = %d\n",
- // sizeof(char7), sizeof(short17), sizeof(long33));
- ptr = &(x.i);
- ptr1 = &(x.c2);
+ ptr = &(x.i);
+ ptr1 = &(x.c2);
- ptr2 = &(y.i);
- ptr3 = &(y.c2);
+ ptr2 = &(y.i);
+ ptr3 = &(y.c2);
- offset = ptr1 - ptr;
- offset1 = ptr3 - ptr2;
+ 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));
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/folding.c
diff -u llvm-test/SingleSource/UnitTests/Integer/folding.c:1.4 llvm-test/SingleSource/UnitTests/Integer/folding.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/folding.c:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/folding.c Mon Jan 22 18:17:21 2007
@@ -1,15 +1,17 @@
-//===--- folding.c --- Test Cases for Bit Accurate Types ------------------===//
+//===--- folding.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 file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
//===----------------------------------------------------------------------===//
//
// 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;
@@ -19,29 +21,29 @@
int main()
{
- int7 x;
- int7 y;
- int15 z;
- uint7 u;
+ int7 x;
+ int7 y;
+ int15 z;
+ uint7 u;
- x = myConst << 3; // constant 8
- y = x + myConst; // constant 9
- if(y -x != 1)
- printf("error1: x = %d, y = %d\n", x, y);
-
- x = myConst << 7; // constant 0
- if(y -x != 9)
- printf("error2: x = %d, y = %d\n", x, y);
-
- z = (int15) y;
- z &= myConst2;
- if(z != 0x9)
- 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);
+ x = myConst << 3; // constant 8
+ y = x + myConst; // constant 9
+ if(y -x != 1)
+ printf("error1: x = %d, y = %d\n", x, y);
+
+ x = myConst << 7; // constant 0
+ if(y -x != 9)
+ printf("error2: x = %d, y = %d\n", x, y);
+
+ z = (int15) y;
+ z &= myConst2;
+ if(z != 0x9)
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/global.c
diff -u llvm-test/SingleSource/UnitTests/Integer/global.c:1.4 llvm-test/SingleSource/UnitTests/Integer/global.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/global.c:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/global.c Mon Jan 22 18:17:21 2007
@@ -1,15 +1,18 @@
//===--- global.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 used to test global arrays.
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
+
+
typedef int __attribute__ ((bitwidth(7))) int7;
typedef int __attribute__ ((bitwidth(14))) int14;
@@ -18,22 +21,21 @@
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 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;
+ 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/large-array.c
diff -u llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.5 llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/large-array.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/large-array.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- large-array.c --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 used to test large local arrays. Some local arrays are
@@ -16,40 +16,41 @@
typedef int __attribute__ ((bitwidth(13))) int13;
-int13 test(int13 x) {
+int13 test(int13 x)
+{
const int13 XX[1000] = { 0, 0 };
const char S [1000] = "foo";
const int13 array[] = {
- 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,
- 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];
+ 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,
+ 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) != 53)
- printf("error\n");
- if(test(2) != 523)
- printf("error2\n");
- return 0;
+ if(test(1) != 53)
+ printf("error\n");
+ 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.5 llvm-test/SingleSource/UnitTests/Integer/list.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/list.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/list.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- list.c --- Test Cases for Bit Accurate Types ---------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for simple linked list operation. Data are added to
@@ -39,44 +39,44 @@
void test()
{
- unsigned int i=0;
- unsigned int cnt = sizeof(array)/sizeof(*array);
+ unsigned int i=0;
+ unsigned int cnt = sizeof(array)/sizeof(*array);
- myList* head = 0;
+ 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);
- }
+ 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;
+ test();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/local-array.c
diff -u llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.5 llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/local-array.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/local-array.c Mon Jan 22 18:17:21 2007
@@ -1,13 +1,15 @@
//===--- local-array.c --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 local arrays.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(4))) int4;
@@ -15,20 +17,20 @@
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 };
+ 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);
+ int4 result = test(31);
+ if(result != 4)
+ printf("error: return = %d\n", result);
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/local-union.c
diff -u llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.5 llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/local-union.c:1.5 Mon Jan 22 15:04:54 2007
+++ llvm-test/SingleSource/UnitTests/Integer/local-union.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- local-union.c --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for local union data type.
@@ -15,19 +15,17 @@
union foo { int X; int33 Y;};
-double test(union foo* F) {
- {
- union foo { float X; int33 Y;} A;
- A.Y = 0x1ffffffffULL;
- return A.X;
- }
+double test(union foo* F)
+{
+ union foo { float X; int33 Y;} A;
+ A.Y = 0x1ffffffffULL;
+ return A.X;
}
int main()
{
- union foo F;
+ union foo F;
- printf("return = %f\n", test(&F));
-
- return 0;
+ printf("return = %f\n", test(&F));
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/matrix.c
diff -u llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.6 llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.7
--- llvm-test/SingleSource/UnitTests/Integer/matrix.c:1.6 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/matrix.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- matrix.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for matrix with non-regular bitwidth data. In
@@ -11,60 +11,57 @@
// two largest elements are used to get the gcd.
//
//===----------------------------------------------------------------------===//
+
+
#include "matrix.h"
#include <stdio.h>
#include <stdlib.h>
typedef enum bool{false=0, true=1} bool;
-
-
-
-
-
void mysort(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++;
- }
+ 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 ( ; ;j++ ) {
- bool ssdm_tmp_5 = (j < 8);
- if (!ssdm_tmp_5) break;
- {
- i = j;
- for ( ; ; i++) {
- bool ssdm_tmp_6 = (i < 8);
- if (!ssdm_tmp_6) break;
- {
- if(Y[i]>Y[j]){
- temp = Y[j];
- Y[j] = Y[i];
- Y[i] = temp;
- }
-
- }
- }
+ }
+ {
+ j = 0;
+ for ( ; ;j++ ) {
+ bool ssdm_tmp_5 = (j < 8);
+ if (!ssdm_tmp_5) break;
+ {
+ i = j;
+ for ( ; ; i++) {
+ bool ssdm_tmp_6 = (i < 8);
+ if (!ssdm_tmp_6) break;
+ {
+ if(Y[i]>Y[j]){
+ temp = Y[j];
+ Y[j] = Y[i];
+ Y[i] = temp;
}
-
+
+ }
}
+ }
+
}
+ }
}
int get_gcd(const int a, const int b)
{
- if (b == 0)
+ if (b == 0)
return a;
return get_gcd( b, a % b );
@@ -74,44 +71,44 @@
int my_test(int17 A[8][8], int17 B[8][8])
{
- unsigned int i, j, k, dd;
- int17 C[8][8];
- int17 D[8];
- int t;
- {
- i = 0;
+ unsigned int i, j, k, dd;
+ int17 C[8][8];
+ int17 D[8];
+ int t;
+ {
+ i = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_1 = (i < 8);
+ if (!ssdm_tmp_1) break;
+ {
+ j = 0;
for ( ; ; ) {
- bool ssdm_tmp_1 = (i < 8);
- if (!ssdm_tmp_1) break;
+ bool ssdm_tmp_2 = (j < 8);
+ if (!ssdm_tmp_2) break;
+ {
{
- j = 0;
- for ( ; ; ) {
- bool ssdm_tmp_2 = (j < 8);
- if (!ssdm_tmp_2) break;
- {
- {
- C[i][j] = 0;
- k = 0;
- for ( ; ; ) {
- bool ssdm_tmp_3 = (k < 8);
- if (!ssdm_tmp_3) break;
- C[i][j] += A[i][k] * B[k][j];
- ++k;
- }
- }
+ C[i][j] = 0;
+ k = 0;
+ for ( ; ; ) {
+ bool ssdm_tmp_3 = (k < 8);
+ if (!ssdm_tmp_3) break;
+ C[i][j] += A[i][k] * B[k][j];
+ ++k;
+ }
+ }
- }
+ }
- ++j;
- }
- }
- mysort(C[i], D);
- t = get_gcd(D[0], D[1]);
- printf("get_gcd(%d, %d) = %d\n", D[0], D[1], t);
- ++i;
+ ++j;
}
+ }
+ mysort(C[i], D);
+ t = get_gcd(D[0], D[1]);
+ printf("get_gcd(%d, %d) = %d\n", D[0], D[1], t);
+ ++i;
}
- return 0;
+ }
+ return 0;
}
@@ -119,19 +116,19 @@
int main()
{
- int i, j;
+ int i, j;
- int17 X[8][8];
- int17 Y[8][8];
+ 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);
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/memory.c
diff -u llvm-test/SingleSource/UnitTests/Integer/memory.c:1.5 llvm-test/SingleSource/UnitTests/Integer/memory.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/memory.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/memory.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- memory.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for memory malloc and free operations. It tests
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
#include <stdlib.h>
@@ -20,34 +21,33 @@
void mem_test(int31 num)
{
- int inum = num;
- unsigned int i = 0;
+ int inum = num;
+ unsigned int i = 0;
- int31* array = (int31*) malloc(sizeof(int31) * inum);
- for(i=0; i< num; ++i)
- {
- array[i] = i;
- }
+ int31* array = (int31*) malloc(sizeof(int31) * inum);
+ for(i=0; i< num; ++i){
+ array[i] = i;
+ }
- free(array);
+ free(array);
}
void mem_test2()
{
- myStruct* ptr = malloc(sizeof(myStruct));
- ptr->y = 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);
+ myStruct* ptr = malloc(sizeof(myStruct));
+ ptr->y = 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;
+ mem_test(0xff);
+ mem_test2();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/offset.c
diff -u llvm-test/SingleSource/UnitTests/Integer/offset.c:1.5 llvm-test/SingleSource/UnitTests/Integer/offset.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/offset.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/offset.c Mon Jan 22 18:17:21 2007
@@ -1,29 +1,27 @@
//===--- offset.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for data size calculation with non-regular integral type.
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(33))) int33;
-struct s {
- int33 field[0];
-};
+struct s { int33 field[0]; };
-#define OFFS \
- (((char *) &((struct s *) 0)->field[1]) - (char *) 0)
+#define OFFS (((char *) &((struct s *) 0)->field[1]) - (char *) 0)
int foo[OFFS];
int main()
{
- printf("%d\n", OFFS);
- return 0;
+ printf("%d\n", OFFS);
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/override.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.5 llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.6
--- llvm-test/SingleSource/UnitTests/Integer/override.cpp:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/override.cpp Mon Jan 22 18:17:21 2007
@@ -1,30 +1,33 @@
//===--- override.cpp --- Test Cases for Bit Accurate Types ---------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test of override test.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
+
typedef int __attribute__ ((bitwidth(31))) int31;
typedef int __attribute__ ((bitwidth(32))) int32;
void func(int32 i)
{
- printf("call func with int32: %d\n", (int)i);
+ printf("call func with int32: %d\n", (int)i);
}
void func(int31 s)
{
- printf("call func with int31: %d\n", (int)s);
+ printf("call func with int31: %d\n", (int)s);
}
int main()
{
- func( (int31) 1);
- func( (int32) 2);
- return 0;
+ func( (int31) 1);
+ func( (int32) 2);
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/pointer.c
diff -u llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.5 llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/pointer.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/pointer.c Mon Jan 22 18:17:21 2007
@@ -1,36 +1,40 @@
//===--- pointer.c --- Test Cases for Bit Accurate Types ------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for address calculation with non-regular integral type.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(3))) int3;
typedef int __attribute__ ((bitwidth(31))) int31;
-int3 *test(int3* C) {
+int3 *test(int3* C)
+{
return C-1;
}
-int31 *test2(int31* I) {
+int31 *test2(int31* I)
+{
return I-1;
}
int main()
{
- int3 i3;
- int31 i31;
+ int3 i3;
+ int31 i31;
- if(&i3 != (test(&i3) + 1))
- printf("error\n");
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/static.c
diff -u llvm-test/SingleSource/UnitTests/Integer/static.c:1.4 llvm-test/SingleSource/UnitTests/Integer/static.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/static.c:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/static.c Mon Jan 22 18:17:21 2007
@@ -1,34 +1,36 @@
//===--- static.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for static data with non-regular integral data.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
-typedef int __attribute__ ((bitwidth(31))) int31;
+typedef int __attribute__ ((bitwidth(31))) int31;
int31 test(int31 y, int31* z)
{
- static int31 x = 0;
- *z = x;
- x = y;
- return x;
+ 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;
+ 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/struct1.c
diff -u llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.5 llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/struct1.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/struct1.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- struct1.c --- Test Cases for Bit Accurate Types ------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for struct data structure. If the data layout for
@@ -11,13 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include <stdio.h>
typedef int __attribute__ ((bitwidth(33))) int33;
struct foo A;
-
struct foo {
int33 x;
double D;
@@ -25,9 +24,9 @@
int main()
{
- A.D = -3.141593;
- A.x = -1;
- printf("%f\n", A.D);
+ A.D = -3.141593;
+ A.x = -1;
+ printf("%f\n", A.D);
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/struct2.c
diff -u llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.5 llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/struct2.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/struct2.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- struct2.c --- Test Cases for Bit Accurate Types ------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for struct data structure. We test the nested structure
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(33))) int33;
@@ -34,9 +35,9 @@
int main()
{
- assign();
- if(G.pInfo != G.info)
- printf("error\n");
+ assign();
+ if(G.pInfo != G.info)
+ printf("error\n");
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/structInit.c
diff -u llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.5 llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/structInit.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/structInit.c Mon Jan 22 18:17:21 2007
@@ -1,22 +1,24 @@
//===--- structInit.c --- Test Cases for Bit Accurate Types ---------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for struct data structure with initialization.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(31))) int31;
typedef int __attribute__ ((bitwidth(24))) int24;
typedef struct Connection_Type {
- int24 to;
+ int24 to;
char type[10];
- int31 length;
+ int31 length;
} Connection;
Connection link[3]
@@ -27,9 +29,9 @@
int main()
{
- int24 l;
- for(l=0; l<3; l++)
- printf("%d, %s, %d\n", link[l].to, link[l].type, link[l].length);
+ int24 l;
+ for(l=0; l<3; l++)
+ printf("%d, %s, %d\n", link[l].to, link[l].type, link[l].length);
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/switch.c
diff -u llvm-test/SingleSource/UnitTests/Integer/switch.c:1.5 llvm-test/SingleSource/UnitTests/Integer/switch.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/switch.c:1.5 Mon Jan 22 15:06:21 2007
+++ llvm-test/SingleSource/UnitTests/Integer/switch.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- switch.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for switch statement. The switch value is a
@@ -10,6 +10,8 @@
// argument c.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef unsigned int __attribute__ ((bitwidth(7))) int7;
@@ -21,31 +23,30 @@
int3 test(int3 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;
+ 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;
+ unsigned char c;
+ unsigned char i;
- for(i=0; i< ((unsigned char)zero) + 8; i++)
- {
- c = (unsigned char)test((int3)i);
- if(c != i)
- printf("error: i=%hhd, c=%hhd\n", i, c);
- }
- return 0;
+ for(i=0; i< ((unsigned char)zero) + 8; i++){
+ c = (unsigned char)test((int3)i);
+ if(c != i)
+ printf("error: i=%hhd, c=%hhd\n", i, c);
+ }
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/template.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.6 llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.7
--- llvm-test/SingleSource/UnitTests/Integer/template.cpp:1.6 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/template.cpp Mon Jan 22 18:17:21 2007
@@ -1,55 +1,56 @@
//===--- template.cpp --- Test Cases for Bit Accurate Types ---------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for template functions.
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(4))) int4;
typedef unsigned int __attribute__ ((bitwidth(5))) int5;
template <class T>
-T& min(T &tParam1, T &tParam2)
+ T& min(T &tParam1, T &tParam2)
{
- if(tParam1 < tParam2)
- return tParam1;
- else
- return tParam2;
+ if(tParam1 < tParam2)
+ return tParam1;
+ else
+ return tParam2;
}
template <class T>
-T& min(T &tParam1, T &tParam2, T &tParam3)
+ T& min(T &tParam1, T &tParam2, T &tParam3)
{
- if(min(tParam1, tParam2) < tParam3)
- return min(tParam1, tParam2) ;
- else
- return tParam3;
+ if(min(tParam1, tParam2) < tParam3)
+ return min(tParam1, tParam2) ;
+ else
+ return tParam3;
}
int main()
{
- int4 x , y, z;
+ 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;
+ 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);
+ m = min(f, g);
+ printf("min = %x\n", m);
}
Index: llvm-test/SingleSource/UnitTests/Integer/template2.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.4 llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.5
--- llvm-test/SingleSource/UnitTests/Integer/template2.cpp:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/template2.cpp Mon Jan 22 18:17:21 2007
@@ -1,63 +1,65 @@
//===--- template2.cpp --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for template classes.
//
//===----------------------------------------------------------------------===//
+
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(26))) int26;
template <typename T>
-class MyQueue
-{
+ class MyQueue
+ {
T data[128];
unsigned int idx;
- public:
+ public:
MyQueue(): idx(0){}
- void Add(T const &);
- void Remove();
- void Print();
-};
+ 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;
- }
+ if(idx < 128 ){
+ data[idx] = d;
+ idx += 1;
+ }
}
template <typename T> void MyQueue<T>::Remove()
{
- if(idx != 0)
- idx -= 1;
+ 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");
+ for(unsigned int i = 0; i< idx; i++){
+ int m = data[i];
+ printf("%d, ", m);
+ }
+ printf("\n");
}
int main()
{
- MyQueue<int26> q;
+ MyQueue<int26> q;
- q.Add(-1);
- q.Add(2);
- q.Print();
+ q.Add(-1);
+ q.Add(2);
+ q.Print();
- q.Remove();
- q.Print();
+ q.Remove();
+ q.Print();
- return 0;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/template3.cpp
diff -u llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.5 llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.6
--- llvm-test/SingleSource/UnitTests/Integer/template3.cpp:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/template3.cpp Mon Jan 22 18:17:21 2007
@@ -1,45 +1,49 @@
//===--- template3.cpp --- Test Cases for Bit Accurate Types --------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for partial specialization.
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include <stdio.h>
typedef int __attribute__ ((bitwidth(17))) int17;
typedef int __attribute__ ((bitwidth(15))) int15;
template<class T, class U, int I> struct X
- { void f() { printf("Primary template\n"); } };
+{ void f() { printf("Primary template\n"); } };
template<class T, int I> struct X<T, T*, I>
- { void f() { printf("Partial specialization 1\n"); } };
+{ void f() { printf("Partial specialization 1\n"); } };
template<class T, class U, int I> struct X<T*, U, I>
- { void f() { printf("Partial specialization 2\n"); } };
+{ void f() { printf("Partial specialization 2\n"); } };
template<class T> struct X<int, T*, 10>
- { void f() { printf("Partial specialization 3\n"); } };
+{ void f() { printf("Partial specialization 3\n"); } };
template<class T, class U, int I> struct X<T, U*, I>
- { void f() { printf("Partial specialization 4\n"); } };
+{ void f() { printf("Partial specialization 4\n"); } };
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;
+ 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;
+
+ a.f();
+ b.f();
+ bb.f();
+ c.f();
+ d.f();
+ e.f();
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/union-init.c
diff -u llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.5 llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/union-init.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/union-init.c Mon Jan 22 18:17:21 2007
@@ -1,44 +1,43 @@
//===--- union-init.c --- Test Cases for Bit Accurate Types ---------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for union initialization.
//
//===----------------------------------------------------------------------===//
-#include <stdio.h>
+#include <stdio.h>
typedef int __attribute__ ((bitwidth(33))) int33;
-
struct Foo {
- int33 a;
- int33 b;
- int33 c;
+ int33 a;
+ int33 b;
+ int33 c;
};
struct Bar {
- union {
- void **a;
- struct Foo b;
- }u;
+ 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);
+ 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;
+ return 0;
}
Index: llvm-test/SingleSource/UnitTests/Integer/union-struct.c
diff -u llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.5 llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.6
--- llvm-test/SingleSource/UnitTests/Integer/union-struct.c:1.5 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/union-struct.c Mon Jan 22 18:17:21 2007
@@ -1,8 +1,8 @@
//===--- union-struct.c --- Test Cases for Bit Accurate Types -------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 a test for struct with union inside. The purpose is to see
@@ -10,25 +10,24 @@
//
//===----------------------------------------------------------------------===//
+
#include <stdio.h>
typedef int __attribute__ ((bitwidth(31))) int31;
struct Blend_Map_Entry {
union {
- float Colour[5];
- double Point_Slope[2];
- int31 weight[5];
+ 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;
+ 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/union2.c
diff -u llvm-test/SingleSource/UnitTests/Integer/union2.c:1.4 llvm-test/SingleSource/UnitTests/Integer/union2.c:1.5
--- llvm-test/SingleSource/UnitTests/Integer/union2.c:1.4 Mon Jan 22 15:07:53 2007
+++ llvm-test/SingleSource/UnitTests/Integer/union2.c Mon Jan 22 18:17:21 2007
@@ -1,15 +1,18 @@
//===--- union2.c --- Test Cases for Bit Accurate Types -------------------===//
//
-// This file was developed by Guoling han and donated to the LLVM research
-// group and is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 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;
typedef union {short i; int9 i9; int31 i31;} myUnion;
@@ -17,26 +20,25 @@
myStruct test(myUnion u)
{
- myStruct x;
+ myStruct x;
- u.i31 = 0;
- u.i = 0xffff;
- int9* ptr = &(u.i9);
- *ptr= 0x00;
+ u.i31 = 0;
+ u.i = 0xffff;
+ int9* ptr = &(u.i9);
+ *ptr= 0x00;
- x.ptr = ptr;
- x.i = u.i;
+ x.ptr = ptr;
+ x.i = u.i;
- return x;
-
+ 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;
+ myStruct s = test(uu);
+ if(s.i == 0x0)
+ printf("error: s.i=%x\n", s.i);
+ return 0;
}
More information about the llvm-commits
mailing list