void moveimm(long imm, char *dst)
{
- /* TODO: 32 bits... */
- printf("\tli %s,%d\n", dst, imm);
+ if((imm > 65536-1) || (imm < -65536)) {
+ /* high word */
+ printf("\tlis %s,%d@ha\n", dst, imm);
+ /* low word */
+ printf("\taddi %s,%s,%d@l\n", dst, dst, imm);
+ } else {
+ /* just low word */
+ printf("\tli %s,%d@l\n", dst, imm);
+ }
}
char *next_reg(char *s, int params)