Add missing runtime tests for SSE alias intrinsics#2041
Add missing runtime tests for SSE alias intrinsics#2041ArunTamil21 wants to merge 4 commits intorust-lang:mainfrom
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
Could you remove these lines too please
stdarch/crates/stdarch-verify/tests/x86-intel.rs
Lines 250 to 253 in 0e22a37
|
Also, personally, I think it is a bit weird (and error-prone) to fully repeat the tests for aliases, considering there are quite a few of them. I would prefer a macro-based approach, but take this as a completely personal opinion. |
|
@sayantn Done, removed the lines from x86-intel.rs. Regarding the macro-based approach, I agree it's cleaner. |
|
I would prefer it to be a single PR, as this PR just copying the tests anyway. If you prefer you can keep them as different commits |
|
@sayantn Thanks for the feedback. I'll refactor the tests using a macro-based approach. |
|
I don't think we use a macro like that exactly, but you can make a simple macro like macro_rules! foo_gen {
($($test_name:ident : $alias:ident),*) => {$(
#[simd_test(blah)]
fn $test_name() {
//<< the body, but with $alias as the function name >>
}
)*}
}
foo_gen(foo, foo_alias);or you can create a "meta function" like unsafe fn test_foo_gen(actual_fn: unsafe fn()) {
// << the body, but using `actual_fn` in place of that >>
}
#[simd_test(blah)]
fn test_foo() {
test_foo_gen(foo);
}
#[simd_test(blah)]
fn test_foo_alias() {
test_foo_gen(foo_alias);
}any of these work, or if you can think of a better approach that's even better |
…tt_ss2si, _mm_cvt_si2ss, _mm_set_ps1
…s for _mm_undefined_ps, _mm_prefetch, _mm_load_ps1, _mm_store_ps1
9ac3bde to
b397dac
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@sayantn |
|
Thanks, looks nice. But I don't think we need tests for prefetch and undefined, we already have instruction tests to ensure that they produce the correct assembly |
Already verified by assert_instr; no output to assert at runtime.
|
Thanks @sayantn for the clarification — removed both. Good to know assert_instr already covers correctness for intrinsics with no verifiable output. |
Add missing runtime tests for SSE alias intrinsics
While working through issue #798, I noticed several alias intrinsics had no
runtime tests even though their underlying functions were already tested.
This PR adds tests for:
Each test follows the same pattern as the existing tests for the underlying
functions, since these aliases just call them directly.
Part of #798.