summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@imgtec.com>2015-11-06 14:52:46 +0000
committerPetar Jovanovic <petar.jovanovic@imgtec.com>2015-11-06 14:52:46 +0000
commit73d1044abebbb7a11a45a5ea728ef536af0b0540 (patch)
tree5a08e8b18918a557e03073044430d8f1402d73ea /clang/test
parent1aa4d1c56f276672bd2d8950fefdc6e7454481e2 (diff)
downloadbcm5719-llvm-73d1044abebbb7a11a45a5ea728ef536af0b0540.tar.gz
bcm5719-llvm-73d1044abebbb7a11a45a5ea728ef536af0b0540.zip
Fix __builtin_signbit for ppcf128 type
Function__builtin_signbit returns wrong value for type ppcf128 on big endian machines. This patch fixes how value is generated in that case. Patch by Aleksandar Beserminji. Differential Revision: http://reviews.llvm.org/D14149 llvm-svn: 252307
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Analysis/builtin_signbit.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/Analysis/builtin_signbit.cpp b/clang/test/Analysis/builtin_signbit.cpp
new file mode 100644
index 00000000000..bf91511c43c
--- /dev/null
+++ b/clang/test/Analysis/builtin_signbit.cpp
@@ -0,0 +1,43 @@
+// RUN: %clang -target powerpc-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-BE --check-prefix=CHECK
+// RUN: %clang -target powerpc64-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-BE --check-prefix=CHECK
+// RUN: %clang -target powerpc64le-linux-gnu -emit-llvm -S -O0 %s -o - | FileCheck %s --check-prefix=CHECK-LE --check-prefix=CHECK
+
+bool b;
+double d = -1.0;
+long double ld = -1.0L;
+void test_signbit()
+{
+ b = __builtin_signbit(1.0L);
+ // CHECK: i128
+ // CHECK-LE-NOT: lshr
+ // CHECK-BE: lshr
+ // CHECK: bitcast
+ // CHECK: ppc_fp128
+
+ b = __builtin_signbit(ld);
+ // CHECK: bitcast
+ // CHECK: ppc_fp128
+ // CHECK-LE-NOT: lshr
+ // CHECK-BE: lshr
+
+ b = __builtin_signbitf(1.0);
+ // CHECK: store i8 0
+
+ b = __builtin_signbitf(d);
+ // CHECK: bitcast
+ // CHECK-LE-NOT: lshr
+ // CHECK-BE-NOT: lshr
+
+ b = __builtin_signbitl(1.0L);
+ // CHECK: i128
+ // CHECK-LE-NOT: lshr
+ // CHECK-BE: lshr
+ // CHECK: bitcast
+ // CHECK: ppc_fp128
+
+ b = __builtin_signbitl(ld);
+ // CHECK: bitcast
+ // CHECK: ppc_fp128
+ // CHECK-LE-NOT: lshr
+ // CHECK-BE: lshr
+}
OpenPOWER on IntegriCloud