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