Skip to content

Commit a64c160

Browse files
authored
Merge pull request #19 from eduardosm/test-stdarch
Test stdarch (only x86 SSE and SSE2 for now)
2 parents 8d65ad0 + ed6b098 commit a64c160

File tree

5 files changed

+87
-1
lines changed

5 files changed

+87
-1
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ jobs:
4747
- name: Test
4848
run: bash ./ci-test.sh simd
4949

50+
test-stdarch:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v3
54+
- name: Setup environment
55+
run: bash ./ci-setup.sh
56+
- name: Test
57+
run: bash ./ci-test.sh stdarch
58+
5059
# Send a Zulip notification when a cron job fails
5160
cron-fail-notify:
5261
name: cronjob failure notification

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ members = [
88
exclude = [
99
# stdarch has its own Cargo workspace
1010
"library/stdarch",
11+
"rust-src-patched/library/stdarch",
1112
]

ci-test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ simd)
104104
2>&1 | ts -i '%.s '
105105
echo "::endgroup::"
106106
;;
107+
stdarch)
108+
for TARGET in x86_64-unknown-linux-gnu i686-unknown-linux-gnu; do
109+
echo "::group::Testing stdarch ($TARGET)"
110+
MIRIFLAGS="$DEFAULTFLAGS" \
111+
./run-stdarch-test.sh $TARGET \
112+
2>&1 | ts -i '%.s '
113+
echo "::endgroup::"
114+
done
115+
;;
107116
*)
108117
echo "Unknown command"
109118
exit 1

run-stdarch-test.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
## Run stdarch test suite with Miri.
5+
## Assumes Miri to be installed.
6+
## Usage:
7+
## ./run-test.sh TARGET
8+
## Environment variables:
9+
## MIRI_LIB_SRC: The path to the Rust library directory (`library`).
10+
## RUSTFLAGS: rustc flags (optional)
11+
## MIRIFLAGS: Miri flags (optional)
12+
13+
if [ $# -ne 1 ]; then
14+
echo "Usage: $0 TARGET"
15+
exit 1
16+
fi
17+
18+
export TARGET="$1"
19+
20+
case "$TARGET" in
21+
i586-*|i686-*|x86_64-*)
22+
RUSTFLAGS="-C target-feature=+sse2"
23+
TEST_ARGS=(
24+
core_arch::x86::{sse,sse2}::
25+
core_arch::x86_64::{sse,sse2}::
26+
# FIXME add `#[cfg_attr(miri, ignore)]` to those tests in stdarch
27+
# These are nontemporal stores, fences, and CSR (FP env status register) accesses
28+
--skip test_mm_comieq_ss_vs_ucomieq_ss
29+
--skip test_mm_getcsr_setcsr_1
30+
--skip test_mm_getcsr_setcsr_2
31+
--skip test_mm_getcsr_setcsr_underflow
32+
--skip test_mm_sfence
33+
--skip test_mm_stream_ps
34+
--skip test_mm_clflush
35+
--skip test_mm_lfence
36+
--skip test_mm_maskmoveu_si128
37+
--skip test_mm_mfence
38+
--skip test_mm_stream_pd
39+
--skip test_mm_stream_si128
40+
--skip test_mm_stream_si32
41+
--skip test_mm_stream_si64
42+
# FIXME not yet implemented
43+
--skip test_mm_madd_epi16
44+
# FIXME fix those in stdarch
45+
--skip test_mm_rcp_ss # __m128(0.24997461, 13.0, 16.0, 100.0) != __m128(0.24993896, 13.0, 16.0, 100.0)
46+
--skip test_mm_store1_ps # attempt to subtract with overflow
47+
--skip test_mm_store_ps # attempt to subtract with overflow
48+
--skip test_mm_storer_ps # attempt to subtract with overflow
49+
)
50+
;;
51+
*)
52+
echo "Unknown target $TARGET"
53+
exit 1
54+
esac
55+
56+
export RUSTFLAGS="${RUSTFLAGS:-} -Ainternal_features"
57+
58+
# Make sure all tested target features are enabled
59+
export STDARCH_TEST_EVERYTHING=1
60+
# Needed to pass the STDARCH_TEST_EVERYTHING environment variable
61+
export MIRIFLAGS="${MIRIFLAGS:-} -Zmiri-disable-isolation"
62+
63+
cd $MIRI_LIB_SRC/stdarch
64+
cargo miri test \
65+
--target "$TARGET" \
66+
--manifest-path=crates/core_arch/Cargo.toml \
67+
-- "${TEST_ARGS[@]}"

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2023-08-16
1+
nightly-2023-09-28

0 commit comments

Comments
 (0)