1
- //@ revisions: powerpc powerpc64
1
+ //@ revisions: powerpc powerpc_altivec powerpc_vsx powerpc64 powerpc64_vsx
2
2
//@ assembly-output: emit-asm
3
3
//@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
4
4
//@[powerpc] needs-llvm-components: powerpc
5
- //@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
5
+ //@[powerpc_altivec] compile-flags: --target powerpc-unknown-linux-gnu -C target-feature=+altivec --cfg altivec
6
+ //@[powerpc_altivec] needs-llvm-components: powerpc
7
+ //@[powerpc_vsx] compile-flags: --target powerpc-unknown-linux-gnu -C target-feature=+altivec,+vsx --cfg altivec --cfg vsx
8
+ //@[powerpc_vsx] needs-llvm-components: powerpc
9
+ //@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu --cfg altivec
6
10
//@[powerpc64] needs-llvm-components: powerpc
11
+ //@[powerpc64_vsx] compile-flags: --target powerpc64-unknown-linux-gnu -C target-feature=+vsx --cfg altivec --cfg vsx
12
+ //@[powerpc64_vsx] needs-llvm-components: powerpc
7
13
//@ compile-flags: -Zmerge-functions=disabled
8
14
9
15
#![ feature( no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch) ]
@@ -29,8 +35,23 @@ trait Sized {}
29
35
#[ lang = "copy" ]
30
36
trait Copy { }
31
37
38
+ impl < T : Copy , const N : usize > Copy for [ T ; N ] { }
39
+
32
40
type ptr = * const i32 ;
33
41
42
+ #[ repr( simd) ]
43
+ pub struct i8x16 ( [ i8 ; 16 ] ) ;
44
+ #[ repr( simd) ]
45
+ pub struct i16x8 ( [ i16 ; 8 ] ) ;
46
+ #[ repr( simd) ]
47
+ pub struct i32x4 ( [ i32 ; 4 ] ) ;
48
+ #[ repr( simd) ]
49
+ pub struct i64x2 ( [ i64 ; 2 ] ) ;
50
+ #[ repr( simd) ]
51
+ pub struct f32x4 ( [ f32 ; 4 ] ) ;
52
+ #[ repr( simd) ]
53
+ pub struct f64x2 ( [ f64 ; 2 ] ) ;
54
+
34
55
impl Copy for i8 { }
35
56
impl Copy for u8 { }
36
57
impl Copy for i16 { }
@@ -39,6 +60,13 @@ impl Copy for i64 {}
39
60
impl Copy for f32 { }
40
61
impl Copy for f64 { }
41
62
impl Copy for ptr { }
63
+ impl Copy for i8x16 { }
64
+ impl Copy for i16x8 { }
65
+ impl Copy for i32x4 { }
66
+ impl Copy for i64x2 { }
67
+ impl Copy for f32x4 { }
68
+ impl Copy for f64x2 { }
69
+
42
70
extern "C" {
43
71
fn extern_func ( ) ;
44
72
static extern_static: u8 ;
@@ -124,6 +152,48 @@ check!(reg_f32, f32, freg, "fmr");
124
152
// CHECK: #NO_APP
125
153
check ! ( reg_f64, f64 , freg, "fmr" ) ;
126
154
155
+ // altivec-LABEL: vreg_i8x16:
156
+ // altivec: #APP
157
+ // altivec: vmr {{[0-9]+}}, {{[0-9]+}}
158
+ // altivec: #NO_APP
159
+ #[ cfg( altivec) ]
160
+ check ! ( vreg_i8x16, i8x16, vreg, "vmr" ) ;
161
+
162
+ // altivec-LABEL: vreg_i16x8:
163
+ // altivec: #APP
164
+ // altivec: vmr {{[0-9]+}}, {{[0-9]+}}
165
+ // altivec: #NO_APP
166
+ #[ cfg( altivec) ]
167
+ check ! ( vreg_i16x8, i16x8, vreg, "vmr" ) ;
168
+
169
+ // altivec-LABEL: vreg_i32x4:
170
+ // altivec: #APP
171
+ // altivec: vmr {{[0-9]+}}, {{[0-9]+}}
172
+ // altivec: #NO_APP
173
+ #[ cfg( altivec) ]
174
+ check ! ( vreg_i32x4, i32x4, vreg, "vmr" ) ;
175
+
176
+ // vsx-LABEL: vreg_i64x2:
177
+ // vsx: #APP
178
+ // vsx: vmr {{[0-9]+}}, {{[0-9]+}}
179
+ // vsx: #NO_APP
180
+ #[ cfg( vsx) ]
181
+ check ! ( vreg_i64x2, i64x2, vreg, "vmr" ) ;
182
+
183
+ // altivec-LABEL: vreg_f32x4:
184
+ // altivec: #APP
185
+ // altivec: vmr {{[0-9]+}}, {{[0-9]+}}
186
+ // altivec: #NO_APP
187
+ #[ cfg( altivec) ]
188
+ check ! ( vreg_f32x4, f32x4, vreg, "vmr" ) ;
189
+
190
+ // vsx-LABEL: vreg_f64x2:
191
+ // vsx: #APP
192
+ // vsx: vmr {{[0-9]+}}, {{[0-9]+}}
193
+ // vsx: #NO_APP
194
+ #[ cfg( vsx) ]
195
+ check ! ( vreg_f64x2, f64x2, vreg, "vmr" ) ;
196
+
127
197
// CHECK-LABEL: reg_i8_r0:
128
198
// CHECK: #APP
129
199
// CHECK: mr 0, 0
@@ -197,3 +267,87 @@ check_reg!(reg_f32_f18, f32, "18", "f18", "fmr");
197
267
// CHECK: fmr 18, 18
198
268
// CHECK: #NO_APP
199
269
check_reg ! ( reg_f64_f18, f64 , "18" , "f18" , "fmr" ) ;
270
+
271
+ // altivec-LABEL: vreg_i8x16_v0:
272
+ // altivec: #APP
273
+ // altivec: vmr 0, 0
274
+ // altivec: #NO_APP
275
+ #[ cfg( altivec) ]
276
+ check_reg ! ( vreg_i8x16_v0, i8x16, "0" , "v0" , "vmr" ) ;
277
+
278
+ // altivec-LABEL: vreg_i16x8_v0:
279
+ // altivec: #APP
280
+ // altivec: vmr 0, 0
281
+ // altivec: #NO_APP
282
+ #[ cfg( altivec) ]
283
+ check_reg ! ( vreg_i16x8_v0, i16x8, "0" , "v0" , "vmr" ) ;
284
+
285
+ // altivec-LABEL: vreg_i32x4_v0:
286
+ // altivec: #APP
287
+ // altivec: vmr 0, 0
288
+ // altivec: #NO_APP
289
+ #[ cfg( altivec) ]
290
+ check_reg ! ( vreg_i32x4_v0, i32x4, "0" , "v0" , "vmr" ) ;
291
+
292
+ // vsx-LABEL: vreg_i64x2_v0:
293
+ // vsx: #APP
294
+ // vsx: vmr 0, 0
295
+ // vsx: #NO_APP
296
+ #[ cfg( vsx) ]
297
+ check_reg ! ( vreg_i64x2_v0, i64x2, "0" , "v0" , "vmr" ) ;
298
+
299
+ // altivec-LABEL: vreg_f32x4_v0:
300
+ // altivec: #APP
301
+ // altivec: vmr 0, 0
302
+ // altivec: #NO_APP
303
+ #[ cfg( altivec) ]
304
+ check_reg ! ( vreg_f32x4_v0, f32x4, "0" , "v0" , "vmr" ) ;
305
+
306
+ // vsx-LABEL: vreg_f64x2_v0:
307
+ // vsx: #APP
308
+ // vsx: vmr 0, 0
309
+ // vsx: #NO_APP
310
+ #[ cfg( vsx) ]
311
+ check_reg ! ( vreg_f64x2_v0, f64x2, "0" , "v0" , "vmr" ) ;
312
+
313
+ // altivec-LABEL: vreg_i8x16_v18:
314
+ // altivec: #APP
315
+ // altivec: vmr 18, 18
316
+ // altivec: #NO_APP
317
+ #[ cfg( altivec) ]
318
+ check_reg ! ( vreg_i8x16_v18, i8x16, "18" , "v18" , "vmr" ) ;
319
+
320
+ // altivec-LABEL: vreg_i16x8_v18:
321
+ // altivec: #APP
322
+ // altivec: vmr 18, 18
323
+ // altivec: #NO_APP
324
+ #[ cfg( altivec) ]
325
+ check_reg ! ( vreg_i16x8_v18, i16x8, "18" , "v18" , "vmr" ) ;
326
+
327
+ // altivec-LABEL: vreg_i32x4_v18:
328
+ // altivec: #APP
329
+ // altivec: vmr 18, 18
330
+ // altivec: #NO_APP
331
+ #[ cfg( altivec) ]
332
+ check_reg ! ( vreg_i32x4_v18, i32x4, "18" , "v18" , "vmr" ) ;
333
+
334
+ // vsx-LABEL: vreg_i64x2_v18:
335
+ // vsx: #APP
336
+ // vsx: vmr 18, 18
337
+ // vsx: #NO_APP
338
+ #[ cfg( vsx) ]
339
+ check_reg ! ( vreg_i64x2_v18, i64x2, "18" , "v18" , "vmr" ) ;
340
+
341
+ // altivec-LABEL: vreg_f32x4_v18:
342
+ // altivec: #APP
343
+ // altivec: vmr 18, 18
344
+ // altivec: #NO_APP
345
+ #[ cfg( altivec) ]
346
+ check_reg ! ( vreg_f32x4_v18, f32x4, "18" , "v18" , "vmr" ) ;
347
+
348
+ // vsx-LABEL: vreg_f64x2_v18:
349
+ // vsx: #APP
350
+ // vsx: vmr 18, 18
351
+ // vsx: #NO_APP
352
+ #[ cfg( vsx) ]
353
+ check_reg ! ( vreg_f64x2_v18, f64x2, "18" , "v18" , "vmr" ) ;
0 commit comments