File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -O
2+ //@ min-llvm-version: 18.1.3
3+
4+ #![ crate_type = "lib" ]
5+ #![ no_std]
6+
7+ // The code is from https://github.com/rust-lang/rust/issues/122805.
8+ // Ensure we do not generate the shufflevector instruction
9+ // to avoid complicating the code.
10+ // CHECK-LABEL: define{{.*}}void @convert(
11+ // CHECK-NOT: shufflevector
12+ // CHECK: 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: insertelement <8 x i16>
20+ // CHECK-NEXT: store <8 x i16>
21+ // CHECK-NEXT: ret void
22+ #[ no_mangle]
23+ pub fn convert ( value : [ u16 ; 8 ] ) -> [ u8 ; 16 ] {
24+ let addr16 = [
25+ value[ 0 ] . to_be ( ) ,
26+ value[ 1 ] . to_be ( ) ,
27+ value[ 2 ] . to_be ( ) ,
28+ value[ 3 ] . to_be ( ) ,
29+ value[ 4 ] . to_be ( ) ,
30+ value[ 5 ] . to_be ( ) ,
31+ value[ 6 ] . to_be ( ) ,
32+ value[ 7 ] . to_be ( ) ,
33+ ] ;
34+ unsafe { core:: mem:: transmute :: < _ , [ u8 ; 16 ] > ( addr16) }
35+ }
You can’t perform that action at this time.
0 commit comments