From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ysdra-0006gh-Mj for qemu-devel@nongnu.org; Wed, 13 May 2015 17:06:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsdrX-0003F8-GL for qemu-devel@nongnu.org; Wed, 13 May 2015 17:06:46 -0400 Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:33506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsdrX-0003Et-BR for qemu-devel@nongnu.org; Wed, 13 May 2015 17:06:43 -0400 Received: by qgdy78 with SMTP id y78so28256226qgd.0 for ; Wed, 13 May 2015 14:06:43 -0700 (PDT) Sender: Richard Henderson Message-ID: <5553BCDF.9010309@twiddle.net> Date: Wed, 13 May 2015 14:06:39 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1431544200-13371-1-git-send-email-rth@twiddle.net> <1431544200-13371-3-git-send-email-rth@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] tcg: Push merged memop+mmu_idx parameter to softmmu routines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Yongbok Kim , Leon Alrae , QEMU Developers On 05/13/2015 01:54 PM, Peter Maydell wrote: >> @@ -168,10 +168,11 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, >> #ifdef SOFTMMU_CODE_ACCESS >> static __attribute__((unused)) >> #endif >> -WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, int mmu_idx, >> - uintptr_t retaddr) >> +WORD_TYPE helper_le_ld_name(CPUArchState *env, target_ulong addr, >> + TCGMemOpIdx oi, uintptr_t retaddr) >> { >> - int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); >> + size_t mmu_idx = get_mmuidx(oi); > > We don't seem to be very consistent about what type we're using for > mmu_idx. In the TCG backends changed in patch 1 (and in the > prototype of this helper which we've just removed) we used 'int'; > in the return type of get_mmuidx() we use 'unsigned'; and here we're > using size_t... Yes, we previously used "int", but we only allow small positive values. I could have continued to use "int", but I thought "unsigned" more approprate most places that it's actually used. As for here, we're about to pass mmu_idx to several array references. In the past this has been known to help the compiler realize it doesn't need an additional zero-extension. That said, in this case with gcc 4.9, it doesn't seem to affect code generation in any way except register allocation. I can change it back if you prefer. r~