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 8void __attribute__((__overloadable__)) f0(int a) {} 9// CHECK: @_Z2f0l 10void __attribute__((__overloadable__)) f0(long b) {} 11 12// CHECK: @bar 13 14// These should get merged. 15void foo() __asm__("bar"); 16void foo2() __asm__("bar"); 17 18int nux __asm__("foo"); 19extern float nux2 __asm__("foo"); 20 21int test() { 22 foo(); 23 foo2(); 24 25 return nux + nux2; 26} 27 28 29// Function becomes a variable. 30void foo3() __asm__("var"); 31 32void test2() { 33 foo3(); 34} 35int foo4 __asm__("var") = 4; 36 37 38// Variable becomes a function 39extern int foo5 __asm__("var2"); 40 41void test3() { 42 foo5 = 1; 43} 44 45void foo6() __asm__("var2"); 46void foo6() { 47} 48 49 50 51int foo7 __asm__("foo7") __attribute__((used)); 52float foo8 __asm__("foo7") = 42; 53 54// PR4412 55int func(void); 56extern int func (void) __asm__ ("FUNC"); 57 58// CHECK: @FUNC 59int func(void) { 60 return 42; 61} 62 63// CHECK: @_Z4foo9Dv4_f 64typedef __attribute__(( vector_size(16) )) float float4; 65void __attribute__((__overloadable__)) foo9(float4 f) {} 66 67// Intrinsic calls. 68extern int llvm_cas(volatile int*, int, int) 69 __asm__("llvm.atomic.cmp.swap.i32.p0i32"); 70 71int foo10(volatile int* add, int from, int to) { 72 // CHECK: call i32 @llvm.atomic.cmp.swap.i32.p0i32 73 return llvm_cas(add, from, to); 74} 75