1; Test vector maximum/minimum with a zero splat on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5define <2 x double> @f1(<2 x double> %val) {
6; CHECK-LABEL: f1:
7; CHECK: vgbm %v0, 0
8; CHECK-NEXT: vfmaxdb %v24, %v24, %v0, 4
9; CHECK-NEXT: br %r14
10  %cmp = fcmp ogt <2 x double> %val,  zeroinitializer
11  %ret = select <2 x i1> %cmp, <2 x double> %val, <2 x double> zeroinitializer
12  ret <2 x double> %ret
13}
14
15define <2 x double> @f2(<2 x double> %val) {
16; CHECK-LABEL: f2:
17; CHECK: vgbm %v0, 0
18; CHECK-NEXT: vfmindb %v24, %v24, %v0, 4
19; CHECK-NEXT: br %r14
20  %cmp = fcmp olt <2 x double> %val,  zeroinitializer
21  %ret = select <2 x i1> %cmp, <2 x double> %val, <2 x double> zeroinitializer
22  ret <2 x double> %ret
23}
24
25define <4 x float> @f3(<4 x float> %val) {
26; CHECK-LABEL: f3:
27; CHECK: vgbm %v0, 0
28; CHECK-NEXT: vfmaxsb %v24, %v24, %v0, 4
29; CHECK-NEXT: br %r14
30  %cmp = fcmp ogt <4 x float> %val,  zeroinitializer
31  %ret = select <4 x i1> %cmp, <4 x float> %val, <4 x float> zeroinitializer
32  ret <4 x float> %ret
33}
34
35define <4 x float> @f4(<4 x float> %val) {
36; CHECK-LABEL: f4:
37; CHECK: vgbm %v0, 0
38; CHECK-NEXT: vfminsb %v24, %v24, %v0, 4
39; CHECK-NEXT: br %r14
40  %cmp = fcmp olt <4 x float> %val,  zeroinitializer
41  %ret = select <4 x i1> %cmp, <4 x float> %val, <4 x float> zeroinitializer
42  ret <4 x float> %ret
43}
44
45define <2 x double> @f5(<2 x double> %val) {
46; CHECK-LABEL: f5:
47; CHECK: vgbm %v0, 0
48; CHECK-NEXT: vfmaxdb %v24, %v24, %v0, 1
49; CHECK-NEXT: br %r14
50  %cmp = fcmp ugt <2 x double> %val,  zeroinitializer
51  %ret = select <2 x i1> %cmp, <2 x double> %val, <2 x double> zeroinitializer
52  ret <2 x double> %ret
53}
54
55define <2 x double> @f6(<2 x double> %val) {
56; CHECK-LABEL: f6:
57; CHECK: vgbm %v0, 0
58; CHECK-NEXT: vfmindb %v24, %v24, %v0, 1
59; CHECK-NEXT: br %r14
60  %cmp = fcmp ult <2 x double> %val,  zeroinitializer
61  %ret = select <2 x i1> %cmp, <2 x double> %val, <2 x double> zeroinitializer
62  ret <2 x double> %ret
63}
64
65define <4 x float> @f7(<4 x float> %val) {
66; CHECK-LABEL: f7:
67; CHECK: vgbm %v0, 0
68; CHECK-NEXT: vfmaxsb %v24, %v24, %v0, 1
69; CHECK-NEXT: br %r14
70  %cmp = fcmp ugt <4 x float> %val,  zeroinitializer
71  %ret = select <4 x i1> %cmp, <4 x float> %val, <4 x float> zeroinitializer
72  ret <4 x float> %ret
73}
74
75define <4 x float> @f8(<4 x float> %val) {
76; CHECK-LABEL: f8:
77; CHECK: vgbm %v0, 0
78; CHECK-NEXT: vfminsb %v24, %v24, %v0, 1
79; CHECK-NEXT: br %r14
80  %cmp = fcmp ult <4 x float> %val,  zeroinitializer
81  %ret = select <4 x i1> %cmp, <4 x float> %val, <4 x float> zeroinitializer
82  ret <4 x float> %ret
83}
84