From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRSVo-0006Zk-Dm for qemu-devel@nongnu.org; Mon, 17 Aug 2015 18:04:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZRSVm-0004Oj-Qo for qemu-devel@nongnu.org; Mon, 17 Aug 2015 18:04:12 -0400 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:36239) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZRSVm-0004OW-NS for qemu-devel@nongnu.org; Mon, 17 Aug 2015 18:04:10 -0400 Received: by qkdv3 with SMTP id v3so51704822qkd.3 for ; Mon, 17 Aug 2015 15:04:10 -0700 (PDT) Received: from bigtime.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id b47sm7450056qge.44.2015.08.17.15.04.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 15:04:10 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Mon, 17 Aug 2015 15:03:35 -0700 Message-Id: <1439849015-11127-3-git-send-email-rth@twiddle.net> In-Reply-To: <1439849015-11127-1-git-send-email-rth@twiddle.net> References: <1439849015-11127-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 2/2] target-alpha: Special case cmpbge with zero List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@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 | 13 +++++++++++++ target-alpha/translate.c | 7 ++++++- 3 files changed, 20 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..900a7c6 100644 --- a/target-alpha/int_helper.c +++ b/target-alpha/int_helper.c @@ -58,6 +58,19 @@ uint64_t helper_zap(uint64_t val, uint64_t mask) return helper_zapnot(val, ~mask); } +uint64_t helper_cmpbe0(uint64_t a) +{ + uint64_t c = (a - 0x0101010101010101ULL) & ~a & 0x8080808080808080ULL; + /* 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 */ -- 2.4.3