-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #105583 - luqmana:bitcast-immediates, r=oli-obk
Operand::extract_field: only cast llval if it's a pointer and replace bitcast w/ pointercast. Fixes #105439. Also cc `@erikdesjardins,` looks like another place to cleanup as part of #105545
- Loading branch information
Showing
2 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
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
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,25 @@ | ||
// run-pass | ||
// compile-flags: -O -Zverify-llvm-ir | ||
|
||
#![feature(repr_simd)] | ||
#![feature(platform_intrinsics)] | ||
|
||
#[allow(non_camel_case_types)] | ||
#[derive(Clone, Copy)] | ||
#[repr(simd)] | ||
struct i32x4([i32; 4]); | ||
|
||
extern "platform-intrinsic" { | ||
pub(crate) fn simd_add<T>(x: T, y: T) -> T; | ||
} | ||
|
||
#[inline(always)] | ||
fn to_array(a: i32x4) -> [i32; 4] { | ||
a.0 | ||
} | ||
|
||
fn main() { | ||
let a = i32x4([1, 2, 3, 4]); | ||
let b = unsafe { simd_add(a, a) }; | ||
assert_eq!(to_array(b), [2, 4, 6, 8]); | ||
} |