Debian Codegraph @

clang/test/CodeGen/builtin-attributes.c

raw
1 // REQUIRES: arm-registered-target
2 // RUN: %clang_cc1 -triple arm-unknown-linux-gnueabi -emit-llvm -o - %s | FileCheck %s
3
4 int printf(const char *, ...);
5 void exit(int);
6
7 float frexpf(float, int*);
8 double frexp(double, int*);
9 long double frexpl(long double, int*);
10
11 // CHECK: declare i32 @printf(ptr noundef, ...)
12 void f0() {
13 printf("a\n");
14 }
15
16 // CHECK: call void @exit
17 // CHECK: unreachable
18 void f1() {
19 exit(1);
20 }
21
22 // CHECK: call ptr @strstr{{.*}} [[NUW:#[0-9]+]]
23 char* f2(char* a, char* b) {
24 return __builtin_strstr(a, b);
25 }
26
27 // Note: Use asm label to disable intrinsic lowering of modf.
28 double modf(double x, double*) asm("modf");
29 float modff(float x, float*) asm("modff");
30 long double modfl(long double x, long double*) asm("modfl");
31
32 // frexp is NOT readnone. It writes to its pointer argument.
33 //
34 // CHECK: f3
35 // CHECK: call double @frexp(double noundef %
36 // CHECK-NOT: readnone
37 // CHECK: call float @frexpf(float noundef %
38 // CHECK-NOT: readnone
39 // CHECK: call double @frexpl(double noundef %
40 // CHECK-NOT: readnone
41 //
42 // Same thing for modf and friends.
43 //
44 // CHECK: call double @modf(double noundef %
45 // CHECK-NOT: readnone
46 // CHECK: call float @modff(float noundef %
47 // CHECK-NOT: readnone
48 // CHECK: call double @modfl(double noundef %
49 // CHECK-NOT: readnone
50 //
51 // CHECK: call double @remquo(double noundef %
52 // CHECK-NOT: readnone
53 // CHECK: call float @remquof(float noundef %
54 // CHECK-NOT: readnone
55 // CHECK: call double @remquol(double noundef %
56 // CHECK-NOT: readnone
57 // CHECK: ret
58 int f3(double x) {
59 int e;
60 float f;
61 double d;
62 long double ld;
63 frexp(x, &e);
64 frexpf(x, &e);
65 frexpl(x, &e);
66 modf(x, &d);
67 modff(x, &f);
68 modfl(x, &ld);
69 __builtin_remquo(x, x, &e);
70 __builtin_remquof(x, x, &e);
71 __builtin_remquol(x, x, &e);
72 return e;
73 }
74
75 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }