150
|
1 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
|
|
2
|
|
3 // CHECK: @foo
|
|
4
|
|
5 // Make sure we mangle overloadable, even in C system headers.
|
|
6 # 1 "somesystemheader.h" 1 3 4
|
|
7 // CHECK: @_Z2f0i
|
|
8 void __attribute__((__overloadable__)) f0(int a) {}
|
|
9 // CHECK: @_Z2f0l
|
|
10 void __attribute__((__overloadable__)) f0(long b) {}
|
|
11
|
|
12 // Unless it's unmarked.
|
|
13 // CHECK: @f0
|
|
14 void f0(float b) {}
|
|
15
|
|
16 // CHECK: @bar
|
|
17
|
|
18 // These should get merged.
|
|
19 void foo() __asm__("bar");
|
|
20 void foo2() __asm__("bar");
|
|
21
|
|
22 int nux __asm__("foo");
|
|
23 extern float nux2 __asm__("foo");
|
|
24
|
|
25 int test() {
|
|
26 foo();
|
|
27 foo2();
|
|
28
|
|
29 return nux + nux2;
|
|
30 }
|
|
31
|
|
32
|
|
33 // Function becomes a variable.
|
|
34 void foo3() __asm__("var");
|
|
35
|
|
36 void test2() {
|
|
37 foo3();
|
|
38 }
|
|
39 int foo4 __asm__("var") = 4;
|
|
40
|
|
41
|
|
42 // Variable becomes a function
|
|
43 extern int foo5 __asm__("var2");
|
|
44
|
|
45 void test3() {
|
|
46 foo5 = 1;
|
|
47 }
|
|
48
|
|
49 void foo6() __asm__("var2");
|
|
50 void foo6() {
|
|
51 }
|
|
52
|
|
53
|
|
54
|
|
55 int foo7 __asm__("foo7") __attribute__((used));
|
|
56 float foo8 __asm__("foo7") = 42;
|
|
57
|
|
58 // PR4412
|
|
59 int func(void);
|
|
60 extern int func (void) __asm__ ("FUNC");
|
|
61
|
|
62 // CHECK: @FUNC
|
|
63 int func(void) {
|
|
64 return 42;
|
|
65 }
|
|
66
|
|
67 // CHECK: @_Z4foo9Dv4_f
|
|
68 typedef __attribute__(( vector_size(16) )) float float4;
|
|
69 void __attribute__((__overloadable__)) foo9(float4 f) {}
|
|
70
|
|
71 // Intrinsic calls.
|
|
72 extern int llvm_cas(volatile int*, int, int)
|
|
73 __asm__("llvm.atomic.cmp.swap.i32.p0i32");
|
|
74
|
|
75 int foo10(volatile int* add, int from, int to) {
|
|
76 // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32
|
|
77 return llvm_cas(add, from, to);
|
|
78 }
|