HackerTrans
TopNewTrendsCommentsPastAskShowJobs

jxors

no profile record

comments

jxors
·قبل 5 أشهر·discuss
The memory operand version tends to be as slow or slower than the manual implementation, so LLVM is right to avoid it.
jxors
·قبل 6 أشهر·discuss
This is indeed a thing. I believe in general instructions are executed slower when there are more than 4 legacy prefixes. And there are plenty of other timing differences between different microarchitectures
jxors
·قبل 6 أشهر·discuss
It must be the rightmost prefix among the prefixes. It also can't be repeated, unlike all other prefixes
jxors
·قبل 6 أشهر·discuss
> Some instructions require VEX.L or VEX.W to be 0 or 1, and some encodings result in completely different instructions if you change VEX.L.

There is even an instruction where AMD got this wrong! VPERMQ requires VEX.W=1, but some AMD CPUs also happily execute it when VEX.W=0 even though that is supposed to raise an exception.
jxors
·قبل 6 أشهر·discuss
This flowchart hides the most awful parts (IMO) of x86 prefixes: some combinations of prefixes are invalid but still parsed and executed, like combining two segment overrides, or placing a legacy prefix after a REX prefix.

The CPU also doesn't care if you use prefixes that aren't valid for a specific instruction, for example a REP on a non-repeatable instruction. The LOCK prefix is the only prefix that makes the sane choice to reject invalid combinations, rather than silently accept them.

Also, the (E)VEX prefix doesn't behave like the other prefixes: it must be placed last, and can therefore only appear once. All other prefixes can be repeated.
jxors
·قبل 7 أشهر·discuss
> However, in this case it doesn’t matter; those top bits are discarded when the result is written to the 32-bit eax.

Fun (but useless) fact: This being x86, of course there are at least three different ways [1] to encode this instruction: the way it was shown, with an address size override prefix (giving `lea eax, [edi+esi]`), or with both a REX prefix and an address size override prefix (giving `lea rax, [edi+esi]`).

And if you have a segment with base=0 around you can also add in a segment for fun: `lea rax, cs:[edi+esi]`

[1]: not counting redundant prefixes and different ModRMs