Commit 109719ec9e311b800470286004670aff6ddd9736
1 parent
0b7c1d89
Avoid clobbering input/aliased registers in !SOFTMMU+64bit+bswap case
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5033 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
10 additions
and
9 deletions
tcg/ppc64/tcg-target.c
@@ -579,9 +579,9 @@ static void tcg_out_tlb_read (TCGContext *s, int r0, int r1, int r2, | @@ -579,9 +579,9 @@ static void tcg_out_tlb_read (TCGContext *s, int r0, int r1, int r2, | ||
579 | 579 | ||
580 | static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | 580 | static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) |
581 | { | 581 | { |
582 | - int addr_reg, data_reg, r0, mem_index, s_bits, bswap; | 582 | + int addr_reg, data_reg, r0, r1, mem_index, s_bits, bswap; |
583 | #ifdef CONFIG_SOFTMMU | 583 | #ifdef CONFIG_SOFTMMU |
584 | - int r1, r2; | 584 | + int r2; |
585 | void *label1_ptr, *label2_ptr; | 585 | void *label1_ptr, *label2_ptr; |
586 | #endif | 586 | #endif |
587 | 587 | ||
@@ -653,6 +653,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | @@ -653,6 +653,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | ||
653 | tcg_out_rld (s, RLDICL, addr_reg, addr_reg, 0, 32); | 653 | tcg_out_rld (s, RLDICL, addr_reg, addr_reg, 0, 32); |
654 | #endif | 654 | #endif |
655 | r0 = addr_reg; | 655 | r0 = addr_reg; |
656 | + r1 = 4; | ||
656 | #endif | 657 | #endif |
657 | 658 | ||
658 | #ifdef TARGET_WORDS_BIGENDIAN | 659 | #ifdef TARGET_WORDS_BIGENDIAN |
@@ -693,11 +694,11 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | @@ -693,11 +694,11 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) | ||
693 | break; | 694 | break; |
694 | case 3: | 695 | case 3: |
695 | if (bswap) { | 696 | if (bswap) { |
696 | - tcg_out32 (s, LWBRX | RT (data_reg) | RB (r0)); | ||
697 | - tcg_out32 (s, ADDI | RT (r0) | RA (r0) | 4); | ||
698 | - tcg_out32 (s, LWBRX | RT (r0) | RB (r0)); | ||
699 | - tcg_out_rld (s, RLDICR, r0, r0, 32, 31); | ||
700 | - tcg_out32 (s, OR | SAB (r0, data_reg, data_reg)); | 697 | + tcg_out32 (s, LWBRX | RT (0) | RB (r0)); |
698 | + tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); | ||
699 | + tcg_out32 (s, LWBRX | RT (data_reg) | RB (r1)); | ||
700 | + tcg_out_rld (s, RLDICR, data_reg, data_reg, 32, 31); | ||
701 | + tcg_out32 (s, OR | SAB (0, data_reg, data_reg)); | ||
701 | } | 702 | } |
702 | else tcg_out32 (s, LD | RT (data_reg) | RA (r0)); | 703 | else tcg_out32 (s, LD | RT (data_reg) | RA (r0)); |
703 | break; | 704 | break; |
@@ -788,9 +789,9 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) | @@ -788,9 +789,9 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) | ||
788 | case 3: | 789 | case 3: |
789 | if (bswap) { | 790 | if (bswap) { |
790 | tcg_out32 (s, STWBRX | RS (data_reg) | RA (0) | RB (r0)); | 791 | tcg_out32 (s, STWBRX | RS (data_reg) | RA (0) | RB (r0)); |
791 | - tcg_out32 (s, ADDI | RT (r0) | RA (r0) | 4); | 792 | + tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); |
792 | tcg_out_rld (s, RLDICL, 0, data_reg, 32, 0); | 793 | tcg_out_rld (s, RLDICL, 0, data_reg, 32, 0); |
793 | - tcg_out32 (s, STWBRX | RS (0) | RA (0) | RB (r0)); | 794 | + tcg_out32 (s, STWBRX | RS (0) | RA (0) | RB (r1)); |
794 | } | 795 | } |
795 | else tcg_out32 (s, STD | RS (data_reg) | RA (r0)); | 796 | else tcg_out32 (s, STD | RS (data_reg) | RA (r0)); |
796 | break; | 797 | break; |