1 ; Test the Test Data Class instruction, as used by fpclassify. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 ; 5 6 declare float @llvm.fabs.f32(float) 7 declare double @llvm.fabs.f64(double) 8 declare fp128 @llvm.fabs.f128(fp128) 9 10 define i32 @fpc(double %x) { 11 entry: 12 ; CHECK-LABEL: fpc 13 ; CHECK: lhi %r2, 5 14 ; CHECK: ltdbr %f0, %f0 15 ; CHECK: je [[RET:.L.*]] 16 %testeq = fcmp oeq double %x, 0.000000e+00 17 br i1 %testeq, label %ret, label %nonzero 18 19 nonzero: 20 ; CHECK: lhi %r2, 1 21 ; CHECK: cdbr %f0, %f0 22 ; CHECK: jo [[RET]] 23 %testnan = fcmp uno double %x, 0.000000e+00 24 br i1 %testnan, label %ret, label %nonzeroord 25 26 nonzeroord: 27 ; CHECK: lhi %r2, 2 28 ; CHECK: tcdb %f0, 48 29 ; CHECK: jl [[RET]] 30 %abs = tail call double @llvm.fabs.f64(double %x) 31 %testinf = fcmp oeq double %abs, 0x7FF0000000000000 32 br i1 %testinf, label %ret, label %finite 33 34 finite: 35 ; CHECK: lhi %r2, 3 36 ; CHECK: tcdb %f0, 831 37 ; CHECK: blr %r14 38 ; CHECK: lhi %r2, 4 39 %testnormal = fcmp uge double %abs, 0x10000000000000 40 %finres = select i1 %testnormal, i32 3, i32 4 41 br label %ret 42 43 ret: 44 ; CHECK: [[RET]]: 45 ; CHECK: br %r14 46 %res = phi i32 [ 5, %entry ], [ 1, %nonzero ], [ 2, %nonzeroord ], [ %finres, %finite ] 47 ret i32 %res 48 } 49