On Tue, 16 Oct 2018, Mikola Akbal wrote: > I have problems with Intel syntax in GAS. > > Intel syntax usually uses form "and rax, 99h". GAS does not accept it. > Gives message: "Error: junk `h' after expression". So, i use form "and > rax, 0x99". It is not problem - i like this form more. The problem is > next: > > GAS accepts this: "and rax, 0xFFFFFFFFF4FFFFFF", but does not accept > following: "and rax, 0xFFFFFFFF4FFFFFFF". Says: "Error: suffix or > operands invalid for `and'". I can not understand why this problem > appears near the 4-bytes boundary. It looks like bug.
This is not a bug in GAS; this reflects a limitation of the amd64 ISA itself. There is no AND instruction that takes, to use the Intel SDM's terms, an r64 and an imm64. Why does 0xFFFFFFFFF4FFFFFF work? Because of this row in the SDM's table for AND: REX.W + 81 /4 id AND r/m64, imm32 MI Valid N.E. r/m64 AND imm32 sign extended to 64-bits. Note that description: "r/m64 AND imm32 sign extended to 64-bits." The value you provided can be represented as an 'imm32 sign extended to 64-bits". These are questions about GNU-as and the Intel architecture which are not specific to OpenBSD and do not reflect issues in OpenBSD. I suggest you read the relevant chapters of the SDM, particularly the 64-bit support sections in various chapters of volumes 1 and 2, and go to general programming forums such as stackexchange, where these sorts of queries have already been answered. Philip Guenther
