From patchwork Thu Jan 24 04:03:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 215203 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5B3FE2C007C for ; Thu, 24 Jan 2013 15:21:52 +1100 (EST) Received: from localhost ([::1]:50464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyEJy-00049a-G0 for incoming@patchwork.ozlabs.org; Wed, 23 Jan 2013 23:21:50 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyEJa-0003GE-0E for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:21:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyE3m-0004e2-OS for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:05:11 -0500 Received: from mail-da0-f48.google.com ([209.85.210.48]:62779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyE3m-0004cm-GP for qemu-devel@nongnu.org; Wed, 23 Jan 2013 23:05:06 -0500 Received: by mail-da0-f48.google.com with SMTP id k18so4052125dae.21 for ; Wed, 23 Jan 2013 20:05:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=toO77Ifi3JoYziAg7KrhUIpjv1Yz5b/EkVtx2jadXHo=; b=dgI1X+SG113aQIXGfwjoZoTgsa5Ol+oB5m1X/HAwLw/pF3wtmGXAXLZ0Wf4HRTGVhD DhAuVjGxY2BkS9/2jAhWoXBIVfgnLOzEsVSTFhziOQGsDfqpr4TyDd6/A4XHN8od4ZsM 0g+Exm4UI0hXeM0sMcaHTCmxQUPzrnNeSWx/CSmhcmn905NjJ/qgaP+gBtph5IcbpoGE br3yNjQK2MsxfKFub533E/6KpjmPCTWTJaYBUB8CvFoRQfqPfykGD+Uw88Kc42gVDHaE 6hq8/APqGrtsVP9i7h0Nmzwl9/1GEbxYK0ZBiWA9yZIwDakrCTqfx2+ARUf0mzdXNkgq sSQA== X-Received: by 10.66.84.10 with SMTP id u10mr1449054pay.24.1359000305776; Wed, 23 Jan 2013 20:05:05 -0800 (PST) Received: from anchor.twiddle.home (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPS id ot3sm14027480pbb.38.2013.01.23.20.05.04 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Jan 2013 20:05:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 23 Jan 2013 20:03:33 -0800 Message-Id: <1359000221-19834-50-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359000221-19834-1-git-send-email-rth@twiddle.net> References: <1359000221-19834-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.48 Cc: Blue Swirl , Paolo Bonzini Subject: [Qemu-devel] [PATCH 49/57] target-i386: Implement BZHI 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 Signed-off-by: Richard Henderson --- target-i386/translate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/target-i386/translate.c b/target-i386/translate.c index d68537c..46e7b24 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -4072,6 +4072,33 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, } break; + case 0x0f5: /* bzhi Gy, Ey, By */ + if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) + || !(s->prefix & PREFIX_VEX) + || s->vex_l != 0) { + goto illegal_op; + } + ot = s->dflag == 2 ? OT_QUAD : OT_LONG; + gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); + tcg_gen_ext8u_tl(cpu_T[1], cpu_regs[s->vex_v]); + { + TCGv bound = tcg_const_tl(ot == OT_QUAD ? 63 : 31); + /* Note that since we're using BMILG (in order to get O + cleared) we need to store the inverse into C. */ + tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src, + cpu_T[1], bound); + tcg_gen_movcond_tl(TCG_COND_GT, cpu_T[1], cpu_T[1], + bound, bound, cpu_T[1]); + tcg_temp_free(bound); + } + tcg_gen_movi_tl(cpu_A0, -1); + tcg_gen_shl_tl(cpu_A0, cpu_A0, cpu_T[1]); + tcg_gen_andc_tl(cpu_T[0], cpu_T[0], cpu_A0); + gen_op_mov_reg_T0(ot, reg); + gen_op_update1_cc(); + set_cc_op(s, CC_OP_BMILGB + ot); + break; + case 0x0f3: case 0x1f3: case 0x2f3: