Add the test case for #122805
This commit is contained in:
parent
87519b258c
commit
5acfe772fa
35
tests/codegen/issues/issue-122805.rs
Normal file
35
tests/codegen/issues/issue-122805.rs
Normal file
@ -0,0 +1,35 @@
|
||||
//@ compile-flags: -O
|
||||
//@ min-llvm-version: 18.1.3
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![no_std]
|
||||
|
||||
// The code is from https://github.com/rust-lang/rust/issues/122805.
|
||||
// Ensure we do not generate the shufflevector instruction
|
||||
// to avoid complicating the code.
|
||||
// CHECK-LABEL: define{{.*}}void @convert(
|
||||
// CHECK-NOT: shufflevector
|
||||
// CHECK: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: insertelement <8 x i16>
|
||||
// CHECK-NEXT: store <8 x i16>
|
||||
// CHECK-NEXT: ret void
|
||||
#[no_mangle]
|
||||
pub fn convert(value: [u16; 8]) -> [u8; 16] {
|
||||
let addr16 = [
|
||||
value[0].to_be(),
|
||||
value[1].to_be(),
|
||||
value[2].to_be(),
|
||||
value[3].to_be(),
|
||||
value[4].to_be(),
|
||||
value[5].to_be(),
|
||||
value[6].to_be(),
|
||||
value[7].to_be(),
|
||||
];
|
||||
unsafe { core::mem::transmute::<_, [u8; 16]>(addr16) }
|
||||
}
|
Loading…
Reference in New Issue
Block a user