> But not terribly uncommon. > > Do you need to synthesize large constants? ie, what code would you generate > to load the value 0x12345 into a register? > > If you need to synthesize large constants, do you need any additional > scratch registers, or can you do so using just r0? > Only do using R0. Like the following with loading 0x12345:
MOVI 0x2345 -L //To load the lower 16bit data MOVI 0x1 -H //Load the up 16bit data The destination register must only be R0 register, which is determined by the hardware. R0 is also general register which can be used in all operation instructions like ADD, Subtract, Multiply and LOAD/STORE. Now my approach is to define the Macro PREFERRED_RELOAD_CLASS(X, CLASS), and make sure if the X is const int and larger than 512, it will return the R0_REG register class. PS: I think that if I don't define the macro LEGITIMIZE_RELOAD_ADDRESS which will push reload the larger const int, the PREFERRED_RELOAD_CLASS won't be called. is it right? Thanks. -- Best Regards daniel tian Mavrix Technology, Inc. Address:200 Zhangheng Road, #3501, Building 3, Zhangjiang Hi-tech Park, Shanghai, P.R.China (201204) Tel:86(21)51095958 - 8125 Fax:86(21)50277658 email:daniel.t...@mavrixtech.com.cn www.mavrixtech.com