1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s --check-prefix=ALIGN16
2 // RUN: %clang_cc1 -triple x86_64-windows-msvc      -emit-llvm < %s | FileCheck %s --check-prefix=ALIGN16
3 // RUN: %clang_cc1 -triple i386-apple-darwin        -emit-llvm < %s | FileCheck %s --check-prefix=ALIGN16
4 // RUN: %clang_cc1 -triple i386-unknown-linux-gnu   -emit-llvm < %s | FileCheck %s --check-prefix=ALIGN8
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-malloc  -emit-llvm < %s  | FileCheck %s --check-prefix=NOBUILTIN-MALLOC
6 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-calloc  -emit-llvm < %s  | FileCheck %s --check-prefix=NOBUILTIN-CALLOC
7 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fno-builtin-realloc -emit-llvm < %s  | FileCheck %s --check-prefix=NOBUILTIN-REALLOC
8 
9 typedef __SIZE_TYPE__ size_t;
10 
11 void *malloc(size_t);
12 void *calloc(size_t, size_t);
13 void *realloc(void *, size_t);
14 
15 void *malloc_test(size_t n) {
16   return malloc(n);
17 }
18 
19 void *calloc_test(size_t n) {
20   return calloc(1, n);
21 }
22 
23 void *raalloc_test(void *p, size_t n) {
24   return realloc(p, n);
25 }
26 
27 // ALIGN16: align 16 i8* @malloc
28 // ALIGN16: align 16 i8* @calloc
29 // ALIGN16: align 16 i8* @realloc
30 // ALIGN8: align 8 i8* @malloc
31 // ALIGN8: align 8 i8* @calloc
32 // ALIGN8: align 8 i8* @realloc
33 // NOBUILTIN-MALLOC: declare i8* @malloc
34 // NOBUILTIN-CALLOC: declare i8* @calloc
35 // NOBUILTIN-REALLOC: declare i8* @realloc
36