Commit 6f41b7772d84494b47252aaff67a7c16cc37dbe0

Authored by blueswir1
1 parent 90cbed46

Fix 64 bit constant generation

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5020 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 12 additions and 5 deletions
tcg/sparc/tcg-target.c
@@ -268,8 +268,8 @@ static inline void tcg_out_arith(TCGContext *s, int rd, int rs1, int rs2, @@ -268,8 +268,8 @@ static inline void tcg_out_arith(TCGContext *s, int rd, int rs1, int rs2,
268 INSN_RS2(rs2)); 268 INSN_RS2(rs2));
269 } 269 }
270 270
271 -static inline void tcg_out_arithi(TCGContext *s, int rd, int rs1, int offset,  
272 - int op) 271 +static inline void tcg_out_arithi(TCGContext *s, int rd, int rs1,
  272 + uint32_t offset, int op)
273 { 273 {
274 tcg_out32(s, op | INSN_RD(rd) | INSN_RS1(rs1) | 274 tcg_out32(s, op | INSN_RD(rd) | INSN_RS1(rs1) |
275 INSN_IMM13(offset)); 275 INSN_IMM13(offset));
@@ -292,7 +292,7 @@ static inline void tcg_out_movi_imm13(TCGContext *s, int ret, uint32_t arg) @@ -292,7 +292,7 @@ static inline void tcg_out_movi_imm13(TCGContext *s, int ret, uint32_t arg)
292 292
293 static inline void tcg_out_movi_imm32(TCGContext *s, int ret, uint32_t arg) 293 static inline void tcg_out_movi_imm32(TCGContext *s, int ret, uint32_t arg)
294 { 294 {
295 - if (check_fit_i32(arg, 12)) 295 + if (check_fit_tl(arg, 12))
296 tcg_out_movi_imm13(s, ret, arg); 296 tcg_out_movi_imm13(s, ret, arg);
297 else { 297 else {
298 tcg_out_sethi(s, ret, arg); 298 tcg_out_sethi(s, ret, arg);
@@ -310,9 +310,16 @@ static inline void tcg_out_movi(TCGContext *s, TCGType type, @@ -310,9 +310,16 @@ static inline void tcg_out_movi(TCGContext *s, TCGType type,
310 tcg_out_arithi(s, TCG_REG_I4, TCG_REG_I4, 32, SHIFT_SLLX); 310 tcg_out_arithi(s, TCG_REG_I4, TCG_REG_I4, 32, SHIFT_SLLX);
311 tcg_out_movi_imm32(s, ret, arg); 311 tcg_out_movi_imm32(s, ret, arg);
312 tcg_out_arith(s, ret, ret, TCG_REG_I4, ARITH_OR); 312 tcg_out_arith(s, ret, ret, TCG_REG_I4, ARITH_OR);
313 - } else 313 + } else if (check_fit_tl(arg, 12))
  314 + tcg_out_movi_imm13(s, ret, arg);
  315 + else {
  316 + tcg_out_sethi(s, ret, arg);
  317 + if (arg & 0x3ff)
  318 + tcg_out_arithi(s, ret, ret, arg & 0x3ff, ARITH_OR);
  319 + }
  320 +#else
  321 + tcg_out_movi_imm32(s, ret, arg);
314 #endif 322 #endif
315 - tcg_out_movi_imm32(s, ret, arg);  
316 } 323 }
317 324
318 static inline void tcg_out_ld_raw(TCGContext *s, int ret, 325 static inline void tcg_out_ld_raw(TCGContext *s, int ret,