|
| 1 | +//@ test-mir-pass: GVN |
| 2 | +//@ compile-flags: -Zdump-mir-exclude-alloc-bytes |
| 3 | +#![feature(repr_simd)] |
| 4 | + |
| 5 | +#[repr(simd)] |
| 6 | +struct F32x8([f32; 8]); |
| 7 | + |
| 8 | +// EMIT_MIR const_array_locals.main.GVN.diff |
| 9 | +// CHECK-LABEL: fn main( |
| 10 | +// CHECK: debug _arr => [[_arr:_[0-9]+]]; |
| 11 | +// CHECK: debug _duplicated_arr => [[_duplicated_arr:_[0-9]+]]; |
| 12 | +// CHECK: debug _foo => [[_foo:_[0-9]+]]; |
| 13 | +// CHECK: debug _darr => [[_darr:_[0-9]+]]; |
| 14 | +// CHECK: debug _f => [[_f:_[0-9]+]]; |
| 15 | +pub fn main() { |
| 16 | + // CHECK: [[_arr]] = const [255_i32, 105_i32, 15_i32, 39_i32, 62_i32]; |
| 17 | + let _arr = [255, 105, 15, 39, 62]; |
| 18 | + // CHECK: [[_duplicated_arr]] = const [255_i32, 105_i32, 15_i32, 39_i32, 62_i32]; |
| 19 | + let _duplicated_arr = [255, 105, 15, 39, 62]; |
| 20 | + // CHECK: [[subarray1:_[0-9]+]] = const [178_i32, 9_i32, 4_i32, 56_i32, 221_i32]; |
| 21 | + // CHECK: [[subarray2:_[0-9]+]] = const [193_i32, 164_i32, 194_i32, 197_i32, 6_i32]; |
| 22 | + // CHECK{LITERAL}: const [[178_i32, 9_i32, 4_i32, 56_i32, 221_i32], [193_i32, 164_i32, 194_i32, 197_i32, 6_i32]]; |
| 23 | + let _foo = [[178, 9, 4, 56, 221], [193, 164, 194, 197, 6]]; |
| 24 | + // CHECK: [[PROMOTED:_[0-9]+]] = const main::promoted[0]; |
| 25 | + // CHECK: [[_darr]] = const [254_i32, 42_i32, 15_i32, 39_i32, 62_i32]; |
| 26 | + let _darr = *&[254, 42, 15, 39, 62]; |
| 27 | + |
| 28 | + // CHECK: [[ARG:_[0-9]+]] = const [31_u32, 96_u32, 173_u32, 50_u32, 1_u32]; |
| 29 | + // CHECK: consume(const [31_u32, 96_u32, 173_u32, 50_u32, 1_u32]) |
| 30 | + consume([31, 96, 173, 50, 1]); |
| 31 | + |
| 32 | + // CHECK: [[OP:_[0-9]+]] = const [1f32, 2f32, 3f32, 1f32, 1f32, 1f32, 1f32, 42f32]; |
| 33 | + // CHECK: [[_f]] = F32x8(const [1f32, 2f32, 3f32, 1f32, 1f32, 1f32, 1f32, 42f32]); |
| 34 | + let _f = F32x8([1.0, 2.0, 3.0, 1.0, 1.0, 1.0, 1.0, 42.0]); |
| 35 | + |
| 36 | + // ice with small arrays |
| 37 | + // CHECK: [[A:_[0-9]+]] = const [1_i32, 0_i32, 0_i32]; |
| 38 | + // CHECK: [[B:_[0-9]+]] = const [0_i32, 1_i32, 0_i32]; |
| 39 | + // CHECK: [[C:_[0-9]+]] = const [0_i32, 0_i32, 1_i32]; |
| 40 | + // CHECK{LITERAL}: const [[1_i32, 0_i32, 0_i32], [0_i32, 1_i32, 0_i32], [0_i32, 0_i32, 1_i32]]; |
| 41 | + [[1, 0, 0], [0, 1, 0], [0, 0, 1]]; // 2D array |
| 42 | +} |
| 43 | + |
| 44 | +fn consume(_arr: [u32; 5]) { |
| 45 | + unimplemented!() |
| 46 | +} |
0 commit comments