Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / SystemZ / zvector2.c
blob36cbf228feac8692991588a2c04217dacb57e799
1 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
2 // RUN: -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
4 volatile vector float ff, ff2;
5 volatile vector bool int bi;
7 void test_assign (void)
9 // CHECK-LABEL: test_assign
10 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
11 // CHECK: store volatile <4 x float> [[VAL]], ptr @ff
12 ff = ff2;
15 void test_pos (void)
17 // CHECK-LABEL: test_pos
18 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
19 // CHECK: store volatile <4 x float> [[VAL]], ptr @ff
20 ff = +ff2;
23 void test_neg (void)
25 // CHECK-LABEL: test_neg
26 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
27 // CHECK: %{{.*}} = fneg <4 x float> [[VAL]]
28 ff = -ff2;
31 void test_preinc (void)
33 // CHECK-LABEL: test_preinc
34 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
35 // CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
36 ++ff2;
39 void test_postinc (void)
41 // CHECK-LABEL: test_postinc
42 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
43 // CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
44 ff2++;
47 void test_predec (void)
49 // CHECK-LABEL: test_predec
50 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
51 // CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
52 --ff2;
55 void test_postdec (void)
57 // CHECK-LABEL: test_postdec
58 // CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
59 // CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
60 ff2--;
63 void test_add (void)
65 // CHECK-LABEL: test_add
66 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
67 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
68 // CHECK: %{{.*}} = fadd <4 x float> [[VAL1]], [[VAL2]]
69 ff = ff + ff2;
72 void test_add_assign (void)
74 // CHECK-LABEL: test_add_assign
75 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
76 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
77 // CHECK: %{{.*}} = fadd <4 x float> [[VAL2]], [[VAL1]]
78 ff += ff2;
81 void test_sub (void)
83 // CHECK-LABEL: test_sub
84 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
85 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
86 // CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]]
87 ff = ff - ff2;
90 void test_sub_assign (void)
92 // CHECK-LABEL: test_sub_assign
93 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
94 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
95 // CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]]
96 ff -= ff2;
99 void test_mul (void)
101 // CHECK-LABEL: test_mul
102 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
103 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
104 // CHECK: %{{.*}} = fmul <4 x float> [[VAL1]], [[VAL2]]
105 ff = ff * ff2;
108 void test_mul_assign (void)
110 // CHECK-LABEL: test_mul_assign
111 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
112 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
113 // CHECK: %{{.*}} = fmul <4 x float> [[VAL2]], [[VAL1]]
114 ff *= ff2;
117 void test_div (void)
119 // CHECK-LABEL: test_div
120 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
121 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
122 // CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]]
123 ff = ff / ff2;
126 void test_div_assign (void)
128 // CHECK-LABEL: test_div_assign
129 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
130 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
131 // CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]]
132 ff /= ff2;
135 void test_cmpeq (void)
137 // CHECK-LABEL: test_cmpeq
138 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
139 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
140 // CHECK: [[CMP:%[^ ]+]] = fcmp oeq <4 x float> [[VAL1]], [[VAL2]]
141 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
142 bi = ff == ff2;
145 void test_cmpne (void)
147 // CHECK-LABEL: test_cmpne
148 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
149 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
150 // CHECK: [[CMP:%[^ ]+]] = fcmp une <4 x float> [[VAL1]], [[VAL2]]
151 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
152 bi = ff != ff2;
155 void test_cmpge (void)
157 // CHECK-LABEL: test_cmpge
158 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
159 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
160 // CHECK: [[CMP:%[^ ]+]] = fcmp oge <4 x float> [[VAL1]], [[VAL2]]
161 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
162 bi = ff >= ff2;
165 void test_cmpgt (void)
167 // CHECK-LABEL: test_cmpgt
168 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
169 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
170 // CHECK: [[CMP:%[^ ]+]] = fcmp ogt <4 x float> [[VAL1]], [[VAL2]]
171 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
172 bi = ff > ff2;
175 void test_cmple (void)
177 // CHECK-LABEL: test_cmple
178 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
179 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
180 // CHECK: [[CMP:%[^ ]+]] = fcmp ole <4 x float> [[VAL1]], [[VAL2]]
181 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
182 bi = ff <= ff2;
185 void test_cmplt (void)
187 // CHECK-LABEL: test_cmplt
188 // CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, ptr @ff
189 // CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, ptr @ff2
190 // CHECK: [[CMP:%[^ ]+]] = fcmp olt <4 x float> [[VAL1]], [[VAL2]]
191 // CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
192 bi = ff < ff2;