[FFmpeg-devel] [PATCH 2/2] avutil/float_dsp: add ff_vector_dmul_{sse2, avx}

Henrik Gramner henrik at gramner.com
Fri Sep 14 17:51:13 EEST 2018

On Fri, Sep 14, 2018 at 3:26 PM, James Almer <jamrial at gmail.com> wrote:
> On 9/14/2018 9:57 AM, Henrik Gramner wrote:
>> Also if you want a 32-bit result from lea it should be written as "lea
>> lend, [lenq*8 - mmsize*4]" which is equivalent but has a shorter
>> opcode (e.g. always use native sizes within brackets).
> len is an int, so I assume this is only possible here because it's an
> argument passed in a reg and not stack? Otherwise, the upper 32bits
> would probably make a mess with the multiplication.

As long as the destination register is 32-bit the upper half of the
input is irrelevant. Always use native sizes for registers within
brackets when using LEA, and select the size of the destination
register to pick 32-bit vs 64-bit.

I can't really think of any scenario where using a 32-bit register
address operand with a 64-bit destination for LEA is not a mistake.
The fact that doing so is even valid is probably just an artifact of
16-bit memory operands having some usefulness on x86-32 and that
behavior was just straight up copied over to AMD64, either because
nobody thought about it or that doing so made some implementation
detail easier.

More information about the ffmpeg-devel mailing list