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) ]
10
16
#![ crate_type = "rlib" ]
11
17
#![ no_core]
12
18
#![ allow( asm_sub_register, non_camel_case_types) ]
13
19
20
+ #[ cfg_attr( altivec, cfg( not( target_feature = "altivec" ) ) ) ]
21
+ #[ cfg_attr( not( altivec) , cfg( target_feature = "altivec" ) ) ]
22
+ compile_error ! ( "altivec cfg and target feature mismatch" ) ;
23
+ #[ cfg_attr( vsx, cfg( not( target_feature = "vsx" ) ) ) ]
24
+ #[ cfg_attr( not( vsx) , cfg( target_feature = "vsx" ) ) ]
25
+ compile_error ! ( "vsx cfg and target feature mismatch" ) ;
26
+
14
27
#[ rustc_builtin_macro]
15
28
macro_rules! asm {
16
29
( ) => { } ;
@@ -29,8 +42,23 @@ trait Sized {}
29
42
#[ lang = "copy" ]
30
43
trait Copy { }
31
44
45
+ impl < T : Copy , const N : usize > Copy for [ T ; N ] { }
46
+
32
47
type ptr = * const i32 ;
33
48
49
+ #[ repr( simd) ]
50
+ pub struct i8x16 ( [ i8 ; 16 ] ) ;
51
+ #[ repr( simd) ]
52
+ pub struct i16x8 ( [ i16 ; 8 ] ) ;
53
+ #[ repr( simd) ]
54
+ pub struct i32x4 ( [ i32 ; 4 ] ) ;
55
+ #[ repr( simd) ]
56
+ pub struct i64x2 ( [ i64 ; 2 ] ) ;
57
+ #[ repr( simd) ]
58
+ pub struct f32x4 ( [ f32 ; 4 ] ) ;
59
+ #[ repr( simd) ]
60
+ pub struct f64x2 ( [ f64 ; 2 ] ) ;
61
+
34
62
impl Copy for i8 { }
35
63
impl Copy for u8 { }
36
64
impl Copy for i16 { }
@@ -39,6 +67,13 @@ impl Copy for i64 {}
39
67
impl Copy for f32 { }
40
68
impl Copy for f64 { }
41
69
impl Copy for ptr { }
70
+ impl Copy for i8x16 { }
71
+ impl Copy for i16x8 { }
72
+ impl Copy for i32x4 { }
73
+ impl Copy for i64x2 { }
74
+ impl Copy for f32x4 { }
75
+ impl Copy for f64x2 { }
76
+
42
77
extern "C" {
43
78
fn extern_func ( ) ;
44
79
static extern_static: u8 ;
@@ -124,6 +159,72 @@ check!(reg_f32, f32, freg, "fmr");
124
159
// CHECK: #NO_APP
125
160
check ! ( reg_f64, f64 , freg, "fmr" ) ;
126
161
162
+ // powerpc_altivec-LABEL: vreg_i8x16:
163
+ // powerpc_altivec: #APP
164
+ // powerpc_altivec: vmr {{[0-9]+}}, {{[0-9]+}}
165
+ // powerpc_altivec: #NO_APP
166
+ // powerpc64-LABEL: vreg_i8x16:
167
+ // powerpc64: #APP
168
+ // powerpc64: vmr {{[0-9]+}}, {{[0-9]+}}
169
+ // powerpc64: #NO_APP
170
+ #[ cfg( altivec) ]
171
+ check ! ( vreg_i8x16, i8x16, vreg, "vmr" ) ;
172
+
173
+ // powerpc_altivec-LABEL: vreg_i16x8:
174
+ // powerpc_altivec: #APP
175
+ // powerpc_altivec: vmr {{[0-9]+}}, {{[0-9]+}}
176
+ // powerpc_altivec: #NO_APP
177
+ // powerpc64-LABEL: vreg_i16x8:
178
+ // powerpc64: #APP
179
+ // powerpc64: vmr {{[0-9]+}}, {{[0-9]+}}
180
+ // powerpc64: #NO_APP
181
+ #[ cfg( altivec) ]
182
+ check ! ( vreg_i16x8, i16x8, vreg, "vmr" ) ;
183
+
184
+ // powerpc_altivec-LABEL: vreg_i32x4:
185
+ // powerpc_altivec: #APP
186
+ // powerpc_altivec: vmr {{[0-9]+}}, {{[0-9]+}}
187
+ // powerpc_altivec: #NO_APP
188
+ // powerpc64-LABEL: vreg_i32x4:
189
+ // powerpc64: #APP
190
+ // powerpc64: vmr {{[0-9]+}}, {{[0-9]+}}
191
+ // powerpc64: #NO_APP
192
+ #[ cfg( altivec) ]
193
+ check ! ( vreg_i32x4, i32x4, vreg, "vmr" ) ;
194
+
195
+ // powerpc_vsx-LABEL: vreg_i64x2:
196
+ // powerpc_vsx: #APP
197
+ // powerpc_vsx: vmr {{[0-9]+}}, {{[0-9]+}}
198
+ // powerpc_vsx: #NO_APP
199
+ // powerpc64_vsx-LABEL: vreg_i64x2:
200
+ // powerpc64_vsx: #APP
201
+ // powerpc64_vsx: vmr {{[0-9]+}}, {{[0-9]+}}
202
+ // powerpc64_vsx: #NO_APP
203
+ #[ cfg( vsx) ]
204
+ check ! ( vreg_i64x2, i64x2, vreg, "vmr" ) ;
205
+
206
+ // powerpc_altivec-LABEL: vreg_f32x4:
207
+ // powerpc_altivec: #APP
208
+ // powerpc_altivec: vmr {{[0-9]+}}, {{[0-9]+}}
209
+ // powerpc_altivec: #NO_APP
210
+ // powerpc64-LABEL: vreg_f32x4:
211
+ // powerpc64: #APP
212
+ // powerpc64: vmr {{[0-9]+}}, {{[0-9]+}}
213
+ // powerpc64: #NO_APP
214
+ #[ cfg( altivec) ]
215
+ check ! ( vreg_f32x4, f32x4, vreg, "vmr" ) ;
216
+
217
+ // powerpc_vsx-LABEL: vreg_f64x2:
218
+ // powerpc_vsx: #APP
219
+ // powerpc_vsx: vmr {{[0-9]+}}, {{[0-9]+}}
220
+ // powerpc_vsx: #NO_APP
221
+ // powerpc64_vsx-LABEL: vreg_f64x2:
222
+ // powerpc64_vsx: #APP
223
+ // powerpc64_vsx: vmr {{[0-9]+}}, {{[0-9]+}}
224
+ // powerpc64_vsx: #NO_APP
225
+ #[ cfg( vsx) ]
226
+ check ! ( vreg_f64x2, f64x2, vreg, "vmr" ) ;
227
+
127
228
// CHECK-LABEL: reg_i8_r0:
128
229
// CHECK: #APP
129
230
// CHECK: mr 0, 0
@@ -197,3 +298,135 @@ check_reg!(reg_f32_f18, f32, "18", "f18", "fmr");
197
298
// CHECK: fmr 18, 18
198
299
// CHECK: #NO_APP
199
300
check_reg ! ( reg_f64_f18, f64 , "18" , "f18" , "fmr" ) ;
301
+
302
+ // powerpc_altivec-LABEL: vreg_i8x16_v0:
303
+ // powerpc_altivec: #APP
304
+ // powerpc_altivec: vmr 0, 0
305
+ // powerpc_altivec: #NO_APP
306
+ // powerpc64-LABEL: vreg_i8x16_v0:
307
+ // powerpc64: #APP
308
+ // powerpc64: vmr 0, 0
309
+ // powerpc64: #NO_APP
310
+ #[ cfg( altivec) ]
311
+ check_reg ! ( vreg_i8x16_v0, i8x16, "0" , "v0" , "vmr" ) ;
312
+
313
+ // powerpc_altivec-LABEL: vreg_i16x8_v0:
314
+ // powerpc_altivec: #APP
315
+ // powerpc_altivec: vmr 0, 0
316
+ // powerpc_altivec: #NO_APP
317
+ // powerpc64-LABEL: vreg_i16x8_v0:
318
+ // powerpc64: #APP
319
+ // powerpc64: vmr 0, 0
320
+ // powerpc64: #NO_APP
321
+ #[ cfg( altivec) ]
322
+ check_reg ! ( vreg_i16x8_v0, i16x8, "0" , "v0" , "vmr" ) ;
323
+
324
+ // powerpc_altivec-LABEL: vreg_i32x4_v0:
325
+ // powerpc_altivec: #APP
326
+ // powerpc_altivec: vmr 0, 0
327
+ // powerpc_altivec: #NO_APP
328
+ // powerpc64-LABEL: vreg_i32x4_v0:
329
+ // powerpc64: #APP
330
+ // powerpc64: vmr 0, 0
331
+ // powerpc64: #NO_APP
332
+ #[ cfg( altivec) ]
333
+ check_reg ! ( vreg_i32x4_v0, i32x4, "0" , "v0" , "vmr" ) ;
334
+
335
+ // powerpc_vsx-LABEL: vreg_i64x2_v0:
336
+ // powerpc_vsx: #APP
337
+ // powerpc_vsx: vmr 0, 0
338
+ // powerpc_vsx: #NO_APP
339
+ // powerpc64_vsx-LABEL: vreg_i64x2_v0:
340
+ // powerpc64_vsx: #APP
341
+ // powerpc64_vsx: vmr 0, 0
342
+ // powerpc64_vsx: #NO_APP
343
+ #[ cfg( vsx) ]
344
+ check_reg ! ( vreg_i64x2_v0, i64x2, "0" , "v0" , "vmr" ) ;
345
+
346
+ // powerpc_altivec-LABEL: vreg_f32x4_v0:
347
+ // powerpc_altivec: #APP
348
+ // powerpc_altivec: vmr 0, 0
349
+ // powerpc_altivec: #NO_APP
350
+ // powerpc64-LABEL: vreg_f32x4_v0:
351
+ // powerpc64: #APP
352
+ // powerpc64: vmr 0, 0
353
+ // powerpc64: #NO_APP
354
+ #[ cfg( altivec) ]
355
+ check_reg ! ( vreg_f32x4_v0, f32x4, "0" , "v0" , "vmr" ) ;
356
+
357
+ // powerpc_vsx-LABEL: vreg_f64x2_v0:
358
+ // powerpc_vsx: #APP
359
+ // powerpc_vsx: vmr 0, 0
360
+ // powerpc_vsx: #NO_APP
361
+ // powerpc64_vsx-LABEL: vreg_f64x2_v0:
362
+ // powerpc64_vsx: #APP
363
+ // powerpc64_vsx: vmr 0, 0
364
+ // powerpc64_vsx: #NO_APP
365
+ #[ cfg( vsx) ]
366
+ check_reg ! ( vreg_f64x2_v0, f64x2, "0" , "v0" , "vmr" ) ;
367
+
368
+ // powerpc_altivec-LABEL: vreg_i8x16_v18:
369
+ // powerpc_altivec: #APP
370
+ // powerpc_altivec: vmr 18, 18
371
+ // powerpc_altivec: #NO_APP
372
+ // powerpc64-LABEL: vreg_i8x16_v18:
373
+ // powerpc64: #APP
374
+ // powerpc64: vmr 18, 18
375
+ // powerpc64: #NO_APP
376
+ #[ cfg( altivec) ]
377
+ check_reg ! ( vreg_i8x16_v18, i8x16, "18" , "v18" , "vmr" ) ;
378
+
379
+ // powerpc_altivec-LABEL: vreg_i16x8_v18:
380
+ // powerpc_altivec: #APP
381
+ // powerpc_altivec: vmr 18, 18
382
+ // powerpc_altivec: #NO_APP
383
+ // powerpc64-LABEL: vreg_i16x8_v18:
384
+ // powerpc64: #APP
385
+ // powerpc64: vmr 18, 18
386
+ // powerpc64: #NO_APP
387
+ #[ cfg( altivec) ]
388
+ check_reg ! ( vreg_i16x8_v18, i16x8, "18" , "v18" , "vmr" ) ;
389
+
390
+ // powerpc_altivec-LABEL: vreg_i32x4_v18:
391
+ // powerpc_altivec: #APP
392
+ // powerpc_altivec: vmr 18, 18
393
+ // powerpc_altivec: #NO_APP
394
+ // powerpc64-LABEL: vreg_i32x4_v18:
395
+ // powerpc64: #APP
396
+ // powerpc64: vmr 18, 18
397
+ // powerpc64: #NO_APP
398
+ #[ cfg( altivec) ]
399
+ check_reg ! ( vreg_i32x4_v18, i32x4, "18" , "v18" , "vmr" ) ;
400
+
401
+ // powerpc_vsx-LABEL: vreg_i64x2_v18:
402
+ // powerpc_vsx: #APP
403
+ // powerpc_vsx: vmr 18, 18
404
+ // powerpc_vsx: #NO_APP
405
+ // powerpc64_vsx-LABEL: vreg_i64x2_v18:
406
+ // powerpc64_vsx: #APP
407
+ // powerpc64_vsx: vmr 18, 18
408
+ // powerpc64_vsx: #NO_APP
409
+ #[ cfg( vsx) ]
410
+ check_reg ! ( vreg_i64x2_v18, i64x2, "18" , "v18" , "vmr" ) ;
411
+
412
+ // powerpc_altivec-LABEL: vreg_f32x4_v18:
413
+ // powerpc_altivec: #APP
414
+ // powerpc_altivec: vmr 18, 18
415
+ // powerpc_altivec: #NO_APP
416
+ // powerpc64-LABEL: vreg_f32x4_v18:
417
+ // powerpc64: #APP
418
+ // powerpc64: vmr 18, 18
419
+ // powerpc64: #NO_APP
420
+ #[ cfg( altivec) ]
421
+ check_reg ! ( vreg_f32x4_v18, f32x4, "18" , "v18" , "vmr" ) ;
422
+
423
+ // powerpc_vsx-LABEL: vreg_f64x2_v18:
424
+ // powerpc_vsx: #APP
425
+ // powerpc_vsx: vmr 18, 18
426
+ // powerpc_vsx: #NO_APP
427
+ // powerpc64_vsx-LABEL: vreg_f64x2_v18:
428
+ // powerpc64_vsx: #APP
429
+ // powerpc64_vsx: vmr 18, 18
430
+ // powerpc64_vsx: #NO_APP
431
+ #[ cfg( vsx) ]
432
+ check_reg ! ( vreg_f64x2_v18, f64x2, "18" , "v18" , "vmr" ) ;
0 commit comments