1
- //@ revisions: s390x
1
+ //@ revisions: s390x s390x_vector
2
2
//@ assembly-output: emit-asm
3
3
//@[s390x] compile-flags: --target s390x-unknown-linux-gnu
4
4
//@[s390x] needs-llvm-components: systemz
5
+ //@[s390x_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector
6
+ //@[s390x_vector] needs-llvm-components: systemz
5
7
//@ compile-flags: -Zmerge-functions=disabled
6
8
7
9
#![ feature( no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch) ]
@@ -27,8 +29,23 @@ trait Sized {}
27
29
#[ lang = "copy" ]
28
30
trait Copy { }
29
31
32
+ impl < T : Copy , const N : usize > Copy for [ T ; N ] { }
33
+
30
34
type ptr = * const i32 ;
31
35
36
+ #[ repr( simd) ]
37
+ pub struct i8x16 ( [ i8 ; 16 ] ) ;
38
+ #[ repr( simd) ]
39
+ pub struct i16x8 ( [ i16 ; 8 ] ) ;
40
+ #[ repr( simd) ]
41
+ pub struct i32x4 ( [ i32 ; 4 ] ) ;
42
+ #[ repr( simd) ]
43
+ pub struct i64x2 ( [ i64 ; 2 ] ) ;
44
+ #[ repr( simd) ]
45
+ pub struct f32x4 ( [ f32 ; 4 ] ) ;
46
+ #[ repr( simd) ]
47
+ pub struct f64x2 ( [ f64 ; 2 ] ) ;
48
+
32
49
impl Copy for i8 { }
33
50
impl Copy for u8 { }
34
51
impl Copy for i16 { }
@@ -37,6 +54,12 @@ impl Copy for i64 {}
37
54
impl Copy for f32 { }
38
55
impl Copy for f64 { }
39
56
impl Copy for ptr { }
57
+ impl Copy for i8x16 { }
58
+ impl Copy for i16x8 { }
59
+ impl Copy for i32x4 { }
60
+ impl Copy for i64x2 { }
61
+ impl Copy for f32x4 { }
62
+ impl Copy for f64x2 { }
40
63
41
64
extern "C" {
42
65
fn extern_func ( ) ;
@@ -65,7 +88,6 @@ macro_rules! check_reg { ($func:ident, $ty:ty, $reg:tt, $mov:literal) => {
65
88
// CHECK: #APP
66
89
// CHECK: brasl %r14, extern_func
67
90
// CHECK: #NO_APP
68
- #[ cfg( s390x) ]
69
91
#[ no_mangle]
70
92
pub unsafe fn sym_fn_32 ( ) {
71
93
asm ! ( "brasl %r14, {}" , sym extern_func) ;
@@ -146,6 +168,48 @@ check!(reg_f64, f64, freg, "ldr");
146
168
// CHECK: #NO_APP
147
169
check ! ( reg_ptr, ptr, reg, "lgr" ) ;
148
170
171
+ // s390x_vector-LABEL: vreg_i8x16:
172
+ // s390x_vector: #APP
173
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
174
+ // s390x_vector: #NO_APP
175
+ #[ cfg( s390x_vector) ]
176
+ check ! ( vreg_i8x16, i8x16, vreg, "vlr" ) ;
177
+
178
+ // s390x_vector-LABEL: vreg_i16x8:
179
+ // s390x_vector: #APP
180
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
181
+ // s390x_vector: #NO_APP
182
+ #[ cfg( s390x_vector) ]
183
+ check ! ( vreg_i16x8, i16x8, vreg, "vlr" ) ;
184
+
185
+ // s390x_vector-LABEL: vreg_i32x4:
186
+ // s390x_vector: #APP
187
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
188
+ // s390x_vector: #NO_APP
189
+ #[ cfg( s390x_vector) ]
190
+ check ! ( vreg_i32x4, i32x4, vreg, "vlr" ) ;
191
+
192
+ // s390x_vector-LABEL: vreg_i64x2:
193
+ // s390x_vector: #APP
194
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
195
+ // s390x_vector: #NO_APP
196
+ #[ cfg( s390x_vector) ]
197
+ check ! ( vreg_i64x2, i64x2, vreg, "vlr" ) ;
198
+
199
+ // s390x_vector-LABEL: vreg_f32x4:
200
+ // s390x_vector: #APP
201
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
202
+ // s390x_vector: #NO_APP
203
+ #[ cfg( s390x_vector) ]
204
+ check ! ( vreg_f32x4, f32x4, vreg, "vlr" ) ;
205
+
206
+ // s390x_vector-LABEL: vreg_f64x2:
207
+ // s390x_vector: #APP
208
+ // s390x_vector: vlr %v{{[0-9]+}}, %v{{[0-9]+}}
209
+ // s390x_vector: #NO_APP
210
+ #[ cfg( s390x_vector) ]
211
+ check ! ( vreg_f64x2, f64x2, vreg, "vlr" ) ;
212
+
149
213
// CHECK-LABEL: r0_i8:
150
214
// CHECK: #APP
151
215
// CHECK: lr %r0, %r0
@@ -181,3 +245,45 @@ check_reg!(f0_f32, f32, "f0", "ler");
181
245
// CHECK: ldr %f0, %f0
182
246
// CHECK: #NO_APP
183
247
check_reg ! ( f0_f64, f64 , "f0" , "ldr" ) ;
248
+
249
+ // s390x_vector-LABEL: v0_i8x16:
250
+ // s390x_vector: #APP
251
+ // s390x_vector: vlr %v0, %v0
252
+ // s390x_vector: #NO_APP
253
+ #[ cfg( s390x_vector) ]
254
+ check_reg ! ( v0_i8x16, i8x16, "v0" , "vlr" ) ;
255
+
256
+ // s390x_vector-LABEL: v0_i16x8:
257
+ // s390x_vector: #APP
258
+ // s390x_vector: vlr %v0, %v0
259
+ // s390x_vector: #NO_APP
260
+ #[ cfg( s390x_vector) ]
261
+ check_reg ! ( v0_i16x8, i16x8, "v0" , "vlr" ) ;
262
+
263
+ // s390x_vector-LABEL: v0_i32x4:
264
+ // s390x_vector: #APP
265
+ // s390x_vector: vlr %v0, %v0
266
+ // s390x_vector: #NO_APP
267
+ #[ cfg( s390x_vector) ]
268
+ check_reg ! ( v0_i32x4, i32x4, "v0" , "vlr" ) ;
269
+
270
+ // s390x_vector-LABEL: v0_i64x2:
271
+ // s390x_vector: #APP
272
+ // s390x_vector: vlr %v0, %v0
273
+ // s390x_vector: #NO_APP
274
+ #[ cfg( s390x_vector) ]
275
+ check_reg ! ( v0_i64x2, i64x2, "v0" , "vlr" ) ;
276
+
277
+ // s390x_vector-LABEL: v0_f32x4:
278
+ // s390x_vector: #APP
279
+ // s390x_vector: vlr %v0, %v0
280
+ // s390x_vector: #NO_APP
281
+ #[ cfg( s390x_vector) ]
282
+ check_reg ! ( v0_f32x4, f32x4, "v0" , "vlr" ) ;
283
+
284
+ // s390x_vector-LABEL: v0_f64x2:
285
+ // s390x_vector: #APP
286
+ // s390x_vector: vlr %v0, %v0
287
+ // s390x_vector: #NO_APP
288
+ #[ cfg( s390x_vector) ]
289
+ check_reg ! ( v0_f64x2, f64x2, "v0" , "vlr" ) ;
0 commit comments