forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#123555 - DianQK:update-llvm-18, r=cuviper
Update to LLVM 18.1.3 Fixes rust-lang#122805. This should work on all targets: https://rust.godbolt.org/z/svW8ha31z. r? `@cuviper`
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
Submodule llvm-project
updated
52 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) } | ||
} |