Sha256: d44fe0567d4a2b8a9dd2e1daf0994601918f4853dcd073c8c99c15e40d6297c9

Contents?: true

Size: 1.71 KB

Versions: 28

Compression:

Stored size: 1.71 KB

Contents

//! Measure instruction encoding latency using various approaches; the
//! benchmarking is feature-gated on `x86` since it only measures the encoding
//! mechanism of that backend.

#[cfg(feature = "x86")]
mod x86 {
    use cranelift_codegen::isa::x64::encoding::{
        evex::{EvexInstruction, EvexVectorLength, Register},
        rex::{LegacyPrefixes, OpcodeMap},
    };
    use criterion::{criterion_group, Criterion};

    // Define the benchmarks.
    fn x64_evex_encoding_benchmarks(c: &mut Criterion) {
        let mut group = c.benchmark_group("x64 EVEX encoding");
        let rax = Register::from(0);
        let rdx = 2;

        group.bench_function("EvexInstruction (builder pattern)", |b| {
            b.iter(|| {
                let mut sink = cranelift_codegen::MachBuffer::new();
                EvexInstruction::new()
                    .prefix(LegacyPrefixes::_66)
                    .map(OpcodeMap::_0F38)
                    .w(true)
                    .opcode(0x1F)
                    .reg(rax)
                    .rm(rdx)
                    .length(EvexVectorLength::V128)
                    .encode(&mut sink);
            });
        });
    }
    criterion_group!(benches, x64_evex_encoding_benchmarks);

    /// Using an inner module to feature-gate the benchmarks means that we must
    /// manually specify how to run the benchmarks (see `criterion_main!`).
    pub fn run_benchmarks() {
        benches();
        Criterion::default().configure_from_args().final_summary();
    }
}

fn main() {
    #[cfg(feature = "x86")]
    x86::run_benchmarks();

    #[cfg(not(feature = "x86"))]
    println!(
        "Unable to run the x64-evex-encoding benchmark; the `x86` feature must be enabled in Cargo.",
    );
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
wasmtime-28.0.0 ./ext/cargo-vendor/cranelift-codegen-0.115.0/benches/x64-evex-encoding.rs
wasmtime-27.0.0 ./ext/cargo-vendor/cranelift-codegen-0.114.0/benches/x64-evex-encoding.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cranelift-codegen-0.113.0/benches/x64-evex-encoding.rs
wasmtime-25.0.2 ./ext/cargo-vendor/cranelift-codegen-0.112.2/benches/x64-evex-encoding.rs
wasmtime-25.0.1 ./ext/cargo-vendor/cranelift-codegen-0.112.1/benches/x64-evex-encoding.rs
wasmtime-25.0.0 ./ext/cargo-vendor/cranelift-codegen-0.112.0/benches/x64-evex-encoding.rs
wasmtime-24.0.0 ./ext/cargo-vendor/cranelift-codegen-0.111.0/benches/x64-evex-encoding.rs
wasmtime-23.0.2 ./ext/cargo-vendor/cranelift-codegen-0.110.2/benches/x64-evex-encoding.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cranelift-codegen-0.109.0/benches/x64-evex-encoding.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cranelift-codegen-0.108.1/benches/x64-evex-encoding.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cranelift-codegen-0.107.2/benches/x64-evex-encoding.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cranelift-codegen-0.107.2/benches/x64-evex-encoding.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cranelift-codegen-0.105.3/benches/x64-evex-encoding.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cranelift-codegen-0.104.1/benches/x64-evex-encoding.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cranelift-codegen-0.104.0/benches/x64-evex-encoding.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cranelift-codegen-0.103.0/benches/x64-evex-encoding.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cranelift-codegen-0.102.1/benches/x64-evex-encoding.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cranelift-codegen-0.102.1/benches/x64-evex-encoding.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cranelift-codegen-0.101.4/benches/x64-evex-encoding.rs
wasmtime-14.0.3 ./ext/cargo-vendor/cranelift-codegen-0.101.4/benches/x64-evex-encoding.rs