Commit f8edcbaa2dc25fb5ff6ad0c384d9c9cbea1b3015

Authored by malc
1 parent 3018f259

Avoid clobbering input register in qemu_ld64+bswap+useronly case

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5287 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 13 deletions
tcg/ppc/tcg-target.c
@@ -474,9 +474,9 @@ static void *qemu_st_helpers[4] = { @@ -474,9 +474,9 @@ static void *qemu_st_helpers[4] = {
474 474
475 static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) 475 static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
476 { 476 {
477 - int addr_reg, data_reg, data_reg2, r0, mem_index, s_bits, bswap; 477 + int addr_reg, data_reg, data_reg2, r0, r1, mem_index, s_bits, bswap;
478 #ifdef CONFIG_SOFTMMU 478 #ifdef CONFIG_SOFTMMU
479 - int r1, r2; 479 + int r2;
480 void *label1_ptr, *label2_ptr; 480 void *label1_ptr, *label2_ptr;
481 #endif 481 #endif
482 #if TARGET_LONG_BITS == 64 482 #if TARGET_LONG_BITS == 64
@@ -599,6 +599,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) @@ -599,6 +599,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
599 599
600 #else /* !CONFIG_SOFTMMU */ 600 #else /* !CONFIG_SOFTMMU */
601 r0 = addr_reg; 601 r0 = addr_reg;
  602 + r1 = 3;
602 #endif 603 #endif
603 604
604 #ifdef TARGET_WORDS_BIGENDIAN 605 #ifdef TARGET_WORDS_BIGENDIAN
@@ -632,17 +633,9 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc) @@ -632,17 +633,9 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
632 break; 633 break;
633 case 3: 634 case 3:
634 if (bswap) { 635 if (bswap) {
635 - if (r0 == data_reg) {  
636 - tcg_out32 (s, LWBRX | RT (0) | RB (r0));  
637 - tcg_out32 (s, ADDI | RT (r0) | RA (r0) | 4);  
638 - tcg_out32 (s, LWBRX | RT (data_reg2) | RB (r0));  
639 - tcg_out_mov (s, data_reg, 0);  
640 - }  
641 - else {  
642 - tcg_out32 (s, LWBRX | RT (data_reg) | RB (r0));  
643 - tcg_out32 (s, ADDI | RT (r0) | RA (r0) | 4);  
644 - tcg_out32 (s, LWBRX | RT (data_reg2) | RB (r0));  
645 - } 636 + tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);
  637 + tcg_out32 (s, LWBRX | RT (data_reg) | RB (r0));
  638 + tcg_out32 (s, LWBRX | RT (data_reg2) | RB (r1));
646 } 639 }
647 else { 640 else {
648 if (r0 == data_reg2) { 641 if (r0 == data_reg2) {