xref: /llvm-project/clang/test/CodeGen/asm-label-inline-builtins.c (revision c5de4dd1eab00df76c1a68c5f397304ceacb71f2)
1 // RUN: %clang_cc1 -triple x86_64 -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
2 //
3 // Verifies that clang-generated *.inline carry the same name at call and callee
4 // site, in spite of asm labels.
5 
6 typedef struct _IO_FILE FILE;
7 extern FILE *stdout;
8 extern int vprintf (const char *__restrict __format, __builtin_va_list __arg);
9 extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
10       const char *__restrict __format, __builtin_va_list __ap);
11 extern int __vprintf_chk (int __flag, const char *__restrict __format,
12      __builtin_va_list __ap);
13 
14 extern __typeof (vprintf) vprintf __asm ("__vprintfieee128");
15 extern __typeof (__vfprintf_chk) __vfprintf_chk __asm ("__vfprintf_chkieee128");
16 extern __typeof (__vprintf_chk) __vprintf_chk __asm ("__vprintf_chkieee128");
17 
18 extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) __attribute__ ((__artificial__)) int
vprintf(const char * __restrict __fmt,__builtin_va_list __ap)19 vprintf (const char *__restrict __fmt, __builtin_va_list __ap)
20 {
21   return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
22 }
23 
test(const char * fmt,__builtin_va_list ap)24 void test(const char *fmt, __builtin_va_list ap) {
25   vprintf(fmt, ap);
26 }
27 
28 // CHECK-LABEL: void @test(
29 // CHECK: call i32 @__vprintfieee128.inline(
30 //
31 // CHECK-LABEL: internal i32 @__vprintfieee128.inline(
32 // CHECK: call i32 @__vfprintf_chkieee128(
33