ppc: einige erkenntnisse aus den restlichen custom testfaellen @ testub10
[uebersetzerbau-ss10.git] / gesamt_ppc / chelper.c
index 3f4776d735f98b7259289e9ae9685d443825c20a..2e736ea421618c08867b07b598b27cfdbbf2d615 100644 (file)
@@ -56,8 +56,15 @@ void move(char *src, char *dst)
 
 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)