1; Test vector negative multiply-and-add on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>)
6declare <4 x float> @llvm.fma.v4f32(<4 x float>, <4 x float>, <4 x float>)
7
8; Test a v2f64 negative multiply-and-add.
9define <2 x double> @f1(<2 x double> %dummy, <2 x double> %val1,
10                        <2 x double> %val2, <2 x double> %val3) {
11; CHECK-LABEL: f1:
12; CHECK: vfnmadb %v24, %v26, %v28, %v30
13; CHECK: br %r14
14  %ret = call <2 x double> @llvm.fma.v2f64 (<2 x double> %val1,
15                                            <2 x double> %val2,
16                                            <2 x double> %val3)
17  %negret = fneg <2 x double> %ret
18  ret <2 x double> %negret
19}
20
21; Test a v2f64 negative multiply-and-subtract.
22define <2 x double> @f2(<2 x double> %dummy, <2 x double> %val1,
23                        <2 x double> %val2, <2 x double> %val3) {
24; CHECK-LABEL: f2:
25; CHECK: vfnmsdb %v24, %v26, %v28, %v30
26; CHECK: br %r14
27  %negval3 = fneg <2 x double> %val3
28  %ret = call <2 x double> @llvm.fma.v2f64 (<2 x double> %val1,
29                                            <2 x double> %val2,
30                                            <2 x double> %negval3)
31  %negret = fneg <2 x double> %ret
32  ret <2 x double> %negret
33}
34
35; Test a v4f32 negative multiply-and-add.
36define <4 x float> @f3(<4 x float> %dummy, <4 x float> %val1,
37                       <4 x float> %val2, <4 x float> %val3) {
38; CHECK-LABEL: f3:
39; CHECK: vfnmasb %v24, %v26, %v28, %v30
40; CHECK: br %r14
41  %ret = call <4 x float> @llvm.fma.v4f32 (<4 x float> %val1,
42                                           <4 x float> %val2,
43                                           <4 x float> %val3)
44  %negret = fneg <4 x float> %ret
45  ret <4 x float> %negret
46}
47
48; Test a v4f32 negative multiply-and-subtract.
49define <4 x float> @f4(<4 x float> %dummy, <4 x float> %val1,
50                       <4 x float> %val2, <4 x float> %val3) {
51; CHECK-LABEL: f4:
52; CHECK: vfnmssb %v24, %v26, %v28, %v30
53; CHECK: br %r14
54  %negval3 = fneg <4 x float> %val3
55  %ret = call <4 x float> @llvm.fma.v4f32 (<4 x float> %val1,
56                                           <4 x float> %val2,
57                                           <4 x float> %negval3)
58  %negret = fneg <4 x float> %ret
59  ret <4 x float> %negret
60}
61