flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > FASM accept negative immediates in ENTER and INT Goto page Previous 1, 2 |
Author |
|
revolution 26 Feb 2010, 10:08
Code: bt ax,-1 bt eax,-1 |
|||
26 Feb 2010, 10:08 |
|
LocoDelAssembly 26 Feb 2010, 17:19
It is documented the same way for btc, btr, bts, shr, shl, shld and shrd, it takes the modulo bits_of_dest of the immediate.
As for legitimate uses of this could be "counting from the left" immediate, so if you always want to take the bit just before the sign bit, you use -2 and then you don't care of the dest register your macro will receive because the immediate will always pick the correct. For the others you can think of them as "keep the last/first n bits" again with independence of the destination size. I've just woke up so I hope I didn't say complete nonsense |
|||
26 Feb 2010, 17:19 |
|
revolution 26 Feb 2010, 22:45
Code: pshufd xmm0,xmm1,-1 |
|||
26 Feb 2010, 22:45 |
|
LocoDelAssembly 26 Feb 2010, 23:48
Since imm8 there is working as some sort of bit set, I think it is right to accept negative values.
The only problem I see however, is that since fasm can't distinguish between 64-bit negatives and real negatives, there is some kind of odd thing in that fasm accepts all ones or all zeros but not any other combination in the upper 48-bits. I think that the imm8 in pshufd xmm0, xmm1, $FFFF'FFFF'FFFF'FFxx may have to be considered out of range because the Fs are not acting as selectors of any muxer. On the other hand, in $0000'0000'0000'00xx the 0s are not handling any muxer neither but it is a correct representation of the $xx number and for that reason the all Fs version may be a correct representation of a negative imm8 as well... |
|||
26 Feb 2010, 23:48 |
|
revolution 26 Feb 2010, 23:59
LocoDelAssembly wrote: ... upper 48-bits. For the BT case I think that negatives are okay. But for the PSHUFD (and similar) there is no notion of the imm8 having a sign. Indeed is it not even an integer value, it is a bitmap selection. To use negative numbers is a strange way to define a bitmap constant. |
|||
26 Feb 2010, 23:59 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.