0

Since has x86_64 has 14 general-purpose registers (rsp and rbp are for stack), could you make a 896 bit integer?

Or could you even use all 32 zmm registers (512-bit) to make a 16384-bit integer, by moving parts of it into the 64-bit registers and then calculating? I don't care if gmp is faster for this question.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
theoo3
  • 1
  • 1
  • 4
    You could use all available memory to create one long integer... – KamilCuk May 12 '21 at 22:32
  • You can load registers with arbitrary values and say that each represents some bits of an abstract integer, but I don't see how this is meaningful or useful in any way. – that other guy May 12 '21 at 22:47
  • 1
    Yes, obviously yes, you could do that; adc/sbb make those operations easy. And you can use RBP for whatever you want. You can even use RSP for anything you want, in user-space with no signal handlers. You could *also* use the MMX state, in addition to the ZMM, k0..k7, *and* general-purpose integer state, all at once for a single integer. – Peter Cordes May 12 '21 at 23:04
  • Note that getting data between GP and high parts of ZMM regs will mean shuffling to the bottom for a read, or a masked broadcast to write. (or store/reload to mem). [Using ymm registers as a "memory-like" storage location](https://stackoverflow.com/q/50915381) shows how. I close this as a duplicate because other than "yes", it's not clear what kind of answer this question is looking for other than how to get data in/out of wide vector regs. You know how to use add/adc, right? – Peter Cordes May 12 '21 at 23:09

0 Answers0