]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-arm/translate: Fix RRX operands
authorPeter Crosthwaite <peter.crosthwaite@petalogix.com>
Tue, 16 Oct 2012 09:15:50 +0000 (19:15 +1000)
committerAurelien Jarno <aurelien@aurel32.net>
Wed, 17 Oct 2012 17:56:46 +0000 (19:56 +0200)
Instructions that both use the RRX second operand and update CS were
incorrect, as the Carry flag was updated too early. An example of such an
instruction would be:

ands r12,r13,RRX

Ands, because of the "s" flag will update the carry flag. But the RRX second
operand rotates through the C flag which should happen before the update.
Fixed the ordering of the two, the old carry is read by "r13,RRX" before being
updated.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reported-by: Vinesh Peringat <vineshp@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-arm/translate.c

index c6840b7832ab590b50392b9cb3bfae35843c08d7..daccb15c23af42b911021b13b790d803f7fa58b0 100644 (file)
@@ -516,10 +516,10 @@ static inline void gen_arm_shift_im(TCGv var, int shiftop, int shift, int flags)
             tcg_gen_rotri_i32(var, var, shift); break;
         } else {
             TCGv tmp = tcg_temp_new_i32();
+            tcg_gen_shli_i32(tmp, cpu_CF, 31);
             if (flags)
                 shifter_out_im(var, 0);
             tcg_gen_shri_i32(var, var, 1);
-            tcg_gen_shli_i32(tmp, cpu_CF, 31);
             tcg_gen_or_i32(var, var, tmp);
             tcg_temp_free_i32(tmp);
         }