Commit 4a40e23194e6a6f6d4f8e7f0189e2cde2c0e517f

Authored by malc
1 parent 301f6d90

Special-case some paths inside tcg_out_tlb_read

a. Use 32bit arithmetics in TARGET_LONG_BITS == 32 case
b. Optimize byte access case in TARGET_LONG_BITS == 64 case

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4955 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 30 additions and 6 deletions
tcg/ppc64/tcg-target.c
... ... @@ -523,10 +523,28 @@ static void *qemu_st_helpers[4] = {
523 523 static void tcg_out_tlb_read (TCGContext *s, int r0, int r1, int r2,
524 524 int addr_reg, int s_bits, int offset)
525 525 {
526   -#if TARGET_LONG_BITS == 32
  526 +#ifdef TARGET_LONG_BITS
527 527 tcg_out_rld (s, RLDICL, addr_reg, addr_reg, 0, 32);
528   -#endif
529 528  
  529 + tcg_out32 (s, (RLWINM
  530 + | RA (r0)
  531 + | RS (addr_reg)
  532 + | SH (32 - (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS))
  533 + | MB (32 - (CPU_TLB_BITS + CPU_TLB_ENTRY_BITS))
  534 + | ME (31 - CPU_TLB_ENTRY_BITS)
  535 + )
  536 + );
  537 + tcg_out32 (s, ADD | RT (r0) | RA (r0) | RB (TCG_AREG0));
  538 + tcg_out32 (s, (LWZU | RT (r1) | RA (r0) | offset));
  539 + tcg_out32 (s, (RLWINM
  540 + | RA (r2)
  541 + | RS (addr_reg)
  542 + | SH (0)
  543 + | MB ((32 - s_bits) & 31)
  544 + | ME (31 - TARGET_PAGE_BITS)
  545 + )
  546 + );
  547 +#else
530 548 tcg_out_rld (s, RLDICL, r0, addr_reg,
531 549 64 - TARGET_PAGE_BITS,
532 550 64 - CPU_TLB_BITS);
... ... @@ -537,10 +555,16 @@ static void tcg_out_tlb_read (TCGContext *s, int r0, int r1, int r2,
537 555 tcg_out32 (s, ADD | TAB (r0, r0, TCG_AREG0));
538 556 tcg_out32 (s, LD_ADDR | RT (r1) | RA (r0) | offset);
539 557  
540   - tcg_out_rld (s, RLDICL, r2, addr_reg,
541   - 64 - TARGET_PAGE_BITS,
542   - TARGET_PAGE_BITS - s_bits);
543   - tcg_out_rld (s, RLDICL, r2, r2, TARGET_PAGE_BITS, 0);
  558 + if (!s_bits) {
  559 + tcg_out_rld (s, RLDICR, r2, addr_reg, 0, 63 - TARGET_PAGE_BITS);
  560 + }
  561 + else {
  562 + tcg_out_rld (s, RLDICL, r2, addr_reg,
  563 + 64 - TARGET_PAGE_BITS,
  564 + TARGET_PAGE_BITS - s_bits);
  565 + tcg_out_rld (s, RLDICL, r2, r2, TARGET_PAGE_BITS, 0);
  566 + }
  567 +#endif
544 568 }
545 569  
546 570 static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
... ...