1 ; Test floating-point truncations. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5 ; Test f64->f32. 6 define float @f1(double %d1, double %d2) { 7 ; CHECK-LABEL: f1: 8 ; CHECK: ledbr %f0, %f2 9 ; CHECK: br %r14 10 %res = fptrunc double %d2 to float 11 ret float %res 12 } 13 14 ; Test f128->f32. 15 define float @f2(fp128 *%ptr) { 16 ; CHECK-LABEL: f2: 17 ; CHECK: lexbr %f0, %f0 18 ; CHECK: br %r14 19 %val = load fp128 *%ptr 20 %res = fptrunc fp128 %val to float 21 ret float %res 22 } 23 24 ; Make sure that we don't use %f0 as the destination of LEXBR when %f2 25 ; is still live. 26 define void @f3(float *%dst, fp128 *%ptr, float %d1, float %d2) { 27 ; CHECK-LABEL: f3: 28 ; CHECK: lexbr %f1, %f1 29 ; CHECK: aebr %f1, %f2 30 ; CHECK: ste %f1, 0(%r2) 31 ; CHECK: br %r14 32 %val = load fp128 *%ptr 33 %conv = fptrunc fp128 %val to float 34 %res = fadd float %conv, %d2 35 store float %res, float *%dst 36 ret void 37 } 38 39 ; Test f128->f64. 40 define double @f4(fp128 *%ptr) { 41 ; CHECK-LABEL: f4: 42 ; CHECK: ldxbr %f0, %f0 43 ; CHECK: br %r14 44 %val = load fp128 *%ptr 45 %res = fptrunc fp128 %val to double 46 ret double %res 47 } 48 49 ; Like f3, but for f128->f64. 50 define void @f5(double *%dst, fp128 *%ptr, double %d1, double %d2) { 51 ; CHECK-LABEL: f5: 52 ; CHECK: ldxbr %f1, %f1 53 ; CHECK: adbr %f1, %f2 54 ; CHECK: std %f1, 0(%r2) 55 ; CHECK: br %r14 56 %val = load fp128 *%ptr 57 %conv = fptrunc fp128 %val to double 58 %res = fadd double %conv, %d2 59 store double %res, double *%dst 60 ret void 61 } 62