@@ -5,127 +5,66 @@ set -ex
55: " ${TARGET?The TARGET environment variable must be set.} "
66
77export RUSTFLAGS=" ${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
8- export HOST_RUSTFLAGS=" ${RUSTFLAGS} "
98export 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-
3910echo " RUSTFLAGS=${RUSTFLAGS} "
40- echo " OBJDUMP=${OBJDUMP} "
4111echo " PROFILE=${PROFILE} "
4212
4313INTRINSIC_TEST=" --manifest-path=crates/intrinsic-test/Cargo.toml"
4414
45- # Test targets compiled with extra features.
15+ export CC=" clang"
16+
4617case ${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/include/"
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
8340esac
8441
85- # Arm specific
8642case " ${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} " \
43+ x86_64-unknown-linux-gnu* )
44+ env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
45+ cargo run " ${INTRINSIC_TEST} " --release \
46+ --bin intrinsic-test -- intrinsics_data/x86-intel.xml \
9347 --skip " ${TEST_SKIP_INTRINSICS} " \
94- --target " ${TARGET} " \
95- --profile " ${PROFILE} " \
96- --sample-percentage " ${TEST_SAMPLE_INTRINSICS_PERCENTAGE} "
97- ;;
48+ --target " ${TARGET} "
9849
99- aarch64_be-unknown-linux-gnu* )
100- CPPFLAGS=" ${TEST_CPPFLAGS} " RUSTFLAGS=" ${HOST_RUSTFLAGS} " RUST_LOG=warn \
101- cargo run " ${INTRINSIC_TEST} " --release \
50+ echo " ${CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER} "
51+ ;;
52+ * )
53+ cargo run " ${INTRINSIC_TEST} " --release \
10254 --bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
103- --runner " ${TEST_RUNNER} " \
104- --cppcompiler " ${TEST_CXX_COMPILER} " \
10555 --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} "
56+ --target " ${TARGET} "
11157 ;;
58+ esac
11259
113- 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`.
117- env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
118- CPPFLAGS=" ${TEST_CPPFLAGS} " RUSTFLAGS=" ${HOST_RUSTFLAGS} " \
119- RUST_LOG=warn RUST_BACKTRACE=1 \
120- cargo run " ${INTRINSIC_TEST} " --release \
121- --bin intrinsic-test -- intrinsics_data/x86-intel.xml \
122- --runner " ${TEST_RUNNER} " \
123- --skip " ${TEST_SKIP_INTRINSICS} " \
124- --cppcompiler " ${TEST_CXX_COMPILER} " \
125- --target " ${TARGET} " \
126- --profile " ${PROFILE} " \
127- --sample-percentage " ${TEST_SAMPLE_INTRINSICS_PERCENTAGE} "
60+ case ${TARGET} in
61+ # FIXME: currently this needs enabling because the test functions don't have any `target_feature`attribute
62+ x86_64-* )
63+ export RUSTFLAGS=" ${RUSTFLAGS} -Ctarget-feature=+avx512f"
12864 ;;
129- * )
65+ armv7-* | aarch64* )
66+ export RUSTFLAGS=" ${RUSTFLAGS} -Ctarget-feature=+neon"
13067 ;;
13168esac
69+
70+ cargo test --manifest-path=rust_programs/Cargo.toml --target " ${TARGET} " --profile " ${PROFILE} "
0 commit comments