Skip to content

Commit bb24cbd

Browse files
authored
Merge pull request #2063 from sayantn/intrinsic-test
Redesign `intrinsic-test` to use simple comparison
2 parents 353d276 + c2845dc commit bb24cbd

33 files changed

Lines changed: 40091 additions & 33276 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ jobs:
279279
- aarch64-unknown-linux-gnu
280280
- aarch64_be-unknown-linux-gnu
281281
- armv7-unknown-linux-gnueabihf
282-
- arm-unknown-linux-gnueabihf
283282
- x86_64-unknown-linux-gnu
284283
profile: [dev, release]
285284
include:

ci/docker/aarch64-unknown-linux-gnu/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
FROM ubuntu:25.10
22
RUN apt-get update && apt-get install -y --no-install-recommends \
33
gcc \
4-
g++ \
54
ca-certificates \
65
libc6-dev \
76
gcc-aarch64-linux-gnu \
8-
g++-aarch64-linux-gnu \
97
libc6-dev-arm64-cross \
108
qemu-user \
119
make \

ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ FROM ubuntu:25.10
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc \
5-
g++ \
65
ca-certificates \
76
libc6-dev \
87
libc6-dev-arm64-cross \

ci/docker/arm-unknown-linux-gnueabihf/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
77
libc6-dev-armhf-cross \
88
qemu-user \
99
make \
10-
file
10+
file \
11+
clang \
12+
lld
1113
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
1214
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -cpu max -L /usr/arm-linux-gnueabihf" \
1315
OBJDUMP=arm-linux-gnueabihf-objdump

ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
FROM ubuntu:24.04
22
RUN apt-get update && apt-get install -y --no-install-recommends \
33
gcc \
4-
g++ \
54
ca-certificates \
65
libc6-dev \
76
gcc-arm-linux-gnueabihf \
8-
g++-arm-linux-gnueabihf \
97
libc6-dev-armhf-cross \
108
qemu-user \
119
make \

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

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

1511
RUN wget http://ci-mirrors.rust-lang.org/sde-external-10.8.0-2026-03-15-lin.tar.xz -O sde.tar.xz
1612
RUN mkdir intel-sde

ci/intrinsic-test-docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ run() {
4848
--workdir /checkout \
4949
--privileged \
5050
stdarch \
51-
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/intrinsic-test.sh ${1}"
51+
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/intrinsic-test.sh"
5252
}
5353

5454
if [ -z "$1" ]; then

ci/intrinsic-test.sh

Lines changed: 22 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -5,127 +5,56 @@ set -ex
55
: "${TARGET?The TARGET environment variable must be set.}"
66

77
export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
8-
export HOST_RUSTFLAGS="${RUSTFLAGS}"
98
export PROFILE="${PROFILE:="release"}"
109

11-
case ${TARGET} in
12-
# On 32-bit use a static relocation model which avoids some extra
13-
# instructions when dealing with static data, notably allowing some
14-
# instruction assertion checks to pass below the 20 instruction limit. If
15-
# this is the default, dynamic, then too many instructions are generated
16-
# when we assert the instruction for a function and it causes tests to fail.
17-
i686-* | i586-*)
18-
export RUSTFLAGS="${RUSTFLAGS} -C relocation-model=static"
19-
;;
20-
# Some x86_64 targets enable by default more features beyond SSE2,
21-
# which cause some instruction assertion checks to fail.
22-
x86_64-*)
23-
export RUSTFLAGS="${RUSTFLAGS} -C target-feature=-sse3"
24-
;;
25-
#Unoptimized build uses fast-isel which breaks with msa
26-
mips-* | mipsel-*)
27-
export RUSTFLAGS="${RUSTFLAGS} -C llvm-args=-fast-isel=false"
28-
;;
29-
armv7-*eabihf | thumbv7-*eabihf)
30-
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+neon"
31-
;;
32-
# Some of our test dependencies use the deprecated `gcc` crates which
33-
# doesn't detect RISC-V compilers automatically, so do it manually here.
34-
riscv*)
35-
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+zk,+zks,+zbb,+zbc"
36-
;;
37-
esac
38-
3910
echo "RUSTFLAGS=${RUSTFLAGS}"
40-
echo "OBJDUMP=${OBJDUMP}"
4111
echo "PROFILE=${PROFILE}"
4212

4313
INTRINSIC_TEST="--manifest-path=crates/intrinsic-test/Cargo.toml"
4414

45-
# Test targets compiled with extra features.
15+
export CC="clang"
16+
4617
case ${TARGET} in
47-
# Setup aarch64 & armv7 specific variables, the runner, along with some
48-
# tests to skip
49-
aarch64-unknown-linux-gnu*)
50-
TEST_CPPFLAGS="-fuse-ld=lld -I/usr/aarch64-linux-gnu/include/ -I/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu/"
51-
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt
52-
TEST_CXX_COMPILER="clang++"
53-
TEST_RUNNER="${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER}"
54-
: "${TEST_SAMPLE_INTRINSICS_PERCENTAGE:=100}"
18+
aarch64_be*)
19+
export CFLAGS="-I${AARCH64_BE_TOOLCHAIN}/aarch64_be-none-linux-gnu/libc/usr/include --sysroot={AARCH64_BE_TOOLCHAIN}/aarch64_be-none-linux-gnu/libc -Wno-nonportable-vector-initialization"
20+
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64_be.txt
5521
;;
5622

57-
aarch64_be-unknown-linux-gnu*)
58-
TEST_CPPFLAGS="-fuse-ld=lld"
59-
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64_be.txt
60-
TEST_CXX_COMPILER="clang++"
61-
TEST_RUNNER="${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_RUNNER}"
62-
: "${TEST_SAMPLE_INTRINSICS_PERCENTAGE:=100}"
23+
aarch64*)
24+
export CFLAGS="-I/usr/aarch64-linux-gnu/include/"
25+
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt
6326
;;
6427

65-
armv7-unknown-linux-gnueabihf*)
66-
TEST_CPPFLAGS="-fuse-ld=lld -I/usr/arm-linux-gnueabihf/include/ -I/usr/arm-linux-gnueabihf/include/c++/9/arm-linux-gnueabihf/"
28+
armv7*)
29+
export CFLAGS="-I/usr/arm-linux-gnueabihf/include/"
6730
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_arm.txt
68-
TEST_CXX_COMPILER="clang++"
69-
TEST_RUNNER="${CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER}"
70-
: "${TEST_SAMPLE_INTRINSICS_PERCENTAGE:=100}"
7131
;;
7232

73-
x86_64-unknown-linux-gnu*)
74-
TEST_CPPFLAGS="-fuse-ld=lld -I/usr/include/x86_64-linux-gnu/"
75-
TEST_CXX_COMPILER="clang++"
76-
TEST_RUNNER="${CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER}"
33+
x86_64*)
34+
export CFLAGS="-I/usr/include/x86_64-linux-gnu/"
7735
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_x86.txt
78-
: "${TEST_SAMPLE_INTRINSICS_PERCENTAGE:=20}"
7936
;;
8037
*)
8138
;;
8239

8340
esac
8441

85-
# Arm specific
8642
case "${TARGET}" in
87-
aarch64-unknown-linux-gnu*|armv7-unknown-linux-gnueabihf*)
88-
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
89-
cargo run "${INTRINSIC_TEST}" --release \
90-
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
91-
--runner "${TEST_RUNNER}" \
92-
--cppcompiler "${TEST_CXX_COMPILER}" \
93-
--skip "${TEST_SKIP_INTRINSICS}" \
94-
--target "${TARGET}" \
95-
--profile "${PROFILE}" \
96-
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
97-
;;
98-
99-
aarch64_be-unknown-linux-gnu*)
100-
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" RUST_LOG=warn \
101-
cargo run "${INTRINSIC_TEST}" --release \
102-
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
103-
--runner "${TEST_RUNNER}" \
104-
--cppcompiler "${TEST_CXX_COMPILER}" \
105-
--skip "${TEST_SKIP_INTRINSICS}" \
106-
--target "${TARGET}" \
107-
--profile "${PROFILE}" \
108-
--linker "${CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER}" \
109-
--cxx-toolchain-dir "${AARCH64_BE_TOOLCHAIN}" \
110-
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
111-
;;
112-
11343
x86_64-unknown-linux-gnu*)
114-
# `CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER` is not necessary for `intrinsic-test`
115-
# because the binary needs to run directly on the host.
116-
# Hence the use of `env -u`.
11744
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
118-
CPPFLAGS="${TEST_CPPFLAGS}" RUSTFLAGS="${HOST_RUSTFLAGS}" \
119-
RUST_LOG=warn RUST_BACKTRACE=1 \
12045
cargo run "${INTRINSIC_TEST}" --release \
12146
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
122-
--runner "${TEST_RUNNER}" \
12347
--skip "${TEST_SKIP_INTRINSICS}" \
124-
--cppcompiler "${TEST_CXX_COMPILER}" \
125-
--target "${TARGET}" \
126-
--profile "${PROFILE}" \
127-
--sample-percentage "${TEST_SAMPLE_INTRINSICS_PERCENTAGE}"
48+
--target "${TARGET}"
49+
50+
echo "${CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER}"
12851
;;
129-
*)
52+
*)
53+
cargo run "${INTRINSIC_TEST}" --release \
54+
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
55+
--skip "${TEST_SKIP_INTRINSICS}" \
56+
--target "${TARGET}"
13057
;;
13158
esac
59+
60+
cargo test --manifest-path=rust_programs/Cargo.toml --target "${TARGET}" --profile "${PROFILE}"

0 commit comments

Comments
 (0)