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, ...)
f0()12 void f0() {
13 printf("a\n");
14 }
15
16 // CHECK: call void @exit
17 // CHECK: unreachable
f1()18 void f1() {
19 exit(1);
20 }
21
22 // CHECK: call ptr @strstr{{.*}} [[NUW:#[0-9]+]]
f2(char * a,char * b)23 char* f2(char* a, char* b) {
24 return __builtin_strstr(a, b);
25 }
26
27 // frexp is NOT readnone. It writes to its pointer argument.
28 //
29 // CHECK: f3
30 // CHECK: call double @frexp(double noundef %
31 // CHECK-NOT: readnone
32 // CHECK: call float @frexpf(float noundef %
33 // CHECK-NOT: readnone
34 // CHECK: call double @frexpl(double noundef %
35 // CHECK-NOT: readnone
36 //
37 // Same thing for modf and friends.
38 //
39 // CHECK: call double @modf(double noundef %
40 // CHECK-NOT: readnone
41 // CHECK: call float @modff(float noundef %
42 // CHECK-NOT: readnone
43 // CHECK: call double @modfl(double noundef %
44 // CHECK-NOT: readnone
45 //
46 // CHECK: call double @remquo(double noundef %
47 // CHECK-NOT: readnone
48 // CHECK: call float @remquof(float noundef %
49 // CHECK-NOT: readnone
50 // CHECK: call double @remquol(double noundef %
51 // CHECK-NOT: readnone
52 // CHECK: ret
f3(double x)53 int f3(double x) {
54 int e;
55 frexp(x, &e);
56 frexpf(x, &e);
57 frexpl(x, &e);
58 __builtin_modf(x, &e);
59 __builtin_modff(x, &e);
60 __builtin_modfl(x, &e);
61 __builtin_remquo(x, x, &e);
62 __builtin_remquof(x, x, &e);
63 __builtin_remquol(x, x, &e);
64 return e;
65 }
66
67 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
68