1; Test vector multiply-and-add.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5declare <2 x double> @llvm.fma.v2f64(<2 x double>, <2 x double>, <2 x double>)
6
7; Test a v16i8 multiply-and-add.
8define <16 x i8> @f1(<16 x i8> %dummy, <16 x i8> %val1, <16 x i8> %val2,
9                     <16 x i8> %val3) {
10; CHECK-LABEL: f1:
11; CHECK: vmalb %v24, %v26, %v28, %v30
12; CHECK: br %r14
13  %mul = mul <16 x i8> %val1, %val2
14  %ret = add <16 x i8> %mul, %val3
15  ret <16 x i8> %ret
16}
17
18; Test a v8i16 multiply-and-add.
19define <8 x i16> @f2(<8 x i16> %dummy, <8 x i16> %val1, <8 x i16> %val2,
20                     <8 x i16> %val3) {
21; CHECK-LABEL: f2:
22; CHECK: vmalhw %v24, %v26, %v28, %v30
23; CHECK: br %r14
24  %mul = mul <8 x i16> %val1, %val2
25  %ret = add <8 x i16> %mul, %val3
26  ret <8 x i16> %ret
27}
28
29; Test a v4i32 multiply-and-add.
30define <4 x i32> @f3(<4 x i32> %dummy, <4 x i32> %val1, <4 x i32> %val2,
31                     <4 x i32> %val3) {
32; CHECK-LABEL: f3:
33; CHECK: vmalf %v24, %v26, %v28, %v30
34; CHECK: br %r14
35  %mul = mul <4 x i32> %val1, %val2
36  %ret = add <4 x i32> %mul, %val3
37  ret <4 x i32> %ret
38}
39
40; Test a v2f64 multiply-and-add.
41define <2 x double> @f4(<2 x double> %dummy, <2 x double> %val1,
42                        <2 x double> %val2, <2 x double> %val3) {
43; CHECK-LABEL: f4:
44; CHECK: vfmadb %v24, %v26, %v28, %v30
45; CHECK: br %r14
46  %ret = call <2 x double> @llvm.fma.v2f64 (<2 x double> %val1,
47                                            <2 x double> %val2,
48                                            <2 x double> %val3)
49  ret <2 x double> %ret
50}
51
52; Test a v2f64 multiply-and-subtract.
53define <2 x double> @f5(<2 x double> %dummy, <2 x double> %val1,
54                        <2 x double> %val2, <2 x double> %val3) {
55; CHECK-LABEL: f5:
56; CHECK: vfmsdb %v24, %v26, %v28, %v30
57; CHECK: br %r14
58  %negval3 = fsub <2 x double> <double -0.0, double -0.0>, %val3
59  %ret = call <2 x double> @llvm.fma.v2f64 (<2 x double> %val1,
60                                            <2 x double> %val2,
61                                            <2 x double> %negval3)
62  ret <2 x double> %ret
63}
64