Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IaCaf-0003ZR-JN for qemu-devel@nongnu.org; Tue, 25 Sep 2007 11:44:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IaCad-0003Y0-RP for qemu-devel@nongnu.org; Tue, 25 Sep 2007 11:44:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IaCad-0003Xk-LD for qemu-devel@nongnu.org; Tue, 25 Sep 2007 11:44:47 -0400 Received: from hall.aurel32.net ([88.191.38.19]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IaCad-0005sL-98 for qemu-devel@nongnu.org; Tue, 25 Sep 2007 11:44:47 -0400 Received: from aurel32 by hall.aurel32.net with local (Exim 4.63) (envelope-from ) id 1IaCaW-0005Gt-J0 for qemu-devel@nongnu.org; Tue, 25 Sep 2007 17:44:40 +0200 Date: Tue, 25 Sep 2007 17:44:40 +0200 From: Aurelien Jarno Message-ID: <20070925154440.GA19991@hall.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Sender: "aurel32,,," Subject: [Qemu-devel] [PATCH][MIPS] Wrap a few often used tests with unlikely() Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi all, The patch below wraps a few often used tests with unlikely() in the hope of small speed improvements. Cheers, Aurelien Index: target-mips/translate.c =================================================================== RCS file: /sources/qemu/qemu/target-mips/translate.c,v retrieving revision 1.102 diff -u -d -p -r1.102 translate.c --- target-mips/translate.c 25 Sep 2007 14:49:47 -0000 1.102 +++ target-mips/translate.c 25 Sep 2007 15:41:17 -0000 @@ -733,19 +733,19 @@ static inline void generate_exception (D static inline void check_cp0_enabled(DisasContext *ctx) { - if (!(ctx->hflags & MIPS_HFLAG_CP0)) + if (unlikely(!(ctx->hflags & MIPS_HFLAG_CP0))) generate_exception_err(ctx, EXCP_CpU, 1); } static inline void check_cp1_enabled(DisasContext *ctx) { - if (!(ctx->hflags & MIPS_HFLAG_FPU)) + if (unlikely(!(ctx->hflags & MIPS_HFLAG_FPU))) generate_exception_err(ctx, EXCP_CpU, 1); } static inline void check_cp1_64bitmode(DisasContext *ctx) { - if (!(ctx->hflags & MIPS_HFLAG_F64)) + if (unlikely(!(ctx->hflags & MIPS_HFLAG_F64))) generate_exception(ctx, EXCP_RI); } @@ -762,7 +762,7 @@ static inline void check_cp1_64bitmode(D */ void check_cp1_registers(DisasContext *ctx, int regs) { - if (!(ctx->hflags & MIPS_HFLAG_F64) && (regs & 1)) + if (unlikely(!(ctx->hflags & MIPS_HFLAG_F64) && (regs & 1))) generate_exception(ctx, EXCP_RI); } @@ -778,7 +778,7 @@ static inline void check_insn(CPUState * CPU is not MIPS MT capable. */ static inline void check_mips_mt(CPUState *env, DisasContext *ctx) { - if (!(env->CP0_Config3 & (1 << CP0C3_MT))) + if (unlikely(!(env->CP0_Config3 & (1 << CP0C3_MT)))) generate_exception(ctx, EXCP_RI); } @@ -786,7 +786,7 @@ static inline void check_mips_mt(CPUStat instructions are not enabled. */ static inline void check_mips_64(DisasContext *ctx) { - if (!(ctx->hflags & MIPS_HFLAG_64)) + if (unlikely(!(ctx->hflags & MIPS_HFLAG_64))) generate_exception(ctx, EXCP_RI); } -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net