Compare VM cycles for compiler intrinsics vs equivalent Rust-generated MASM
- Lingua principale
- Rust
- Stelle
- 115
- Fork
- 84
- Merge medio
- 1g 8h
- PR unite (30g)
- 15
Descrizione
Some compiler intrinsics directly correspond to Rust standard-library operations. For example, `::intrinsics::i32::overflowing_mul` is equivalent to Rust's `i32::overflowing_mul`.
However, compiling Rust code that calls such a function does not necessarily produce MASM that calls the corresponding compiler intrinsic. For example, the `overflowing_mul_i32` arithmetic test calls `i32::overflowing_mul`, but the generated MASM does not call `::intrinsics::i32::overflowing_mul`.
I think it would be interesting to compare using the compiler intrinsic directly vs the MASM currently generated from equivalent Rust code. For `i32::overflowing_mul` I'd expect the intrinsic to be more performant.
Suggested comparison:
- MASM wrapper that calls `::intrinsics::i32::overflowing_mul` directly
- Rust wrapper that calls `i32::overflowing_mul`, compiled with midenc
- Consistent input/output for both wrappers to ensure fair comparison
- Cycle measurements for representative inputs, including edge cases
If the intrinsic is significantly cheaper, we can investigate whether the frontend/codegen should recognize the generated pattern and lower it to the compiler intrinsic.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Look at the overflowing_mul_i32 arithmetic test to see the current MASM output. Write a MASM wrapper that calls ::intrinsics::i32::overflowing_mul directly and a Rust wrapper that calls i32::overflowing_mul. Compare VM cycles for both with consistent inputs. The goal is to see if the intrinsic is more performant and whether the frontend should lower the pattern to the intrinsic.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100