File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change
1
+ //@ compile-flags: -Copt-level=2
2
+
3
+ #![ crate_type = "lib" ]
4
+ #![ no_std]
5
+
6
+ // The code is from https://github.com/rust-lang/rust/issues/122805.
7
+ // Ensure we do not generate the shufflevector instruction
8
+ // to avoid complicating the code.
9
+
10
+ // CHECK-LABEL: define{{.*}}void @convert(
11
+ // CHECK-NOT: shufflevector
12
+ #[ no_mangle]
13
+ pub fn convert ( value : [ u16 ; 8 ] ) -> [ u8 ; 16 ] {
14
+ #[ cfg( target_endian = "little" ) ]
15
+ let bswap = u16:: to_be;
16
+ #[ cfg( target_endian = "big" ) ]
17
+ let bswap = u16:: to_le;
18
+ let addr16 = [
19
+ bswap ( value[ 0 ] ) ,
20
+ bswap ( value[ 1 ] ) ,
21
+ bswap ( value[ 2 ] ) ,
22
+ bswap ( value[ 3 ] ) ,
23
+ bswap ( value[ 4 ] ) ,
24
+ bswap ( value[ 5 ] ) ,
25
+ bswap ( value[ 6 ] ) ,
26
+ bswap ( value[ 7 ] ) ,
27
+ ] ;
28
+ unsafe { core:: mem:: transmute :: < _ , [ u8 ; 16 ] > ( addr16) }
29
+ }
Original file line number Diff line number Diff line change 1
- //@ revisions: OPT2 OPT3 OPT3_S390X
2
- //@[OPT2] compile-flags: -Copt-level=2
1
+ //@ revisions: OPT3 OPT3_S390X
3
2
//@[OPT3] compile-flags: -C opt-level=3
4
3
// some targets don't do the opt we are looking for
5
4
//@[OPT3] only-64bit
You can’t perform that action at this time.
0 commit comments