From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KgFkV-0007LK-IJ for qemu-devel@nongnu.org; Thu, 18 Sep 2008 05:24:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KgFkU-0007Ka-33 for qemu-devel@nongnu.org; Thu, 18 Sep 2008 05:24:30 -0400 Received: from [199.232.76.173] (port=54737 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KgFkT-0007KB-F6 for qemu-devel@nongnu.org; Thu, 18 Sep 2008 05:24:29 -0400 Received: from savannah.gnu.org ([199.232.41.3]:54818 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KgFkT-0007nw-0B for qemu-devel@nongnu.org; Thu, 18 Sep 2008 05:24:29 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KgFkQ-0004Lh-64 for qemu-devel@nongnu.org; Thu, 18 Sep 2008 09:24:26 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KgFkP-0004Ld-Pm for qemu-devel@nongnu.org; Thu, 18 Sep 2008 09:24:26 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Thu, 18 Sep 2008 09:24:25 +0000 Subject: [Qemu-devel] [5249] target-alpha: convert cmp* instructions to TCG 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 Revision: 5249 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5249 Author: aurel32 Date: 2008-09-18 09:24:25 +0000 (Thu, 18 Sep 2008) Log Message: ----------- target-alpha: convert cmp* instructions to TCG Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/target-alpha/op.c trunk/target-alpha/translate.c Modified: trunk/target-alpha/op.c =================================================================== --- trunk/target-alpha/op.c 2008-09-18 09:17:13 UTC (rev 5248) +++ trunk/target-alpha/op.c 2008-09-18 09:24:25 UTC (rev 5249) @@ -208,51 +208,6 @@ } /* Tests */ -void OPPROTO op_cmpult (void) -{ - if (T0 < T1) - T0 = 1; - else - T0 = 0; - RETURN(); -} - -void OPPROTO op_cmpule (void) -{ - if (T0 <= T1) - T0 = 1; - else - T0 = 0; - RETURN(); -} - -void OPPROTO op_cmpeq (void) -{ - if (T0 == T1) - T0 = 1; - else - T0 = 0; - RETURN(); -} - -void OPPROTO op_cmplt (void) -{ - if ((int64_t)T0 < (int64_t)T1) - T0 = 1; - else - T0 = 0; - RETURN(); -} - -void OPPROTO op_cmple (void) -{ - if ((int64_t)T0 <= (int64_t)T1) - T0 = 1; - else - T0 = 0; - RETURN(); -} - void OPPROTO op_cmpbge (void) { helper_cmpbge(); Modified: trunk/target-alpha/translate.c =================================================================== --- trunk/target-alpha/translate.c 2008-09-18 09:17:13 UTC (rev 5248) +++ trunk/target-alpha/translate.c 2008-09-18 09:24:25 UTC (rev 5249) @@ -561,6 +561,38 @@ tcg_gen_movi_i64(cpu_ir[rc], 0); } +static always_inline void gen_cmp(TCGCond cond, + int ra, int rb, int rc, + int islit, int8_t lit) +{ + int l1, l2; + TCGv tmp; + + if (unlikely(rc == 31)) + return; + + l1 = gen_new_label(); + l2 = gen_new_label(); + + if (ra != 31) { + tmp = tcg_temp_new(TCG_TYPE_I64); + tcg_gen_mov_i64(tmp, cpu_ir[ra]); + } else + tmp = tcg_const_i64(0); + if (islit) + tcg_gen_brcondi_i64(cond, tmp, lit, l1); + else if (rb != 31) + tcg_gen_brcond_i64(cond, tmp, cpu_ir[rb], l1); + else + tcg_gen_brcondi_i64(cond, tmp, 0, l1); + + tcg_gen_movi_i64(cpu_ir[rc], 0); + tcg_gen_br(l2); + gen_set_label(l1); + tcg_gen_movi_i64(cpu_ir[rc], 1); + gen_set_label(l2); +} + static always_inline int translate_one (DisasContext *ctx, uint32_t insn) { uint32_t palcode; @@ -848,7 +880,7 @@ break; case 0x1D: /* CMPULT */ - gen_arith3(ctx, &gen_op_cmpult, ra, rb, rc, islit, lit); + gen_cmp(TCG_COND_LTU, ra, rb, rc, islit, lit); break; case 0x20: /* ADDQ */ @@ -940,7 +972,7 @@ break; case 0x2D: /* CMPEQ */ - gen_arith3(ctx, &gen_op_cmpeq, ra, rb, rc, islit, lit); + gen_cmp(TCG_COND_EQ, ra, rb, rc, islit, lit); break; case 0x32: /* S8ADDQ */ @@ -992,7 +1024,7 @@ break; case 0x3D: /* CMPULE */ - gen_arith3(ctx, &gen_op_cmpule, ra, rb, rc, islit, lit); + gen_cmp(TCG_COND_LEU, ra, rb, rc, islit, lit); break; case 0x40: /* ADDL/V */ @@ -1004,7 +1036,7 @@ break; case 0x4D: /* CMPLT */ - gen_arith3(ctx, &gen_op_cmplt, ra, rb, rc, islit, lit); + gen_cmp(TCG_COND_LT, ra, rb, rc, islit, lit); break; case 0x60: /* ADDQ/V */ @@ -1016,7 +1048,7 @@ break; case 0x6D: /* CMPLE */ - gen_arith3(ctx, &gen_op_cmple, ra, rb, rc, islit, lit); + gen_cmp(TCG_COND_LE, ra, rb, rc, islit, lit); break; default: goto invalid_opc;