From patchwork Wed Sep 2 19:58:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 513647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 873061401E7 for ; Thu, 3 Sep 2015 05:59:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Tr4/C/4v; dkim-atps=neutral Received: from localhost ([::1]:41063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXEC8-0007Ov-QV for incoming@patchwork.ozlabs.org; Wed, 02 Sep 2015 15:59:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXEBL-0005r3-Vq for qemu-devel@nongnu.org; Wed, 02 Sep 2015 15:58:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXEBJ-0000Aw-SX for qemu-devel@nongnu.org; Wed, 02 Sep 2015 15:58:55 -0400 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]:35234) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXEBJ-0000Ag-LW for qemu-devel@nongnu.org; Wed, 02 Sep 2015 15:58:53 -0400 Received: by pacfv12 with SMTP id fv12so21738273pac.2 for ; Wed, 02 Sep 2015 12:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=IdqbEAlsISzFH51No44Mo1U3vLcAWbDzMNBAxgikkyc=; b=Tr4/C/4vh4xo6J0YTlfeu7fHLPcM6XiZOeRO4FPtCuet5rYVX89IlNCjUBhuUJmOda QQlC869+PeSiSlUzc/Xqq2HKX1YRtcoCaR2OsaaS7TjDQBPvCCvgFqBpooIbfx+nqXyn Z0IEwxOJF952NOcaCY8bFlTQVlFK78cQk31hzHhS8bzDszXKvp+zCOTHVc4PKCsGNxJE 0b7n5Tn2j7jyScVT6kkXJZzsWkK8XJ1Yv7dML8R8gV6148oe3X9yQxWIdWMxjA72Lx2I n88/njKo0YQLpME8V92q++72nhqYxf3PyelweHqnZUELXgmPIy99X253dO4SA3rWZpTl cMJA== X-Received: by 10.68.65.104 with SMTP id w8mr48186440pbs.48.1441223932956; Wed, 02 Sep 2015 12:58:52 -0700 (PDT) Received: from anchor.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id bc1sm21812554pbb.66.2015.09.02.12.58.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 12:58:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 2 Sep 2015 12:58:18 -0700 Message-Id: <1441223898-10475-3-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441223898-10475-1-git-send-email-rth@twiddle.net> References: <1441223898-10475-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::230 Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PULL 2/2] target-alpha: Special case cmpbge with zero X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Knowing the comparator is zero leads to a simpler operation. Signed-off-by: Richard Henderson --- target-alpha/helper.h | 1 + target-alpha/int_helper.c | 14 ++++++++++++++ target-alpha/translate.c | 7 ++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/target-alpha/helper.h b/target-alpha/helper.h index d221f0d..83cbe2a 100644 --- a/target-alpha/helper.h +++ b/target-alpha/helper.h @@ -10,6 +10,7 @@ DEF_HELPER_FLAGS_1(cttz, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(zap, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(zapnot, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_1(cmpbe0, TCG_CALL_NO_RWG_SE, i64, i64) DEF_HELPER_FLAGS_2(cmpbge, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(minub8, TCG_CALL_NO_RWG_SE, i64, i64, i64) diff --git a/target-alpha/int_helper.c b/target-alpha/int_helper.c index 4a6e955..d7f4774 100644 --- a/target-alpha/int_helper.c +++ b/target-alpha/int_helper.c @@ -58,6 +58,20 @@ uint64_t helper_zap(uint64_t val, uint64_t mask) return helper_zapnot(val, ~mask); } +uint64_t helper_cmpbe0(uint64_t a) +{ + uint64_t m = 0x7f7f7f7f7f7f7f7fULL; + uint64_t c = ~(((a & m) + m) | a | m); + /* a.......b.......c.......d.......e.......f.......g.......h....... */ + c |= c << 7; + /* ab......bc......cd......de......ef......fg......gh......h....... */ + c |= c << 14; + /* abcd....bcde....cdef....defg....efgh....fgh.....gh......h....... */ + c |= c << 28; + /* abcdefghbcdefgh.cdefgh..defgh...efgh....fgh.....gh......h....... */ + return c >> 56; +} + uint64_t helper_cmpbge(uint64_t a, uint64_t b) { uint64_t mask = 0x00ff00ff00ff00ffULL; diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 81d4ff8..b766ae3 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -1507,7 +1507,12 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) break; case 0x0F: /* CMPBGE */ - gen_helper_cmpbge(vc, va, vb); + if (ra == 31) { + /* Special case 0 >= X as X == 0. */ + gen_helper_cmpbe0(vc, vb); + } else { + gen_helper_cmpbge(vc, va, vb); + } break; case 0x12: /* S8ADDL */