How load a 64 bit number in a 32 bit arm processor?

2.5k Views Asked by At

I am trying to load a 64-bit number on a 32-bit ARM7TDMI-S microprocessor however, I am not understanding how to do so. I know that MOV and LDR all store only 32bit numbers so is there any way I can use 2 32bit registers as one 64-bit register?

2

There are 2 best solutions below

0
On BEST ANSWER

Just ask the compiler it will tell you. Obviously you cannot fit 64 bits into 32, it takes two registers.

unsigned long long fun ( unsigned long long a, unsigned long long b )
{
    return(a+b);
}

00000000 <fun>:
   0: e0900002 adds r0, r0, r2
   4: e0a11003 adc r1, r1, r3
   8: e12fff1e bx lr
1
On

Okay, I got the answer to my own question. I have to load the lower half of the number in one register and the upper half in another. If we want to add the two numbers then we add the lower half by using ADDS and the upper half using ADC.