Revision 0f11f25a

b/tcg/arm/tcg-target.c
406 406
}
407 407

  
408 408
static inline void tcg_out_movi32(TCGContext *s,
409
                int cond, int rd, int32_t arg)
409
                int cond, int rd, uint32_t arg)
410 410
{
411 411
    /* TODO: This is very suboptimal, we can easily have a constant
412 412
     * pool somewhere after all the instructions.  */
413

  
414
    if (arg < 0 && arg > -0x100)
415
        return tcg_out_dat_imm(s, cond, ARITH_MVN, rd, 0, (~arg) & 0xff);
416

  
417
    if (use_armv7_instructions) {
413
    if ((int)arg < 0 && (int)arg >= -0x100) {
414
        tcg_out_dat_imm(s, cond, ARITH_MVN, rd, 0, (~arg) & 0xff);
415
    } else if (use_armv7_instructions) {
418 416
        /* use movw/movt */
419 417
        /* movw */
420 418
        tcg_out32(s, (cond << 28) | 0x03000000 | (rd << 12)
421 419
                  | ((arg << 4) & 0x000f0000) | (arg & 0xfff));
422
        if (arg & 0xffff0000)
420
        if (arg & 0xffff0000) {
423 421
            /* movt */
424 422
            tcg_out32(s, (cond << 28) | 0x03400000 | (rd << 12)
425 423
                      | ((arg >> 12) & 0x000f0000) | ((arg >> 16) & 0xfff));
426
    } else {
427
        tcg_out_dat_imm(s, cond, ARITH_MOV, rd, 0, arg & 0xff);
428
        if (arg & 0x0000ff00)
429
            tcg_out_dat_imm(s, cond, ARITH_ORR, rd, rd,
430
                            ((arg >>  8) & 0xff) | 0xc00);
431
        if (arg & 0x00ff0000)
432
            tcg_out_dat_imm(s, cond, ARITH_ORR, rd, rd,
433
                            ((arg >> 16) & 0xff) | 0x800);
434
        if (arg & 0xff000000)
435
            tcg_out_dat_imm(s, cond, ARITH_ORR, rd, rd,
436
                            ((arg >> 24) & 0xff) | 0x400);
437 424
        }
425
    } else {
426
        int opc = ARITH_MOV;
427
        int rn = 0;
428

  
429
        do {
430
            int i, rot;
431

  
432
            i = ctz32(arg) & ~1;
433
            rot = ((32 - i) << 7) & 0xf00;
434
            tcg_out_dat_imm(s, cond, opc, rd, rn, ((arg >> i) & 0xff) | rot);
435
            arg &= ~(0xff << i);
436

  
437
            opc = ARITH_ORR;
438
            rn = rd;
439
        } while (arg);
440
    }
438 441
}
439 442

  
440 443
static inline void tcg_out_mul32(TCGContext *s,

Also available in: Unified diff