File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -O
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+ // CHECK-LABEL: define{{.*}}void @convert(
10+ // CHECK-NOT: shufflevector
11+ // CHECK: insertelement <8 x i16>
12+ // CHECK-NEXT: insertelement <8 x i16>
13+ // CHECK-NEXT: insertelement <8 x i16>
14+ // CHECK-NEXT: insertelement <8 x i16>
15+ // CHECK-NEXT: insertelement <8 x i16>
16+ // CHECK-NEXT: insertelement <8 x i16>
17+ // CHECK-NEXT: insertelement <8 x i16>
18+ // CHECK-NEXT: insertelement <8 x i16>
19+ // CHECK-NEXT: store <8 x i16>
20+ // CHECK-NEXT: ret void
21+ #[ no_mangle]
22+ pub fn convert ( value : [ u16 ; 8 ] ) -> [ u8 ; 16 ] {
23+ let addr16 = [
24+ value[ 0 ] . to_be ( ) ,
25+ value[ 1 ] . to_be ( ) ,
26+ value[ 2 ] . to_be ( ) ,
27+ value[ 3 ] . to_be ( ) ,
28+ value[ 4 ] . to_be ( ) ,
29+ value[ 5 ] . to_be ( ) ,
30+ value[ 6 ] . to_be ( ) ,
31+ value[ 7 ] . to_be ( ) ,
32+ ] ;
33+ unsafe { core:: mem:: transmute :: < _ , [ u8 ; 16 ] > ( addr16) }
34+ }
You can’t perform that action at this time.
0 commit comments