1; Test the Test Data Class instruction, selected manually via the intrinsic. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5declare i32 @llvm.s390.tdc.f32(float, i64) 6declare i32 @llvm.s390.tdc.f64(double, i64) 7declare i32 @llvm.s390.tdc.f128(fp128, i64) 8 9; Check using as i32 - f32 10define i32 @f1(float %x) { 11; CHECK-LABEL: f1 12; CHECK: tceb %f0, 123 13; CHECK: ipm %r2 14; CHECK: srl %r2, 28 15 %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123) 16 ret i32 %res 17} 18 19; Check using as i32 - f64 20define i32 @f2(double %x) { 21; CHECK-LABEL: f2 22; CHECK: tcdb %f0, 123 23; CHECK: ipm %r2 24; CHECK: srl %r2, 28 25 %res = call i32 @llvm.s390.tdc.f64(double %x, i64 123) 26 ret i32 %res 27} 28 29; Check using as i32 - f128 30define i32 @f3(fp128 %x) { 31; CHECK-LABEL: f3 32; CHECK: ld %f0, 0(%r2) 33; CHECK: ld %f2, 8(%r2) 34; CHECK: tcxb %f0, 123 35; CHECK: ipm %r2 36; CHECK: srl %r2, 28 37 %res = call i32 @llvm.s390.tdc.f128(fp128 %x, i64 123) 38 ret i32 %res 39} 40 41declare void @g() 42 43; Check branch 44define void @f4(float %x) { 45; CHECK-LABEL: f4 46; CHECK: tceb %f0, 123 47; CHECK: jgl g 48; CHECK: br %r14 49 %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123) 50 %cond = icmp ne i32 %res, 0 51 br i1 %cond, label %call, label %exit 52 53call: 54 tail call void @g() 55 br label %exit 56 57exit: 58 ret void 59} 60 61; Check branch negated 62define void @f5(float %x) { 63; CHECK-LABEL: f5 64; CHECK: tceb %f0, 123 65; CHECK: jge g 66; CHECK: br %r14 67 %res = call i32 @llvm.s390.tdc.f32(float %x, i64 123) 68 %cond = icmp eq i32 %res, 0 69 br i1 %cond, label %call, label %exit 70 71call: 72 tail call void @g() 73 br label %exit 74 75exit: 76 ret void 77} 78 79; Check non-const mask 80define void @f6(float %x, i64 %y) { 81; CHECK-LABEL: f6 82; CHECK: tceb %f0, 0(%r2) 83; CHECK: jge g 84; CHECK: br %r14 85 %res = call i32 @llvm.s390.tdc.f32(float %x, i64 %y) 86 %cond = icmp eq i32 %res, 0 87 br i1 %cond, label %call, label %exit 88 89call: 90 tail call void @g() 91 br label %exit 92 93exit: 94 ret void 95} 96