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