1; Test f128 floating-point truncations/extensions on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5; Test f128->f64.
6define double @f1(fp128 *%ptr) {
7; CHECK-LABEL: f1:
8; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
9; CHECK: wflrx %f0, [[REG]], 0, 0
10; CHECK: br %r14
11  %val = load fp128, fp128 *%ptr
12  %res = fptrunc fp128 %val to double
13  ret double %res
14}
15
16; Test f128->f32.
17define float @f2(fp128 *%ptr) {
18; CHECK-LABEL: f2:
19; CHECK: vl [[REG:%v[0-9]+]], 0(%r2)
20; CHECK: wflrx %f0, [[REG]], 0, 3
21; CHECK: ledbra %f0, 0, %f0, 0
22; CHECK: br %r14
23  %val = load fp128, fp128 *%ptr
24  %res = fptrunc fp128 %val to float
25  ret float %res
26}
27
28; Test f64->f128.
29define void @f3(fp128 *%dst, double %val) {
30; CHECK-LABEL: f3:
31; CHECK: wflld [[RES:%v[0-9]+]], %f0
32; CHECK: vst [[RES]], 0(%r2)
33; CHECK: br %r14
34  %res = fpext double %val to fp128
35  store fp128 %res, fp128 *%dst
36  ret void
37}
38
39; Test f32->f128.
40define void @f4(fp128 *%dst, float %val) {
41; CHECK-LABEL: f4:
42; CHECK: ldebr %f0, %f0
43; CHECK: wflld [[RES:%v[0-9]+]], %f0
44; CHECK: vst [[RES]], 0(%r2)
45; CHECK: br %r14
46  %res = fpext float %val to fp128
47  store fp128 %res, fp128 *%dst
48  ret void
49}
50
51