2016-07-10 22:41:22 +08:00
|
|
|
; 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
|
2017-10-06 21:59:28 +08:00
|
|
|
; CHECK-DAG: lhi %r2, 5
|
|
|
|
; CHECK-DAG: ltdbr %f0, %f0
|
2016-07-10 22:41:22 +08:00
|
|
|
; CHECK: je [[RET:.L.*]]
|
|
|
|
%testeq = fcmp oeq double %x, 0.000000e+00
|
2016-07-30 02:09:25 +08:00
|
|
|
br i1 %testeq, label %ret, label %nonzero, !prof !1
|
2016-07-10 22:41:22 +08:00
|
|
|
|
|
|
|
nonzero:
|
2017-10-06 21:59:28 +08:00
|
|
|
; CHECK-DAG: lhi %r2, 1
|
|
|
|
; CHECK-DAG: cdbr %f0, %f0
|
2016-07-10 22:41:22 +08:00
|
|
|
; CHECK: jo [[RET]]
|
|
|
|
%testnan = fcmp uno double %x, 0.000000e+00
|
2016-07-30 02:09:25 +08:00
|
|
|
br i1 %testnan, label %ret, label %nonzeroord, !prof !1
|
2016-07-10 22:41:22 +08:00
|
|
|
|
|
|
|
nonzeroord:
|
2017-10-06 21:59:28 +08:00
|
|
|
; CHECK-DAG: lhi %r2, 2
|
|
|
|
; CHECK-DAG: tcdb %f0, 48
|
2017-01-12 03:55:19 +08:00
|
|
|
; CHECK: jl [[RET]]
|
2016-07-10 22:41:22 +08:00
|
|
|
%abs = tail call double @llvm.fabs.f64(double %x)
|
|
|
|
%testinf = fcmp oeq double %abs, 0x7FF0000000000000
|
2016-07-30 02:09:25 +08:00
|
|
|
br i1 %testinf, label %ret, label %finite, !prof !1
|
2016-07-10 22:41:22 +08:00
|
|
|
|
|
|
|
finite:
|
2017-10-06 21:59:28 +08:00
|
|
|
; CHECK-DAG: lhi %r2, 3
|
|
|
|
; CHECK-DAG: tcdb %f0, 831
|
2016-07-10 22:41:22 +08:00
|
|
|
; CHECK: blr %r14
|
|
|
|
; CHECK: lhi %r2, 4
|
|
|
|
%testnormal = fcmp uge double %abs, 0x10000000000000
|
|
|
|
%finres = select i1 %testnormal, i32 3, i32 4
|
|
|
|
br label %ret
|
|
|
|
|
2017-01-12 03:55:19 +08:00
|
|
|
ret:
|
|
|
|
; CHECK: [[RET]]:
|
|
|
|
; CHECK: br %r14
|
|
|
|
%res = phi i32 [ 5, %entry ], [ 1, %nonzero ], [ 2, %nonzeroord ], [ %finres, %finite ]
|
|
|
|
ret i32 %res
|
2016-07-10 22:41:22 +08:00
|
|
|
}
|
2016-07-30 02:09:25 +08:00
|
|
|
|
|
|
|
!1 = !{!"branch_weights", i32 1, i32 1}
|