zvector2.c
5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 -fzvector \
// RUN: -O -emit-llvm -o - -W -Wall -Werror %s | FileCheck %s
volatile vector float ff, ff2;
volatile vector bool int bi;
void test_assign (void)
{
// CHECK-LABEL: test_assign
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: store volatile <4 x float> [[VAL]], <4 x float>* @ff
ff = ff2;
}
void test_pos (void)
{
// CHECK-LABEL: test_pos
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: store volatile <4 x float> [[VAL]], <4 x float>* @ff
ff = +ff2;
}
void test_neg (void)
{
// CHECK-LABEL: test_neg
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fneg <4 x float> [[VAL]]
ff = -ff2;
}
void test_preinc (void)
{
// CHECK-LABEL: test_preinc
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
++ff2;
}
void test_postinc (void)
{
// CHECK-LABEL: test_postinc
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>
ff2++;
}
void test_predec (void)
{
// CHECK-LABEL: test_predec
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
--ff2;
}
void test_postdec (void)
{
// CHECK-LABEL: test_postdec
// CHECK: [[VAL:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fadd <4 x float> [[VAL]], <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
ff2--;
}
void test_add (void)
{
// CHECK-LABEL: test_add
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fadd <4 x float> [[VAL1]], [[VAL2]]
ff = ff + ff2;
}
void test_add_assign (void)
{
// CHECK-LABEL: test_add_assign
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: %{{.*}} = fadd <4 x float> [[VAL2]], [[VAL1]]
ff += ff2;
}
void test_sub (void)
{
// CHECK-LABEL: test_sub
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]]
ff = ff - ff2;
}
void test_sub_assign (void)
{
// CHECK-LABEL: test_sub_assign
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: %{{.*}} = fsub <4 x float> [[VAL1]], [[VAL2]]
ff -= ff2;
}
void test_mul (void)
{
// CHECK-LABEL: test_mul
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fmul <4 x float> [[VAL1]], [[VAL2]]
ff = ff * ff2;
}
void test_mul_assign (void)
{
// CHECK-LABEL: test_mul_assign
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: %{{.*}} = fmul <4 x float> [[VAL2]], [[VAL1]]
ff *= ff2;
}
void test_div (void)
{
// CHECK-LABEL: test_div
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]]
ff = ff / ff2;
}
void test_div_assign (void)
{
// CHECK-LABEL: test_div_assign
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: %{{.*}} = fdiv <4 x float> [[VAL1]], [[VAL2]]
ff /= ff2;
}
void test_cmpeq (void)
{
// CHECK-LABEL: test_cmpeq
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp oeq <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff == ff2;
}
void test_cmpne (void)
{
// CHECK-LABEL: test_cmpne
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp une <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff != ff2;
}
void test_cmpge (void)
{
// CHECK-LABEL: test_cmpge
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp oge <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff >= ff2;
}
void test_cmpgt (void)
{
// CHECK-LABEL: test_cmpgt
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp ogt <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff > ff2;
}
void test_cmple (void)
{
// CHECK-LABEL: test_cmple
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp ole <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff <= ff2;
}
void test_cmplt (void)
{
// CHECK-LABEL: test_cmplt
// CHECK: [[VAL1:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff
// CHECK: [[VAL2:%[^ ]+]] = load volatile <4 x float>, <4 x float>* @ff2
// CHECK: [[CMP:%[^ ]+]] = fcmp olt <4 x float> [[VAL1]], [[VAL2]]
// CHECK: %{{.*}} = sext <4 x i1> [[CMP]] to <4 x i32>
bi = ff < ff2;
}