1; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
2
3declare fp128 @llvm.fma.f128(fp128 %f1, fp128 %f2, fp128 %f3)
4
5define void @f1(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) {
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.fma.f128 (fp128 %f1, fp128 %f2, fp128 %f3)
17  store fp128 %res, fp128 *%dst
18  ret void
19}
20
21define void @f2(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) {
22; CHECK-LABEL: f2:
23; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
24; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
25; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
26; CHECK: wfmsxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
27; CHECK: vst [[RES]], 0(%r5)
28; CHECK: br %r14
29  %f1 = load fp128, fp128 *%ptr1
30  %f2 = load fp128, fp128 *%ptr2
31  %f3 = load fp128, fp128 *%ptr3
32  %neg = fsub fp128 0xL00000000000000008000000000000000, %f3
33  %res = call fp128 @llvm.fma.f128 (fp128 %f1, fp128 %f2, fp128 %neg)
34  store fp128 %res, fp128 *%dst
35  ret void
36}
37
38define void @f3(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) {
39; CHECK-LABEL: f3:
40; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
41; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
42; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
43; CHECK: wfnmaxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
44; CHECK: vst [[RES]], 0(%r5)
45; CHECK: br %r14
46  %f1 = load fp128, fp128 *%ptr1
47  %f2 = load fp128, fp128 *%ptr2
48  %f3 = load fp128, fp128 *%ptr3
49  %res = call fp128 @llvm.fma.f128 (fp128 %f1, fp128 %f2, fp128 %f3)
50  %negres = fsub fp128 0xL00000000000000008000000000000000, %res
51  store fp128 %negres, fp128 *%dst
52  ret void
53}
54
55define void @f4(fp128 *%ptr1, fp128 *%ptr2, fp128 *%ptr3, fp128 *%dst) {
56; CHECK-LABEL: f4:
57; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
58; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
59; CHECK-DAG: vl [[REG3:%v[0-9]+]], 0(%r4)
60; CHECK: wfnmsxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], [[REG3]]
61; CHECK: vst [[RES]], 0(%r5)
62; CHECK: br %r14
63  %f1 = load fp128, fp128 *%ptr1
64  %f2 = load fp128, fp128 *%ptr2
65  %f3 = load fp128, fp128 *%ptr3
66  %neg = fsub fp128 0xL00000000000000008000000000000000, %f3
67  %res = call fp128 @llvm.fma.f128 (fp128 %f1, fp128 %f2, fp128 %neg)
68  %negres = fsub fp128 0xL00000000000000008000000000000000, %res
69  store fp128 %negres, fp128 *%dst
70  ret void
71}
72
73