1; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
2
3declare fp128 @llvm.experimental.constrained.fma.f128(fp128 %f1, fp128 %f2, fp128 %f3, metadata, metadata)
4
5define void @f1(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) #0 {
6; CHECK-LABEL: f1:
7; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
8; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
9; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
10; CHECK: wfmaxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
11; CHECK: vst [[RES]], 0(%r5)
12; CHECK: br %r14
13  %f1 = load fp128, fp128 *%ptr1
14  %f2 = load fp128, fp128 *%ptr2
15  %f3 = load fp128, fp128 *%ptr3
16  %res = call fp128 @llvm.experimental.constrained.fma.f128 (
17                        fp128 %f1, fp128 %f2, fp128 %f3,
18                        metadata !"round.dynamic",
19                        metadata !"fpexcept.strict") #0
20  store fp128 %res, fp128 *%dst
21  ret void
22}
23
24define void @f2(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) #0 {
25; CHECK-LABEL: f2:
26; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
27; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
28; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
29; CHECK: wfmsxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
30; CHECK: vst [[RES]], 0(%r5)
31; CHECK: br %r14
32  %f1 = load fp128, fp128 *%ptr1
33  %f2 = load fp128, fp128 *%ptr2
34  %f3 = load fp128, fp128 *%ptr3
35  %neg = fsub fp128 0xL00000000000000008000000000000000, %f3
36  %res = call fp128 @llvm.experimental.constrained.fma.f128 (
37                        fp128 %f1, fp128 %f2, fp128 %neg,
38                        metadata !"round.dynamic",
39                        metadata !"fpexcept.strict") #0
40  store fp128 %res, fp128 *%dst
41  ret void
42}
43
44define void @f3(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) #0 {
45; CHECK-LABEL: f3:
46; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
47; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
48; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
49; CHECK: wfnmaxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
50; CHECK: vst [[RES]], 0(%r5)
51; CHECK: br %r14
52  %f1 = load fp128, fp128 *%ptr1
53  %f2 = load fp128, fp128 *%ptr2
54  %f3 = load fp128, fp128 *%ptr3
55  %res = call fp128 @llvm.experimental.constrained.fma.f128 (
56                        fp128 %f1, fp128 %f2, fp128 %f3,
57                        metadata !"round.dynamic",
58                        metadata !"fpexcept.strict") #0
59  %negres = fsub fp128 0xL00000000000000008000000000000000, %res
60  store fp128 %negres, fp128 *%dst
61  ret void
62}
63
64define void @f4(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) #0 {
65; CHECK-LABEL: f4:
66; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
67; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
68; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
69; CHECK: wfnmsxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
70; CHECK: vst [[RES]], 0(%r5)
71; CHECK: br %r14
72  %f1 = load fp128, fp128 *%ptr1
73  %f2 = load fp128, fp128 *%ptr2
74  %f3 = load fp128, fp128 *%ptr3
75  %neg = fsub fp128 0xL00000000000000008000000000000000, %f3
76  %res = call fp128 @llvm.experimental.constrained.fma.f128 (
77                        fp128 %f1, fp128 %f2, fp128 %neg,
78                        metadata !"round.dynamic",
79                        metadata !"fpexcept.strict") #0
80  %negres = fsub fp128 0xL00000000000000008000000000000000, %res
81  store fp128 %negres, fp128 *%dst
82  ret void
83}
84
85attributes #0 = { strictfp }
86
87