xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/asm-label.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple=i686-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple=i686-apple-darwin9 -emit-llvm %s -o - | FileCheck %s --check-prefix=DARWIN
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc char *strerror(int) asm("alias");
5*f4a2713aSLionel Sambuc int x __asm("foo");
6*f4a2713aSLionel Sambuc 
test(void)7*f4a2713aSLionel Sambuc int *test(void) {
8*f4a2713aSLionel Sambuc   static int y __asm("bar");
9*f4a2713aSLionel Sambuc   strerror(-1);
10*f4a2713aSLionel Sambuc   return &y;
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // LINUX: @bar = internal global i32 0
14*f4a2713aSLionel Sambuc // LINUX: @foo = common global i32 0
15*f4a2713aSLionel Sambuc // LINUX: declare i8* @alias(i32)
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // DARWIN: @"\01bar" = internal global i32 0
18*f4a2713aSLionel Sambuc // DARWIN: @"\01foo" = common global i32 0
19*f4a2713aSLionel Sambuc // DARWIN: declare i8* @"\01alias"(i32)
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc // PR7887
22*f4a2713aSLionel Sambuc int pr7887_1 asm("");
23*f4a2713aSLionel Sambuc extern int pr7887_2 asm("");
24*f4a2713aSLionel Sambuc int pr7887_3 () asm("");
25*f4a2713aSLionel Sambuc 
pt7887_4()26*f4a2713aSLionel Sambuc int pt7887_4 () {
27*f4a2713aSLionel Sambuc   static int y asm("");
28*f4a2713aSLionel Sambuc   y = pr7887_3();
29*f4a2713aSLionel Sambuc   pr7887_2 = 1;
30*f4a2713aSLionel Sambuc   return pr7887_1;
31*f4a2713aSLionel Sambuc }
32