summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/const-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/const-init.c')
-rw-r--r--test/CodeGen/const-init.c61
1 files changed, 35 insertions, 26 deletions
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 0364cc1..29e9c55 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o %t %s &&
+// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o - %s | FileCheck %s
#include <stdint.h>
@@ -22,44 +22,57 @@ union s2 {
int g0 = (int)(&(((union s2 *) 0)->f0.f0) - 0);
-// RUN: grep '@g1x = global %. { double 1.000000e+00, double 0.000000e+00 }' %t &&
+// CHECK: @g1x = global {{%.}} { double 1.000000e+00{{[0]*}}, double 0.000000e+00{{[0]*}} }
_Complex double g1x = 1.0f;
-// RUN: grep '@g1y = global %. { double 0.000000e+00, double 1.000000e+00 }' %t &&
+// CHECK: @g1y = global {{%.}} { double 0.000000e+00{{[0]*}}, double 1.000000e+00{{[0]*}} }
_Complex double g1y = 1.0fi;
-// RUN: grep '@g1 = global %. { i8 1, i8 10 }' %t &&
+// CHECK: @g1 = global {{%.}} { i8 1, i8 10 }
_Complex char g1 = (char) 1 + (char) 10 * 1i;
-// RUN: grep '@g2 = global %2 { i32 1, i32 10 }' %t &&
+// CHECK: @g2 = global %2 { i32 1, i32 10 }
_Complex int g2 = 1 + 10i;
-// RUN: grep '@g3 = global %. { float 1.000000e+00, float 1.000000e+01 }' %t &&
+// CHECK: @g3 = global {{%.}} { float 1.000000e+00{{[0]*}}, float 1.000000e+0{{[0]*}}1 }
_Complex float g3 = 1.0 + 10.0i;
-// RUN: grep '@g4 = global %. { double 1.000000e+00, double 1.000000e+01 }' %t &&
+// CHECK: @g4 = global {{%.}} { double 1.000000e+00{{[0]*}}, double 1.000000e+0{{[0]*}}1 }
_Complex double g4 = 1.0 + 10.0i;
-// RUN: grep '@g5 = global %2 zeroinitializer' %t &&
+// CHECK: @g5 = global %2 zeroinitializer
_Complex int g5 = (2 + 3i) == (5 + 7i);
-// RUN: grep '@g6 = global %. { double -1.100000e+01, double 2.900000e+01 }' %t &&
+// CHECK: @g6 = global {{%.}} { double -1.100000e+0{{[0]*}}1, double 2.900000e+0{{[0]*}}1 }
_Complex double g6 = (2.0 + 3.0i) * (5.0 + 7.0i);
-// RUN: grep '@g7 = global i32 1' %t &&
+// CHECK: @g7 = global i32 1
int g7 = (2 + 3i) * (5 + 7i) == (-11 + 29i);
-// RUN: grep '@g8 = global i32 1' %t &&
+// CHECK: @g8 = global i32 1
int g8 = (2.0 + 3.0i) * (5.0 + 7.0i) == (-11.0 + 29.0i);
-// RUN: grep '@g9 = global i32 0' %t &&
+// CHECK: @g9 = global i32 0
int g9 = (2 + 3i) * (5 + 7i) != (-11 + 29i);
-// RUN: grep '@g10 = global i32 0' %t &&
+// CHECK: @g10 = global i32 0
int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
+// PR5108
+// CHECK: @gv1 = global %4 <{ i32 0, i8 7 }>, align 1
+struct {
+ unsigned long a;
+ unsigned long b:3;
+} __attribute__((__packed__)) gv1 = { .a = 0x0, .b = 7, };
+
+// PR5118
+// CHECK: @gv2 = global %5 <{ i8 1, i8* null }>, align 1
+struct {
+ unsigned char a;
+ char *b;
+} __attribute__((__packed__)) gv2 = { 1, (void*)0 };
// Global references
-// RUN: grep '@g11.l0 = internal global i32 ptrtoint (i32 ()\* @g11 to i32)' %t &&
+// CHECK: @g11.l0 = internal global i32 ptrtoint (i32 ()* @g11 to i32)
long g11() {
static long l0 = (long) g11;
return l0;
}
-// RUN: grep '@g12 = global i32 ptrtoint (i8\* @g12_tmp to i32)' %t &&
+// CHECK: @g12 = global i32 ptrtoint (i8* @g12_tmp to i32)
static char g12_tmp;
long g12 = (long) &g12_tmp;
-// RUN: grep '@g13 = global \[1 x .struct.g13_s0\] \[.struct.g13_s0 <{ i32 ptrtoint (i8\* @g12_tmp to i32) }>\]' %t &&
+// CHECK: @g13 = global [1 x %struct.g13_s0] [%struct.g13_s0 { i32 ptrtoint (i8* @g12_tmp to i32) }]
struct g13_s0 {
long a;
};
@@ -67,26 +80,25 @@ struct g13_s0 g13[] = {
{ (long) &g12_tmp }
};
-// RUN: grep '@g14 = global i8\* inttoptr (i64 100 to i8\*)' %t &&
+// CHECK: @g14 = global i8* inttoptr (i64 100 to i8*)
void *g14 = (void*) 100;
-// RUN: grep '@g15 = global i32 -1' %t &&
+// CHECK: @g15 = global i32 -1
int g15 = (int) (char) ((void*) 0 + 255);
-// RUN: grep '@g16 = global i64 4294967295' %t &&
+// CHECK: @g16 = global i64 4294967295
long long g16 = (long long) ((void*) 0xFFFFFFFF);
-// RUN: grep '@g17 = global i32\* @g15' %t &&
+// CHECK: @g17 = global i32* @g15
int *g17 = (int *) ((long) &g15);
-// RUN: grep '@g18.p = internal global \[1 x i32\*\] \[i32\* @g19\]' %t &&
+// CHECK: @g18.p = internal global [1 x i32*] [i32* @g19]
void g18(void) {
extern int g19;
static int *p[] = { &g19 };
}
-// RUN: grep '@g20.l0 = internal global .struct.g20_s1 <{ .struct.g20_s0\* null, .struct.g20_s0\*\* getelementptr (.struct.g20_s1\* @g20.l0, i32 0, i32 0) }>' %t &&
-
+// CHECK: @g20.l0 = internal global %struct.g20_s1 { %struct.g20_s0* null, %struct.g20_s0** getelementptr inbounds (%struct.g20_s1* @g20.l0, i32 0, i32 0) }
struct g20_s0;
struct g20_s1 {
struct g20_s0 *f0, **f1;
@@ -99,6 +111,3 @@ void *g20(void) {
// PR4108
struct g21 {int g21;};
const struct g21 g21 = (struct g21){1};
-
-// RUN: true
-
OpenPOWER on IntegriCloud