aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/builtin-attributes.c
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-09-08 21:18:03 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-09-08 21:18:03 +0000
commit87198c304cc1fae48b7a06ce9faf8b4017981059 (patch)
tree1042c6653104112b368d5e4b1a2d7ff11319f505 /test/CodeGen/builtin-attributes.c
parentaf37061fea31f3f1d0638edb5486e8d72c701522 (diff)
The frexp, modf, and remquo builtins are not 'const'.
These functions return a second value by writing to a pointer argument, so they cannot be marked 'readnone' which implies that they don't access memory. <rdar://problem/10070234> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/builtin-attributes.c')
-rw-r--r--test/CodeGen/builtin-attributes.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-attributes.c b/test/CodeGen/builtin-attributes.c
index 822b8eecf7..3781eba266 100644
--- a/test/CodeGen/builtin-attributes.c
+++ b/test/CodeGen/builtin-attributes.c
@@ -15,3 +15,44 @@ void f1() {
char* f2(char* a, char* b) {
return __builtin_strstr(a, b);
}
+
+// frexp is NOT readnone. It writes to its pointer argument.
+// <rdar://problem/10070234>
+//
+// CHECK: f3
+// CHECK: call double @frexp(double %
+// CHECK-NOT: readnone
+// CHECK: call float @frexpf(float %
+// CHECK-NOT: readnone
+// CHECK: call double @frexpl(double %
+// CHECK-NOT: readnone
+//
+// Same thing for modf and friends.
+//
+// CHECK: call double @modf(double %
+// CHECK-NOT: readnone
+// CHECK: call float @modff(float %
+// CHECK-NOT: readnone
+// CHECK: call double @modfl(double %
+// CHECK-NOT: readnone
+//
+// CHECK: call double @remquo(double %
+// CHECK-NOT: readnone
+// CHECK: call float @remquof(float %
+// CHECK-NOT: readnone
+// CHECK: call double @remquol(double %
+// CHECK-NOT: readnone
+// CHECK: ret
+int f3(double x) {
+ int e;
+ __builtin_frexp(x, &e);
+ __builtin_frexpf(x, &e);
+ __builtin_frexpl(x, &e);
+ __builtin_modf(x, &e);
+ __builtin_modff(x, &e);
+ __builtin_modfl(x, &e);
+ __builtin_remquo(x, x, &e);
+ __builtin_remquof(x, x, &e);
+ __builtin_remquol(x, x, &e);
+ return e;
+}