summaryrefslogtreecommitdiffstats
path: root/clang/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
commited2a360fd1b6d8879ff287d7a9353ea5ff97e4f3 (patch)
tree92c9018415ca5273921d6bc2a9170f72f8d770f6 /clang/test/CodeGen/builtin-attributes.c
parent51920a619106673fb1faaa407070f33ff565c5c2 (diff)
downloadbcm5719-llvm-ed2a360fd1b6d8879ff287d7a9353ea5ff97e4f3.tar.gz
bcm5719-llvm-ed2a360fd1b6d8879ff287d7a9353ea5ff97e4f3.zip
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> llvm-svn: 139319
Diffstat (limited to 'clang/test/CodeGen/builtin-attributes.c')
-rw-r--r--clang/test/CodeGen/builtin-attributes.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-attributes.c b/clang/test/CodeGen/builtin-attributes.c
index 822b8eecf7d..3781eba2669 100644
--- a/clang/test/CodeGen/builtin-attributes.c
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud