1; Test rounding functions for z10. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s 4 5; Test rint for f32. 6declare float @llvm.rint.f32(float %f) 7define float @f1(float %f) { 8; CHECK-LABEL: f1: 9; CHECK: fiebr %f0, 0, %f0 10; CHECK: br %r14 11 %res = call float @llvm.rint.f32(float %f) 12 ret float %res 13} 14 15; Test rint for f64. 16declare double @llvm.rint.f64(double %f) 17define double @f2(double %f) { 18; CHECK-LABEL: f2: 19; CHECK: fidbr %f0, 0, %f0 20; CHECK: br %r14 21 %res = call double @llvm.rint.f64(double %f) 22 ret double %res 23} 24 25; Test rint for f128. 26declare fp128 @llvm.rint.f128(fp128 %f) 27define void @f3(fp128 *%ptr) { 28; CHECK-LABEL: f3: 29; CHECK: fixbr %f0, 0, %f0 30; CHECK: br %r14 31 %src = load fp128 , fp128 *%ptr 32 %res = call fp128 @llvm.rint.f128(fp128 %src) 33 store fp128 %res, fp128 *%ptr 34 ret void 35} 36 37; Test nearbyint for f32. 38declare float @llvm.nearbyint.f32(float %f) 39define float @f4(float %f) { 40; CHECK-LABEL: f4: 41; CHECK: brasl %r14, nearbyintf@PLT 42; CHECK: br %r14 43 %res = call float @llvm.nearbyint.f32(float %f) 44 ret float %res 45} 46 47; Test nearbyint for f64. 48declare double @llvm.nearbyint.f64(double %f) 49define double @f5(double %f) { 50; CHECK-LABEL: f5: 51; CHECK: brasl %r14, nearbyint@PLT 52; CHECK: br %r14 53 %res = call double @llvm.nearbyint.f64(double %f) 54 ret double %res 55} 56 57; Test nearbyint for f128: omitted for now because we cannot handle 58; indirect arguments. 59 60; Test floor for f32. 61declare float @llvm.floor.f32(float %f) 62define float @f7(float %f) { 63; CHECK-LABEL: f7: 64; CHECK: brasl %r14, floorf@PLT 65; CHECK: br %r14 66 %res = call float @llvm.floor.f32(float %f) 67 ret float %res 68} 69 70; Test floor for f64. 71declare double @llvm.floor.f64(double %f) 72define double @f8(double %f) { 73; CHECK-LABEL: f8: 74; CHECK: brasl %r14, floor@PLT 75; CHECK: br %r14 76 %res = call double @llvm.floor.f64(double %f) 77 ret double %res 78} 79 80; Test floor for f128: omitted for now because we cannot handle 81; indirect arguments. 82 83; Test ceil for f32. 84declare float @llvm.ceil.f32(float %f) 85define float @f10(float %f) { 86; CHECK-LABEL: f10: 87; CHECK: brasl %r14, ceilf@PLT 88; CHECK: br %r14 89 %res = call float @llvm.ceil.f32(float %f) 90 ret float %res 91} 92 93; Test ceil for f64. 94declare double @llvm.ceil.f64(double %f) 95define double @f11(double %f) { 96; CHECK-LABEL: f11: 97; CHECK: brasl %r14, ceil@PLT 98; CHECK: br %r14 99 %res = call double @llvm.ceil.f64(double %f) 100 ret double %res 101} 102 103; Test ceil for f128: omitted for now because we cannot handle 104; indirect arguments. 105 106; Test trunc for f32. 107declare float @llvm.trunc.f32(float %f) 108define float @f13(float %f) { 109; CHECK-LABEL: f13: 110; CHECK: brasl %r14, truncf@PLT 111; CHECK: br %r14 112 %res = call float @llvm.trunc.f32(float %f) 113 ret float %res 114} 115 116; Test trunc for f64. 117declare double @llvm.trunc.f64(double %f) 118define double @f14(double %f) { 119; CHECK-LABEL: f14: 120; CHECK: brasl %r14, trunc@PLT 121; CHECK: br %r14 122 %res = call double @llvm.trunc.f64(double %f) 123 ret double %res 124} 125 126; Test trunc for f128: omitted for now because we cannot handle 127; indirect arguments. 128 129; Test round for f32. 130declare float @llvm.round.f32(float %f) 131define float @f16(float %f) { 132; CHECK-LABEL: f16: 133; CHECK: brasl %r14, roundf@PLT 134; CHECK: br %r14 135 %res = call float @llvm.round.f32(float %f) 136 ret float %res 137} 138 139; Test round for f64. 140declare double @llvm.round.f64(double %f) 141define double @f17(double %f) { 142; CHECK-LABEL: f17: 143; CHECK: brasl %r14, round@PLT 144; CHECK: br %r14 145 %res = call double @llvm.round.f64(double %f) 146 ret double %res 147} 148 149; Test round for f128: omitted for now because we cannot handle 150; indirect arguments. 151