Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> "it is impossible to add 2^33 to rax using one instruction only."

This can in fact be done, with a memory operand. I'm not sure about the performance compared to a 64-bit load immediate followed by an add, but this will do it (NASM syntax):

          add rax, [rel the_constant]
          ...
  
  the_constant:
          dq 8589934592


This is the right answer.

This is what ARM does a lot of times (their 'immediate' value ops allow you to pick an 8 bit number and rotate it a bit)

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc....




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: