Enable SLP for O2/Os optimization levels

Aperta
#166,617 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start by reading the linked LLVM issue #246274 and the related Rust issue #43702 to understand the frontend behavior implicated here. Reproduce the example with opt-level=2 and opt-level=s, then trace how Rust lowers the array construction and XOR operations. Done means the generated code uses word-wise or otherwise optimized XOR operations at those levels; the issue names no Rust source file or test to start from.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A-array A-autovectorization A-codegen A-LLVM C-optimization I-slow S-has-mcve T-compiler

The following Rust code:

const N: usize = 16;

pub fn xor_into(a: &[u8; N], b: &[u8; N], dst: &mut [u8; N]) {
    *dst =  core::array::from_fn(|i| a[i] ^ b[i]);
}

Results in assembly which performs XOR byte-by-byte with opt-level=2/s , see: https://rust.godbolt.org/z/xW4xKE8a6

Such code is extremely common in cryptography and arguably should use at least word-wise XORing with opt-level=2/s.

In the LLVM issue it was identified as a mostly frontend issue.

Relevant issues: https://github.com/rust-lang/rust/issues/43702 https://github.com/RustCrypto/utils/issues/1621

Lingua principale
Rust
Stelle
123k
Fork
16.6k
Merge medio
2g 17h
PR unite (30g)
532

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rust

Tutte le issue di rust-lang/rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.