[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / builtin-attributes.c
blobfd1e107a41d5831fb1f81223c14b93204a59e2ba
1 // REQUIRES: arm-registered-target
2 // RUN: %clang_cc1 -triple arm-unknown-linux-gnueabi -emit-llvm -o - %s | FileCheck %s
4 int printf(const char *, ...);
5 void exit(int);
7 // CHECK: declare i32 @printf(ptr noundef, ...)
8 void f0() {
9 printf("a\n");
12 // CHECK: call void @exit
13 // CHECK: unreachable
14 void f1() {
15 exit(1);
18 // CHECK: call ptr @strstr{{.*}} [[NUW:#[0-9]+]]
19 char* f2(char* a, char* b) {
20 return __builtin_strstr(a, b);
23 // frexp is NOT readnone. It writes to its pointer argument.
24 // <rdar://problem/10070234>
26 // CHECK: f3
27 // CHECK: call double @frexp(double noundef %
28 // CHECK-NOT: readnone
29 // CHECK: call float @frexpf(float noundef %
30 // CHECK-NOT: readnone
31 // CHECK: call double @frexpl(double noundef %
32 // CHECK-NOT: readnone
34 // Same thing for modf and friends.
36 // CHECK: call double @modf(double noundef %
37 // CHECK-NOT: readnone
38 // CHECK: call float @modff(float noundef %
39 // CHECK-NOT: readnone
40 // CHECK: call double @modfl(double noundef %
41 // CHECK-NOT: readnone
43 // CHECK: call double @remquo(double noundef %
44 // CHECK-NOT: readnone
45 // CHECK: call float @remquof(float noundef %
46 // CHECK-NOT: readnone
47 // CHECK: call double @remquol(double noundef %
48 // CHECK-NOT: readnone
49 // CHECK: ret
50 int f3(double x) {
51 int e;
52 __builtin_frexp(x, &e);
53 __builtin_frexpf(x, &e);
54 __builtin_frexpl(x, &e);
55 __builtin_modf(x, &e);
56 __builtin_modff(x, &e);
57 __builtin_modfl(x, &e);
58 __builtin_remquo(x, x, &e);
59 __builtin_remquof(x, x, &e);
60 __builtin_remquol(x, x, &e);
61 return e;
64 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }