Skip to content

Commit

Permalink
Test stdarch (only x86 SSE and SSE2 for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed Sep 28, 2023
1 parent 8d65ad0 commit ff48859
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ jobs:
- name: Test
run: bash ./ci-test.sh simd

test-stdarch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup environment
run: bash ./ci-setup.sh
- name: Test
run: bash ./ci-test.sh stdarch

# Send a Zulip notification when a cron job fails
cron-fail-notify:
name: cronjob failure notification
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ members = [
exclude = [
# stdarch has its own Cargo workspace
"library/stdarch",
"rust-src-patched/library/stdarch",
]
9 changes: 9 additions & 0 deletions ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ simd)
2>&1 | ts -i '%.s '
echo "::endgroup::"
;;
stdarch)
for TARGET in x86_64-unknown-linux-gnu i686-unknown-linux-gnu; do
echo "::group::Testing stdarch ($TARGET)"
MIRIFLAGS="$DEFAULTFLAGS" \
./run-stdarch-test.sh $TARGET \
2>&1 | ts -i '%.s '
echo "::endgroup::"
done
;;
*)
echo "Unknown command"
exit 1
Expand Down
62 changes: 62 additions & 0 deletions run-stdarch-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
set -euo pipefail

## Run stdarch test suite with Miri.
## Assumes Miri to be installed.
## Usage:
## ./run-test.sh TARGET
## Environment variables:
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
## RUSTFLAGS: rustc flags (optional)
## MIRIFLAGS: Miri flags (optional)

if [ $# -ne 1 ]; then
echo "Usage: $0 TARGET"
exit 1
fi

export TARGET="$1"

case "$TARGET" in
i586-*|i686-*|x86_64-*)
RUSTFLAGS="-C target-feature=+sse2"
TEST_ARGS=(
core_arch::x86::{sse,sse2}::
core_arch::x86_64::{sse,sse2}::
# FIXME add `#[cfg_attr(miri, ignore)]` to those tests in stdarch
--skip test_mm_comieq_ss_vs_ucomieq_ss
--skip test_mm_getcsr_setcsr_1
--skip test_mm_getcsr_setcsr_2
--skip test_mm_getcsr_setcsr_underflow
--skip test_mm_sfence
--skip test_mm_stream_ps
--skip test_mm_clflush
--skip test_mm_lfence
--skip test_mm_madd_epi16 # FIXME not yet implemented
--skip test_mm_maskmoveu_si128
--skip test_mm_mfence
--skip test_mm_stream_pd
--skip test_mm_stream_si128
--skip test_mm_stream_si32
--skip test_mm_stream_si64
# FIXME fix those in stdarch
--skip test_mm_rcp_ss # __m128(0.24997461, 13.0, 16.0, 100.0) != __m128(0.24993896, 13.0, 16.0, 100.0)
--skip test_mm_store1_ps # attempt to subtract with overflow
--skip test_mm_store_ps # attempt to subtract with overflow
--skip test_mm_storer_ps # attempt to subtract with overflow
)
;;
*)
echo "Unknown target $TARGET"
exit 1
esac

export RUSTFLAGS="${RUSTFLAGS:-} -Ainternal_features"

# Make sure all tested target features are enabled
export STDARCH_TEST_EVERYTHING=1
# Needed to pass the STDARCH_TEST_EVERYTHING environment variable
export MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-disable-isolation"

cd $MIRI_LIB_SRC/stdarch
cargo miri test --manifest-path=crates/core_arch/Cargo.toml -- "${TEST_ARGS[@]}"
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-08-16
nightly-2023-09-28

0 comments on commit ff48859

Please sign in to comment.