Skip to content

NCG(x86): Use LEA for `x + (y << imm)` constructs.

This came up in a recent reddit thread. Other compilers do this.

If we have: x + (y << const) we currently emit:

        shlq $4,%rbx
        addq %r14,%rbx

But we should emit:

leaq (%r14,%rsi,8),%rbx

I implemented this in !7709 (merged)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information