1 // REQUIRES: arm-registered-target
2 // RUN: %clang_cc1 -no-opaque-pointers -triple arm-unknown-linux-gnueabi -emit-llvm -o - %s | FileCheck %s
3 
4 int printf(const char *, ...);
5 void exit(int);
6 
7 // CHECK: declare i32 @printf(i8* noundef, ...)
8 void f0() {
9   printf("a\n");
10 }
11 
12 // CHECK: call void @exit
13 // CHECK: unreachable
14 void f1() {
15   exit(1);
16 }
17 
18 // CHECK: call i8* @strstr{{.*}} [[NUW:#[0-9]+]]
19 char* f2(char* a, char* b) {
20   return __builtin_strstr(a, b);
21 }
22 
23 // frexp is NOT readnone. It writes to its pointer argument.
24 // <rdar://problem/10070234>
25 //
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
33 //
34 // Same thing for modf and friends.
35 //
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
42 //
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;
62 }
63 
64 // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
65