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#3055 - eduardosm:x86-sse2-intrinsics, r=RalfJung
Implement some `llvm.x86.sse2.*` intrinsics and add tests Continuation of rust-lang/miri#2989 with SSE2 intrinsics. Thankfully, a significant amount of SSE2 functions use `simd_*` intrinsics, which are already implemented in Miri.
- Loading branch information
Showing
6 changed files
with
1,894 additions
and
57 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 |
---|---|---|
@@ -1 +1,45 @@ | ||
use crate::InterpResult; | ||
|
||
pub(super) mod sse; | ||
pub(super) mod sse2; | ||
|
||
/// Floating point comparison operation | ||
/// | ||
/// <https://www.felixcloutier.com/x86/cmpss> | ||
/// <https://www.felixcloutier.com/x86/cmpps> | ||
/// <https://www.felixcloutier.com/x86/cmpsd> | ||
/// <https://www.felixcloutier.com/x86/cmppd> | ||
#[derive(Copy, Clone)] | ||
enum FloatCmpOp { | ||
Eq, | ||
Lt, | ||
Le, | ||
Unord, | ||
Neq, | ||
/// Not less-than | ||
Nlt, | ||
/// Not less-or-equal | ||
Nle, | ||
/// Ordered, i.e. neither of them is NaN | ||
Ord, | ||
} | ||
|
||
impl FloatCmpOp { | ||
/// Convert from the `imm` argument used to specify the comparison | ||
/// operation in intrinsics such as `llvm.x86.sse.cmp.ss`. | ||
fn from_intrinsic_imm(imm: i8, intrinsic: &str) -> InterpResult<'_, Self> { | ||
match imm { | ||
0 => Ok(Self::Eq), | ||
1 => Ok(Self::Lt), | ||
2 => Ok(Self::Le), | ||
3 => Ok(Self::Unord), | ||
4 => Ok(Self::Neq), | ||
5 => Ok(Self::Nlt), | ||
6 => Ok(Self::Nle), | ||
7 => Ok(Self::Ord), | ||
imm => { | ||
throw_unsup_format!("invalid `imm` parameter of {intrinsic}: {imm}"); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.