Allow inlining of fns where the implementation is compile-time selected #2393
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "17 3 * * *" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest, macos-15-intel] | |
| toolchain: ["1.38.0", "1.61.0", stable, beta, nightly] | |
| exclude: | |
| - os: macos-latest | |
| toolchain: "1.38.0" # macOS ARM64 is not supported by 1.38.0 | |
| - os: macos-15-intel | |
| toolchain: "1.38.0" # macOS is not supported by 1.38.0 (flexpect) | |
| - toolchain: "1.61.0" # only macos | |
| include: | |
| - os: macos-latest | |
| toolchain: "1.61.0" | |
| - os: macos-15-intel | |
| toolchain: "1.61.0" | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| - name: Run tests | |
| run: | | |
| for features in "" "--features std" "--features public_imp" "--features std,public_imp"; do | |
| cargo clean; cargo test --release --no-default-features $features --all-targets --verbose | |
| done | |
| - name: Run with SSE4.2 + AVX2 target features, all native CPU features | |
| run: | | |
| for features in "" "--features std" "--features public_imp" "--features std,public_imp"; do | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+sse4.2" cargo test --release --no-default-features $features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+avx2" cargo test --release --no-default-features $features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-cpu=native" cargo test --release --no-default-features $features --all-targets --verbose | |
| done | |
| shell: bash | |
| if: ${{ matrix.os != 'macos-latest'}} | |
| - name: Run tests with all features on nightly | |
| run: cargo test --release --all-features --all-targets --verbose | |
| if: ${{ matrix.toolchain == 'nightly'}} | |
| - name: Run test with all features and with SSE4.2 + AVX2 target features, all native CPU features on nightly | |
| run: | | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+sse4.2" cargo test --release --all-features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+avx2" cargo test --release --all-features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-cpu=native" cargo test --release --all-features --all-targets --verbose | |
| shell: bash | |
| if: ${{ matrix.os != 'macos-latest' && matrix.toolchain == 'nightly' }} | |
| test-win32: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| toolchain: ["1.38.0", stable, beta, nightly] | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| CARGO_BUILD_TARGET: "i686-pc-windows-msvc" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| targets: "i686-pc-windows-msvc" | |
| - name: Run tests | |
| run: | | |
| for features in "" "--features std" "--features public_imp" "--features std,public_imp"; do | |
| cargo clean; cargo test --release --no-default-features $features --all-targets --verbose | |
| done | |
| - name: Run with SSE4.2 + AVX2 target features, all native CPU features | |
| run: | | |
| for features in "" "--features std" "--features public_imp" "--features std,public_imp"; do | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+sse4.2" cargo test --release --no-default-features $features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+avx2" cargo test --release --no-default-features $features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-cpu=native" cargo test --release --no-default-features $features --all-targets --verbose | |
| done | |
| shell: bash | |
| - name: Run tests with all features on nightly | |
| run: cargo test --release --all-features --all-targets --verbose | |
| if: ${{ matrix.toolchain == 'nightly'}} | |
| - name: Run test with all features and with SSE4.2 + AVX2 target features, all native CPU features on nightly | |
| run: | | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+sse4.2" cargo test --release --all-features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-feature=+avx2" cargo test --release --all-features --all-targets --verbose | |
| cargo clean | |
| RUSTFLAGS="-D warnings -C target-cpu=native" cargo test --release --all-features --all-targets --verbose | |
| shell: bash | |
| if: ${{ matrix.toolchain == 'nightly' }} | |
| test-inlining: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| toolchain: ["1.38.0", stable, beta, nightly] | |
| defaults: | |
| run: | |
| working-directory: inlining | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| targets: "x86_64-unknown-linux-gnu" | |
| components: "llvm-tools-preview" | |
| - name: Install stable toolchain | |
| run: rustup toolchain add stable | |
| - name: Install rustfilt | |
| run: cargo +stable install rustfilt | |
| - name: Check x86_64 inlining | |
| run: | | |
| RUSTFLAGS="-C target-feature=+avx2" ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-nostd-avx2.txt --no-default-features | |
| RUSTFLAGS="-C target-feature=+sse4.2" ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-nostd-sse42.txt --no-default-features | |
| - name: Check x86_64 inlining with avx2 autoselection | |
| run: | | |
| ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std-old.txt | |
| ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std-old.txt "--features public_imp" | |
| RUSTFLAGS="-C target-feature=+avx2" ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std-avx2.txt | |
| if: ${{ matrix.toolchain == '1.38.0' }} | |
| - name: Check x86_64 inlining with avx512 autoselection | |
| run: | | |
| ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std.txt | |
| ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std.txt "--features public_imp" | |
| RUSTFLAGS="-C target-feature=+avx512f,+avx512bw,+avx512vbmi,+avx512vbmi2" ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-std-avx512.txt | |
| RUSTFLAGS="-C target-feature=+avx512f,+avx512bw,+avx512vbmi,+avx512vbmi2" ./check-inlining.sh x86_64-unknown-linux-gnu expected-methods-x86-nostd-avx512.txt --no-default-features | |
| if: ${{ matrix.toolchain != '1.38.0' }} | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| targets: "aarch64-apple-darwin aarch64-unknown-linux-gnu armv7-unknown-linux-gnueabihf" | |
| components: "llvm-tools-preview" | |
| if: ${{ matrix.toolchain != '1.38.0' }} | |
| - name: Check aarch64 inlining | |
| run: | | |
| for target in aarch64-unknown-linux-gnu aarch64-apple-darwin | |
| do | |
| ./check-inlining.sh $target expected-methods-aarch64-neon.txt | |
| ./check-inlining.sh $target expected-methods-aarch64-neon.txt --no-default-features | |
| ./check-inlining.sh $target expected-methods-aarch64-neon.txt "--features public_imp" | |
| done | |
| if: ${{ matrix.toolchain != '1.38.0' }} | |
| - name: Check armv7 neon inlining | |
| run: | | |
| ./check-inlining.sh armv7-unknown-linux-gnueabihf expected-methods-armv7-std.txt "--features armv7_neon" | |
| ./check-inlining.sh armv7-unknown-linux-gnueabihf expected-methods-armv7-std.txt "--features armv7_neon,public_imp" | |
| RUSTFLAGS="-C target-feature=+neon" ./check-inlining.sh armv7-unknown-linux-gnueabihf expected-methods-armv7-neon.txt "--features armv7_neon" | |
| RUSTFLAGS="-C target-feature=+neon" ./check-inlining.sh armv7-unknown-linux-gnueabihf expected-methods-armv7-neon.txt "--no-default-features --features armv7_neon" | |
| if: ${{ matrix.toolchain == 'nightly' }} | |
| test-doc: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| - name: Run cargo doc | |
| run: cargo doc --features public_imp | |
| env: | |
| RUSTDOCFLAGS: --cfg docsrs | |
| fmt_check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt -- --check | |
| clippy_check: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: clippy | |
| - name: Clippy - default | |
| run: cargo clippy --all-targets | |
| - name: Clippy - all features enabled | |
| run: cargo clippy --all-targets --all-features | |
| - name: Clippy - all features disabled | |
| run: cargo clippy --all-targets --no-default-features | |
| clippy_check_arm: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: "-D warnings" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| components: clippy | |
| targets: "thumbv7neon-unknown-linux-gnueabihf, armv7-unknown-linux-gnueabihf, armv7-linux-androideabi" | |
| - name: Run Clippy | |
| run: | | |
| for target in thumbv7neon-unknown-linux-gnueabihf armv7-unknown-linux-gnueabihf armv7-linux-androideabi; do | |
| cargo clippy --target $target --all-targets | |
| cargo clippy --target $target --all-targets --all-features | |
| cargo clippy --target $target --all-targets --no-default-features | |
| cargo clippy --target $target --all-targets --no-default-features --features armv7_neon | |
| cargo clippy --target $target --all-targets --no-default-features --features armv7_neon,public_imp | |
| done |