Skip to content

Commit

Permalink
misc: Use new rotate functions
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Sep 25, 2013
1 parent 6aa25b4 commit 3df2b8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion target-arm/iwmmxt_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ uint64_t HELPER(iwmmxt_rorl)(CPUARMState *env, uint64_t x, uint32_t n)

uint64_t HELPER(iwmmxt_rorq)(CPUARMState *env, uint64_t x, uint32_t n)
{
x = (x >> n) | (x << (64 - n));
x = ror64(x, n);
env->iwmmxt.cregs[ARM_IWMMXT_wCASF] = NZBIT64(x);
return x;
}
Expand Down
12 changes: 4 additions & 8 deletions tcg/optimize.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,16 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y)
return (int64_t)x >> (int64_t)y;

case INDEX_op_rotr_i32:
x = ((uint32_t)x << (32 - y)) | ((uint32_t)x >> y);
return x;
return ror32(x, y);

case INDEX_op_rotr_i64:
x = ((uint64_t)x << (64 - y)) | ((uint64_t)x >> y);
return x;
return ror64(x, y);

case INDEX_op_rotl_i32:
x = ((uint32_t)x << y) | ((uint32_t)x >> (32 - y));
return x;
return rol32(x, y);

case INDEX_op_rotl_i64:
x = ((uint64_t)x << y) | ((uint64_t)x >> (64 - y));
return x;
return rol64(x, y);

CASE_OP_32_64(not):
return ~x;
Expand Down
8 changes: 4 additions & 4 deletions tci.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,13 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2)));
tci_write_reg32(t0, rol32(t1, t2));
break;
case INDEX_op_rotr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2)));
tci_write_reg32(t0, ror32(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i32
Expand Down Expand Up @@ -955,13 +955,13 @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, (t1 << t2) | (t1 >> (64 - t2)));
tci_write_reg64(t0, rol64(t1, t2));
break;
case INDEX_op_rotr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, (t1 >> t2) | (t1 << (64 - t2)));
tci_write_reg64(t0, ror64(t1, t2));
break;
#endif
#if TCG_TARGET_HAS_deposit_i64
Expand Down

0 comments on commit 3df2b8f

Please sign in to comment.