1 ; Test floating-point truncations.
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
9 define float @f1(double %d1, double %d2) {
11 ; CHECK-SCALAR: ledbr %f0, %f2
12 ; CHECK-VECTOR: ledbra %f0, 0, %f2, 0
14 %res = fptrunc double %d2 to float
19 define float @f2(fp128 *%ptr) {
21 ; CHECK: lexbr %f0, %f0
23 %val = load fp128, fp128 *%ptr
24 %res = fptrunc fp128 %val to float
28 ; Make sure that we don't use %f0 as the destination of LEXBR when %f2
30 define void @f3(float *%dst, fp128 *%ptr, float %d1, float %d2) {
32 ; CHECK: lexbr %f1, %f1
33 ; CHECK: aebr %f1, %f2
34 ; CHECK: ste %f1, 0(%r2)
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
44 define double @f4(fp128 *%ptr) {
46 ; CHECK: ldxbr %f0, %f0
48 %val = load fp128, fp128 *%ptr
49 %res = fptrunc fp128 %val to double
53 ; Like f3, but for f128->f64.
54 define void @f5(double *%dst, fp128 *%ptr, double %d1, double %d2) {
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)
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