summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/SystemZ/tdc-06.ll
diff options
context:
space:
mode:
authorMarcin Koscielnicki <koriakin@0x04.net>2016-07-10 14:41:22 +0000
committerMarcin Koscielnicki <koriakin@0x04.net>2016-07-10 14:41:22 +0000
commitcf7cc724a728e73e1b2c3258b0adb08326c802c1 (patch)
tree78bafc61d804bc8e576ec0843b86d5d789fb81c9 /llvm/test/CodeGen/SystemZ/tdc-06.ll
parent303326541bab361acc5c1324b0a743a16aa3bae2 (diff)
downloadbcm5719-llvm-cf7cc724a728e73e1b2c3258b0adb08326c802c1.tar.gz
bcm5719-llvm-cf7cc724a728e73e1b2c3258b0adb08326c802c1.zip
[SystemZ] Utilize Test Data Class instructions.
This adds a new SystemZ-specific intrinsic, llvm.s390.tdc.f(32|64|128), which maps straight to the test data class instructions. A new IR pass is added to recognize instructions that can be converted to TDC and perform the necessary replacements. Differential Revision: http://reviews.llvm.org/D21949 llvm-svn: 275016
Diffstat (limited to 'llvm/test/CodeGen/SystemZ/tdc-06.ll')
-rw-r--r--llvm/test/CodeGen/SystemZ/tdc-06.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/tdc-06.ll b/llvm/test/CodeGen/SystemZ/tdc-06.ll
new file mode 100644
index 00000000000..11fb1e2916e
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/tdc-06.ll
@@ -0,0 +1,48 @@
+; Test the Test Data Class instruction, as used by fpclassify.
+;
+; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+;
+
+declare float @llvm.fabs.f32(float)
+declare double @llvm.fabs.f64(double)
+declare fp128 @llvm.fabs.f128(fp128)
+
+define i32 @fpc(double %x) {
+entry:
+; CHECK-LABEL: fpc
+; CHECK: lhi %r2, 5
+; CHECK: ltdbr %f0, %f0
+; CHECK: je [[RET:.L.*]]
+ %testeq = fcmp oeq double %x, 0.000000e+00
+ br i1 %testeq, label %ret, label %nonzero
+
+nonzero:
+; CHECK: lhi %r2, 1
+; CHECK: cdbr %f0, %f0
+; CHECK: jo [[RET]]
+ %testnan = fcmp uno double %x, 0.000000e+00
+ br i1 %testnan, label %ret, label %nonzeroord
+
+nonzeroord:
+; CHECK: lhi %r2, 2
+; CHECK: tcdb %f0, 48
+; CHECK: jl [[RET]]
+ %abs = tail call double @llvm.fabs.f64(double %x)
+ %testinf = fcmp oeq double %abs, 0x7FF0000000000000
+ br i1 %testinf, label %ret, label %finite
+
+finite:
+; CHECK: lhi %r2, 3
+; CHECK: tcdb %f0, 831
+; CHECK: blr %r14
+; CHECK: lhi %r2, 4
+ %testnormal = fcmp uge double %abs, 0x10000000000000
+ %finres = select i1 %testnormal, i32 3, i32 4
+ br label %ret
+
+ret:
+; CHECK: [[RET]]:
+; CHECK: br %r14
+ %res = phi i32 [ 5, %entry ], [ 1, %nonzero ], [ 2, %nonzeroord ], [ %finres, %finite ]
+ ret i32 %res
+}
OpenPOWER on IntegriCloud