Skip to content
Commit b6808ba2 authored by Noah Goldstein's avatar Noah Goldstein
Browse files

[X86] Make constant `mul` -> `shl` + `add`/`sub` work for vector types

Something like:
    `%r = mul %x, <33, 33, 33, ...>`

Is best lowered as:
    `%tmp = %shl x, <5, 5, 5>; %r = add %tmp, %x`

As well, since vectors have non-destructive shifts, we can also do
cases where the multiply constant is `Pow2A +/- Pow2B` for arbitrary A
and B, unlike in the scalar case where the extra `mov` instructions
make it not worth it.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D150324
parent 5189eff3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment