I'm using inline x64 assembly with Intel Compiler and I'm trying to add a huge value to the RBP register.
The compiler gives me an error saying that the operand is incorrect for that huge number. Is there a way to solve this?
My code:
__asm add rbp, 0x7ffffffffffffff0
__asm and rbp, 0x7fffffff
The compiler outputs this:
ld-link: : error : ld-temp.o <inline asm>:2:2: invalid operand for instruction add rbp, 3264300659 ^
CodePudding user response:
No, there is no opcode that can do it in that way!
However there is a single opcode that can do the following:
BigConstant = 0x7ffffffffffffff0
...
...
add rbp, qword ptr BigConst //48 03 2D xx xx xx xx
You could also use an extra register to solve the problem, like:
mov rax, 0x7ffffffffffffff0
add rbp, rax