Skip to content

Commit 67669ca

Browse files
authored
Merge pull request #1894 from madhav-madhusoodanan/intrinsic-test-x86-addition
`intrinsic-test`: Adding x86 behavioural testing.
2 parents 78fc6a7 + 28688b9 commit 67669ca

File tree

29 files changed

+2461
-161
lines changed

29 files changed

+2461
-161
lines changed

library/stdarch/.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ jobs:
260260
- aarch64_be-unknown-linux-gnu
261261
- armv7-unknown-linux-gnueabihf
262262
- arm-unknown-linux-gnueabihf
263+
- x86_64-unknown-linux-gnu
263264
profile: [dev, release]
264265
include:
265266
- target: aarch64_be-unknown-linux-gnu

library/stdarch/Cargo.lock

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,11 @@ dependencies = [
347347
"itertools",
348348
"log",
349349
"pretty_env_logger",
350+
"quick-xml 0.37.5",
350351
"rayon",
352+
"regex",
351353
"serde",
354+
"serde-xml-rs",
352355
"serde_json",
353356
]
354357

@@ -452,6 +455,16 @@ dependencies = [
452455
"serde",
453456
]
454457

458+
[[package]]
459+
name = "quick-xml"
460+
version = "0.37.5"
461+
source = "registry+https://github.com/rust-lang/crates.io-index"
462+
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
463+
dependencies = [
464+
"memchr",
465+
"serde",
466+
]
467+
455468
[[package]]
456469
name = "quickcheck"
457470
version = "1.0.3"
@@ -587,6 +600,18 @@ dependencies = [
587600
"serde_derive",
588601
]
589602

603+
[[package]]
604+
name = "serde-xml-rs"
605+
version = "0.8.1"
606+
source = "registry+https://github.com/rust-lang/crates.io-index"
607+
checksum = "53630160a98edebde0123eb4dfd0fce6adff091b2305db3154a9e920206eb510"
608+
dependencies = [
609+
"log",
610+
"serde",
611+
"thiserror",
612+
"xml-rs",
613+
]
614+
590615
[[package]]
591616
name = "serde_derive"
592617
version = "1.0.219"
@@ -698,7 +723,7 @@ name = "stdarch-verify"
698723
version = "0.1.0"
699724
dependencies = [
700725
"proc-macro2",
701-
"quick-xml",
726+
"quick-xml 0.33.0",
702727
"quote",
703728
"serde",
704729
"serde_json",
@@ -746,6 +771,26 @@ dependencies = [
746771
"winapi-util",
747772
]
748773

774+
[[package]]
775+
name = "thiserror"
776+
version = "1.0.69"
777+
source = "registry+https://github.com/rust-lang/crates.io-index"
778+
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
779+
dependencies = [
780+
"thiserror-impl",
781+
]
782+
783+
[[package]]
784+
name = "thiserror-impl"
785+
version = "1.0.69"
786+
source = "registry+https://github.com/rust-lang/crates.io-index"
787+
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
788+
dependencies = [
789+
"proc-macro2",
790+
"quote",
791+
"syn",
792+
]
793+
749794
[[package]]
750795
name = "unicode-ident"
751796
version = "1.0.18"
@@ -958,6 +1003,12 @@ version = "0.53.0"
9581003
source = "registry+https://github.com/rust-lang/crates.io-index"
9591004
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
9601005

1006+
[[package]]
1007+
name = "xml-rs"
1008+
version = "0.8.27"
1009+
source = "registry+https://github.com/rust-lang/crates.io-index"
1010+
checksum = "6fd8403733700263c6eb89f192880191f1b83e332f7a20371ddcf421c4a337c7"
1011+
9611012
[[package]]
9621013
name = "yaml-rust"
9631014
version = "0.4.5"

library/stdarch/ci/docker/x86_64-unknown-linux-gnu/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66
make \
77
ca-certificates \
88
wget \
9-
xz-utils
9+
xz-utils \
10+
clang \
11+
libstdc++-14-dev \
12+
build-essential \
13+
lld
1014

1115
RUN wget http://ci-mirrors.rust-lang.org/stdarch/sde-external-9.58.0-2025-06-16-lin.tar.xz -O sde.tar.xz
1216
RUN mkdir intel-sde

library/stdarch/ci/intrinsic-test.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ case ${TARGET} in
6666
TEST_CXX_COMPILER="clang++"
6767
TEST_RUNNER="${CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER}"
6868
;;
69+
70+
x86_64-unknown-linux-gnu*)
71+
TEST_CPPFLAGS="-fuse-ld=lld -I/usr/include/x86_64-linux-gnu/"
72+
TEST_CXX_COMPILER="clang++"
73+
TEST_RUNNER="${CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER}"
74+
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_x86.txt
75+
TEST_SAMPLE_INTRINSICS_PERCENTAGE=5
76+
;;
6977
*)
7078
;;
7179

@@ -94,6 +102,22 @@ case "${TARGET}" in
94102
--linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \
95103
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}"
96104
;;
105+
106+
x86_64-unknown-linux-gnu*)
107+
# `CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER` is not necessary for `intrinsic-test`
108+
# because the binary needs to run directly on the host.
109+
# Hence the use of `env -u`.
110+
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
111+
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" \
112+
RUST_LOG=warn RUST_BACKTRACE=1 \
113+
cargo run "${INTRINSIC_TEST}" "${PROFILE}" \
114+
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
115+
--runner "${TEST_RUNNER}" \
116+
--skip "${TEST_SKIP_INTRINSICS}" \
117+
--cppcompiler "${TEST_CXX_COMPILER}" \
118+
--target "${TARGET}" \
119+
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
120+
;;
97121
*)
98122
;;
99123
esac

library/stdarch/crates/intrinsic-test/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ pretty_env_logger = "0.5.0"
1919
rayon = "1.5.0"
2020
diff = "0.1.12"
2121
itertools = "0.14.0"
22+
quick-xml = { version = "0.37.5", features = ["serialize", "overlapped-lists"] }
23+
serde-xml-rs = "0.8.0"
24+
regex = "1.11.1"

0 commit comments

Comments
 (0)