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.experimental.constrained.fma.v2f64(<2 x double>, <2 x double>, <2 x double>, metadata, metadata)
6declare <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float>, <4 x float>, <4 x float>, metadata, metadata)
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) #0 {
11; CHECK-LABEL: f1:
12; CHECK: vfnmadb %v24, %v26, %v28, %v30
13; CHECK: br %r14
14  %ret = call <2 x double> @llvm.experimental.constrained.fma.v2f64 (
15                        <2 x double> %val1,
16                        <2 x double> %val2,
17                        <2 x double> %val3,
18                        metadata !"round.dynamic",
19                        metadata !"fpexcept.strict") #0
20  %negret = fneg <2 x double> %ret
21  ret <2 x double> %negret
22}
23
24; Test a v2f64 negative multiply-and-subtract.
25define <2 x double> @f2(<2 x double> %dummy, <2 x double> %val1,
26                        <2 x double> %val2, <2 x double> %val3) #0 {
27; CHECK-LABEL: f2:
28; CHECK: vfnmsdb %v24, %v26, %v28, %v30
29; CHECK: br %r14
30  %negval3 = fneg <2 x double> %val3
31  %ret = call <2 x double> @llvm.experimental.constrained.fma.v2f64 (
32                        <2 x double> %val1,
33                        <2 x double> %val2,
34                        <2 x double> %negval3,
35                        metadata !"round.dynamic",
36                        metadata !"fpexcept.strict") #0
37  %negret = fneg <2 x double> %ret
38  ret <2 x double> %negret
39}
40
41; Test a v4f32 negative multiply-and-add.
42define <4 x float> @f3(<4 x float> %dummy, <4 x float> %val1,
43                       <4 x float> %val2, <4 x float> %val3) #0 {
44; CHECK-LABEL: f3:
45; CHECK: vfnmasb %v24, %v26, %v28, %v30
46; CHECK: br %r14
47  %ret = call <4 x float> @llvm.experimental.constrained.fma.v4f32 (
48                        <4 x float> %val1,
49                        <4 x float> %val2,
50                        <4 x float> %val3,
51                        metadata !"round.dynamic",
52                        metadata !"fpexcept.strict") #0
53  %negret = fneg <4 x float> %ret
54  ret <4 x float> %negret
55}
56
57; Test a v4f32 negative multiply-and-subtract.
58define <4 x float> @f4(<4 x float> %dummy, <4 x float> %val1,
59                       <4 x float> %val2, <4 x float> %val3) #0 {
60; CHECK-LABEL: f4:
61; CHECK: vfnmssb %v24, %v26, %v28, %v30
62; CHECK: br %r14
63  %negval3 = fneg <4 x float> %val3
64  %ret = call <4 x float> @llvm.experimental.constrained.fma.v4f32 (
65                        <4 x float> %val1,
66                        <4 x float> %val2,
67                        <4 x float> %negval3,
68                        metadata !"round.dynamic",
69                        metadata !"fpexcept.strict") #0
70  %negret = fneg <4 x float> %ret
71  ret <4 x float> %negret
72}
73
74attributes #0 = { strictfp }
75