forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#135408 - RalfJung:x86-sse2, r=workingjubilee
x86: use SSE2 to pass float and SIMD types This builds on the new X86Sse2 ABI landed in rust-lang#137037 to actually make it a separate ABI from the default x86 ABI, and use SSE2 registers. Specifically, we use it in two ways: to return `f64` values in a register rather than by-ptr, and to pass vectors of size up to 128bit in a register (or, well, whatever LLVM does when passing `<4 x float>` by-val, I don't actually know if this ends up in a register). Cc `@workingjubilee` Fixes rust-lang#133611 try-job: aarch64-apple try-job: aarch64-gnu try-job: aarch64-gnu-debug try-job: test-various try-job: x86_64-gnu-nopt try-job: dist-i586-gnu-i586-i686-musl try-job: x86_64-msvc-1
- Loading branch information
Showing
14 changed files
with
273 additions
and
151 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
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
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,36 @@ | ||
//@ compile-flags: -Z merge-functions=disabled | ||
|
||
//@ revisions: x86-64 | ||
//@[x86-64] compile-flags: --target x86_64-unknown-linux-gnu | ||
//@[x86-64] needs-llvm-components: x86 | ||
|
||
//@ revisions: x86-32 | ||
//@[x86-32] compile-flags: --target i686-unknown-linux-gnu | ||
//@[x86-32] needs-llvm-components: x86 | ||
|
||
//@ revisions: x86-32-nosse | ||
//@[x86-32-nosse] compile-flags: --target i586-unknown-linux-gnu | ||
//@[x86-32-nosse] needs-llvm-components: x86 | ||
|
||
#![feature(no_core, lang_items, rustc_attrs, repr_simd)] | ||
#![no_core] | ||
#![crate_type = "lib"] | ||
|
||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
#[lang = "copy"] | ||
trait Copy {} | ||
|
||
// Ensure this type is passed without ptr indirection on targets that | ||
// require SSE2. | ||
#[repr(simd)] | ||
pub struct Sse([f32; 4]); | ||
|
||
// x86-64: <4 x float> @sse_id(<4 x float> {{[^,]*}}) | ||
// x86-32: <4 x float> @sse_id(<4 x float> {{[^,]*}}) | ||
// x86-32-nosse: void @sse_id(ptr{{( [^,]*)?}} sret([16 x i8]){{( .*)?}}, ptr{{( [^,]*)?}}) | ||
#[no_mangle] | ||
pub fn sse_id(x: Sse) -> Sse { | ||
x | ||
} |
Oops, something went wrong.