Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,19 @@ jobs:
- armv7-unknown-linux-gnueabihf
- x86_64-unknown-linux-gnu
profile: [dev, release]
cc: [clang, gcc]
include:
- target: aarch64_be-unknown-linux-gnu
build_std: true

- target: x86_64-unknown-linux-gnu
cc: icx
profile: dev
- target: x86_64-unknown-linux-gnu
cc: icx
profile: release
exclude:
- target: armv7-unknown-linux-gnueabihf
cc: gcc
steps:
- uses: actions/checkout@v6
- name: Install Rust
Expand All @@ -301,7 +310,7 @@ jobs:

# Configure some env vars based on matrix configuration
- run: echo "PROFILE=${{ matrix.profile }}" >> $GITHUB_ENV
- run: ./ci/intrinsic-test-docker.sh ${{ matrix.target }}
- run: ./ci/intrinsic-test-docker.sh ${{ matrix.target }} ${{ matrix.cc }}
if: ${{ !startsWith(matrix.target, 'thumb') }}
env:
TARGET: ${{ matrix.target }}
Expand Down
3 changes: 2 additions & 1 deletion ci/docker/aarch64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ RUN wget https://mirrors.edge.kernel.org/pub/tools/llvm/files/llvm-22.1.4-x86_64
RUN mkdir llvm
RUN tar -xvf llvm.tar.xz --strip-components=1 -C llvm

ENV PATH="/llvm/bin:$PATH"
ENV CLANG_PATH="/llvm/bin/clang"
ENV GCC_PATH=aarch64-linux-gnu-gcc

ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -cpu max -L /usr/aarch64-linux-gnu" \
Expand Down
5 changes: 3 additions & 2 deletions ci/docker/aarch64_be-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ RUN wget https://mirrors.edge.kernel.org/pub/tools/llvm/files/llvm-22.1.4-x86_64
RUN mkdir llvm
RUN tar -xvf llvm.tar.xz --strip-components=1 -C llvm

ENV PATH="/llvm/bin:$PATH"

ENV AARCH64_BE_TOOLCHAIN="/toolchains/${TOOLCHAIN}"
ENV AARCH64_BE_LIBC="${AARCH64_BE_TOOLCHAIN}/aarch64_be-none-linux-gnu/libc"

ENV CLANG_PATH="/llvm/bin/clang"
ENV GCC_PATH="${AARCH64_BE_TOOLCHAIN}/bin/aarch64_be-none-linux-gnu-gcc"

ENV CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_LINKER="${AARCH64_BE_TOOLCHAIN}/bin/aarch64_be-none-linux-gnu-gcc"
ENV CARGO_TARGET_AARCH64_BE_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64_be -cpu max -L ${AARCH64_BE_LIBC}"
ENV OBJDUMP="${AARCH64_BE_TOOLCHAIN}/bin/aarch64_be-none-linux-gnu-objdump"
3 changes: 2 additions & 1 deletion ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ RUN wget https://mirrors.edge.kernel.org/pub/tools/llvm/files/llvm-22.1.4-x86_64
RUN mkdir llvm
RUN tar -xvf llvm.tar.xz --strip-components=1 -C llvm

ENV PATH="/llvm/bin:$PATH"
ENV CLANG_PATH="/llvm/bin/clang"
ENV GCC_PATH=arm-linux-gnueabihf-gcc

ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -cpu max -L /usr/arm-linux-gnueabihf" \
Expand Down
16 changes: 14 additions & 2 deletions ci/docker/x86_64-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
make \
ca-certificates \
wget \
xz-utils
xz-utils \
gpg

RUN wget http://ci-mirrors.rust-lang.org/sde-external-10.8.0-2026-03-15-lin.tar.xz -O sde.tar.xz
RUN mkdir intel-sde
Expand All @@ -16,7 +17,18 @@ RUN wget https://mirrors.edge.kernel.org/pub/tools/llvm/files/llvm-22.1.4-x86_64
RUN mkdir llvm
RUN tar -xvf llvm.tar.xz --strip-components=1 -C llvm

ENV PATH="/llvm/bin:$PATH"
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |\
gpg --dearmor |\
tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null

RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" |\
tee /etc/apt/sources.list.d/oneAPI.list

RUN apt-get update && apt-get install -y --no-install-recommends intel-oneapi-compiler-dpcpp-cpp

ENV CLANG_PATH="/llvm/bin/clang"
ENV GCC_PATH="gcc"
ENV ICX_PATH="/opt/intel/oneapi/compiler/2026.0/bin/icx"

ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="/intel-sde/sde64 \
-cpuid-in /checkout/ci/docker/x86_64-unknown-linux-gnu/cpuid.def \
Expand Down
9 changes: 4 additions & 5 deletions ci/intrinsic-test-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

set -ex

if [ $# -lt 1 ]; then
>&2 echo "Usage: $0 <TARGET>"
if [ $# -lt 2 ]; then
>&2 echo "Usage: $0 <TARGET> <CC>"
exit 1
fi

Expand All @@ -29,7 +29,6 @@ run() {
--user "$(id -u)":"$(id -g)" \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--env TARGET="${1}" \
--env PROFILE \
--env "${HOST_LINKER}"="cc" \
--env STDARCH_DISABLE_ASSERT_INSTR \
Expand All @@ -48,12 +47,12 @@ run() {
--workdir /checkout \
--privileged \
stdarch \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/intrinsic-test.sh"
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/intrinsic-test.sh ${1} ${2}"
}

if [ -z "$1" ]; then
>&2 echo "No target specified!"
exit 1
else
run "${1}"
run "${1}" "${2}"
fi
54 changes: 38 additions & 16 deletions ci/intrinsic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@

set -ex

: "${TARGET?The TARGET environment variable must be set.}"
if [ $# -lt 2 ]; then
>&2 echo "Usage: $0 <TARGET> <CC>"
exit 1
fi

case ${2} in
clang)
export CC="${CLANG_PATH}"
CC_KIND=clang
;;
gcc)
export CC="${GCC_PATH}"
CC_KIND=gcc
;;
icx)
export CC="${ICX_PATH}"
CC_KIND=clang
;;
*)
>&2 echo "Unknown compiler: ${2}"
exit 1
;;
esac

export RUSTFLAGS="${RUSTFLAGS} -D warnings -Z merge-functions=disabled -Z verify-llvm-ir"
export PROFILE="${PROFILE:="release"}"
Expand All @@ -12,49 +34,49 @@ echo "PROFILE=${PROFILE}"

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

export CC="clang"

case ${TARGET} in
case ${1} in
aarch64_be*)
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"
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64_be.txt
ARCH=aarch64_be
;;

aarch64*)
export CFLAGS="-I/usr/aarch64-linux-gnu/include/"
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_aarch64.txt
ARCH=aarch64
;;

armv7*)
export CFLAGS="-I/usr/arm-linux-gnueabihf/include/"
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_arm.txt
ARCH=arm
;;

x86_64*)
export CFLAGS="-I/usr/include/x86_64-linux-gnu/"
TEST_SKIP_INTRINSICS=crates/intrinsic-test/missing_x86.txt
ARCH=x86
;;
*)
;;

esac

case "${TARGET}" in
case "${1}" in
x86_64-unknown-linux-gnu*)
env -u CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER \
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/x86-intel.xml \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}"

echo "${CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER}"
--skip "crates/intrinsic-test/missing_${ARCH}_common.txt" \
--skip "crates/intrinsic-test/missing_${ARCH}_${2}.txt" \
--target "${1}" \
--cc-kind "${CC_KIND}"
;;
*)
cargo run "${INTRINSIC_TEST}" --release \
--bin intrinsic-test -- intrinsics_data/arm_intrinsics.json \
--skip "${TEST_SKIP_INTRINSICS}" \
--target "${TARGET}"
--skip "crates/intrinsic-test/missing_${ARCH}_common.txt" \
--skip "crates/intrinsic-test/missing_${ARCH}_${2}.txt" \
--target "${1}" \
--cc-kind "${CC_KIND}"
;;
esac

cargo test --manifest-path=rust_programs/Cargo.toml --target "${TARGET}" --profile "${PROFILE}"
cargo test --manifest-path=rust_programs/Cargo.toml --target "${1}" --profile "${PROFILE}"
31 changes: 31 additions & 0 deletions crates/intrinsic-test/missing_aarch64_be_clang.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Bad LLVM codegen for BE in O2 in clang, and release in rust (https://github.com/llvm/llvm-project/issues/166190)
vcmla_laneq_f16
vcmla_rot180_laneq_f16
vcmla_rot270_laneq_f16
vcmla_rot90_laneq_f16
vcmlaq_lane_f16
vcmlaq_laneq_f16
vcmlaq_rot180_lane_f16
vcmlaq_rot180_laneq_f16
vcmlaq_rot270_lane_f16
vcmlaq_rot270_laneq_f16
vcmlaq_rot90_lane_f16
vcmlaq_rot90_laneq_f16

# Bad codegen for BE in O2 in clang, correct in rust. Same cause as above issue.
vdot_lane_s32
vdot_lane_u32
vdot_laneq_s32
vdot_laneq_u32
vdotq_lane_s32
vdotq_lane_u32
vdotq_laneq_s32
vdotq_laneq_u32
vsudot_lane_s32
vsudot_laneq_s32
vsudotq_lane_s32
vsudotq_laneq_s32
vusdot_lane_s32
vusdot_laneq_s32
vusdotq_lane_s32
vusdotq_laneq_s32
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,3 @@ vcvtns_s64_f32
vcvtns_u64_f32
vcvtps_s64_f32
vcvtps_u64_f32

# Broken in Clang (fixed in https://github.com/llvm/llvm-project/pull/156029)
vcvth_s16_f16
20 changes: 20 additions & 0 deletions crates/intrinsic-test/missing_aarch64_be_gcc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Broken in LLVM llvm/llvm-project#196999
vmull_p64
vmull_high_p64

# Broken in LLVM llvm/llvm-project#197083
vcvth_n_s32_f16
vcvth_n_u32_f16
vcvth_n_s64_f16
vcvth_n_u64_f16
vcvth_n_f16_s32
vcvth_n_f16_u32
vcvth_n_f16_s64
vcvth_n_f16_u64

# Broken in GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125279
vmaxh_f16
vminh_f16

# Rounding errors
vfms_n_f64
Empty file.
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
# Bad LLVM codegen for BE in O2 in clang, and release in rust (https://github.com/llvm/llvm-project/issues/166190)
vcmla_lane_f16
vcmla_laneq_f16
vcmla_rot180_lane_f16
vcmla_rot180_laneq_f16
vcmla_rot270_lane_f16
vcmla_rot270_laneq_f16
vcmla_rot90_lane_f16
vcmla_rot90_laneq_f16
vcmlaq_lane_f16
vcmlaq_laneq_f16
vcmlaq_laneq_f32
vcmlaq_rot180_lane_f16
vcmlaq_rot180_laneq_f16
vcmlaq_rot180_laneq_f32
vcmlaq_rot270_lane_f16
vcmlaq_rot270_laneq_f16
vcmlaq_rot270_laneq_f32
vcmlaq_rot90_lane_f16
vcmlaq_rot90_laneq_f16
vcmlaq_rot90_laneq_f32
# Bad codegen for BE in O2 in clang, correct in rust. Same cause as above issue.
vdot_lane_s32
vdot_lane_u32
vdot_laneq_s32
vdot_laneq_u32
vdotq_lane_s32
vdotq_lane_u32
vdotq_laneq_s32
vdotq_laneq_u32
vsudot_lane_s32
vsudot_laneq_s32
vsudotq_lane_s32
vsudotq_laneq_s32
vusdot_lane_s32
vusdot_laneq_s32
vusdotq_lane_s32
vusdotq_laneq_s32

# Below are in common to missing_aarch64.txt
# Not supported by qemu (will throw illegal instruction)
vamin_f16
vaminq_f16
Expand Down Expand Up @@ -119,6 +79,3 @@ vcvtns_s64_f32
vcvtns_u64_f32
vcvtps_s64_f32
vcvtps_u64_f32

# Broken in Clang
vcvth_s16_f16
19 changes: 19 additions & 0 deletions crates/intrinsic-test/missing_aarch64_gcc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Broken in GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123584, fixed in GCC 16
vxarq_u64

# Broken in LLVM llvm/llvm-project#197083
vcvth_n_s32_f16
vcvth_n_u32_f16
vcvth_n_s64_f16
vcvth_n_u64_f16
vcvth_n_f16_s32
vcvth_n_f16_u32
vcvth_n_f16_s64
vcvth_n_f16_u64

# Broken in GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125279
vmaxh_f16
vminh_f16

# Rounding errors
vfms_n_f64
Empty file.
24 changes: 24 additions & 0 deletions crates/intrinsic-test/missing_x86_clang.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# not present in Clang
_bswap
_bswap64
_mm_cvtsd_si64x
_mm_cvtsi128_si64x
_mm_cvtsi64x_sd
_mm_cvtsi64x_si128
_mm_cvttsd_si64x
_popcnt32
_popcnt64

# Clang bug
_mm512_mask_reduce_max_pd
_mm512_mask_reduce_max_ps
_mm512_mask_reduce_min_pd
_mm512_mask_reduce_min_ps

# Rounding errors in release mode
_mm_maskz_fmadd_sd
_mm_maskz_fmadd_ss
_mm_maskz_fmsub_sd
_mm_maskz_fmsub_ss
_mm_maskz_fnmadd_sd
_mm_maskz_fnmadd_ss
Loading
Loading