From patchwork Thu Oct 26 10:50:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117196 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp610905qgn; Thu, 26 Oct 2017 03:54:44 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qfbfk818103BDBHsm7GcoTZuYywEQxgI4UvBrI/7kgeIkTQDZNVvegc4gEUqltl0BV6KeG X-Received: by 10.37.129.73 with SMTP id j9mr2999529ybm.204.1509015283945; Thu, 26 Oct 2017 03:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509015283; cv=none; d=google.com; s=arc-20160816; b=Wlm+FzagCEr79w9QXNZQ8Q/SdM48RWuuXv9ZhxWkPTcB9DkR3+U24hX0RuZwo7PbIC cWnYgFbRVwNZGa+dYLuqEx2nkI0afMsGdgPbhP5XGHlxD1Otib+oNL5d6oBGOlgYSLn3 jlrn5L9GGgS7fzJYY/3rY8WV8oD0q77DWpr6cV2bKcuLS9iyl4VORQUgXm5pi4r2+VBe BKk3m+t2YOdPIDSJbF68KdaaQIQo8mUXGWe3qNvmzTPVMar6aBBymldxumPElhP2pCku 21oFQe8oMMm4RGcboQkuBUVBClT72n2emkFsnFRcRY4zN1BFhZWjK1Nk0zzat6sAiNJi EmgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=JN2AyJCk5mT/ku4Ut7yvcJVUiHrhygGV3xXVcJrmdvI=; b=x8zdlfTKaqNWvrLOvFnII6S2aJMxYF5tmpCqWRUtB7JWCeLIgrh/RMm2Z4vjeRwVn1 ycZ8UsrOO/Sy/lTeuwS/QjLCT2rPJJXSF/gtiCNUDwpFtOsvkkFwtn43s3AjtewinUEk 7vj9ER2VxTVFjRPyvieKicoHZit/62sZljc3lIGOwcB0yDdB8UX5ZkRGPJ6xT5zY/+w0 1t30ue+Ptri63PmMRb3F+edkB26l3/KdxXUfr7UwksO9Vc9IycVhFNDVEAxu4tYO+osn qsIyN9grkuqj0/Pcf2dyx240CpAUCS543aklXBPDftKpdyVkahiDvnZZ42rXhuuaVS4Z Cq7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MNTk6lbn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f20si747508ybh.533.2017.10.26.03.54.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 26 Oct 2017 03:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=MNTk6lbn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7foB-0002Dv-FN for patch@linaro.org; Thu, 26 Oct 2017 06:54:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7fjz-0007rx-4e for qemu-devel@nongnu.org; Thu, 26 Oct 2017 06:50:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7fjt-0002kW-3K for qemu-devel@nongnu.org; Thu, 26 Oct 2017 06:50:23 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:51912) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7fjs-0002k1-SJ for qemu-devel@nongnu.org; Thu, 26 Oct 2017 06:50:17 -0400 Received: by mail-wr0-x242.google.com with SMTP id j15so2718646wre.8 for ; Thu, 26 Oct 2017 03:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JN2AyJCk5mT/ku4Ut7yvcJVUiHrhygGV3xXVcJrmdvI=; b=MNTk6lbnyVJTUHqI5MlVOEQIYRXI5o2n5kX/sCWj+HSwpvYbFmwUE3vBBN+G/pXbSp Yd19onl7iQ6GG2IMbmSU/sFeUodlqP9r0+VrnOOSdW4EC+ids/7RmdtYpoTo/c5NAKsN Wxf/vFpcZ1alZSqwFnAXl2ig6SijVDxZRNs2w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JN2AyJCk5mT/ku4Ut7yvcJVUiHrhygGV3xXVcJrmdvI=; b=soUDr/+HtnJlFiY9Sg1d2Hm0mFqCcQJxsa+BUFPV8kxCceor8krMNsL847aZtHEvhQ O7w5itghNjhrahTJSSD8M9sMROQpenU5BwbE0oWhgQpoVFYbu3aIqy+TKVLsbyvChbqC s7MYkaux8MnhF33pZOoRrQFqwpDhuAFzlGrsWP9BediM19tRFEmCBPG8duUu+eaqxkT0 OZBxkgb3VE8fMqvllosABn3gygocM1Wnqr7zCN8CGpHcNzTZA3sgUBjUl11EwYOyi0+4 CScTUSWaKLUtcAyhJ8iANKkjnp4XlRZLfd6TWxcicSYwvQJs8B9M/n/zGezetaD/dY9U nQTA== X-Gm-Message-State: AMCzsaW/yQEti+Ek/nvjv5vC2R9kV3PMoW0ojowWYx1urpxruVqvhJht Tgv4awvYclyaCeF4YzhxmmIvClysoag= X-Received: by 10.223.139.10 with SMTP id n10mr5239586wra.156.1509015015586; Thu, 26 Oct 2017 03:50:15 -0700 (PDT) Received: from cloudburst.twiddle.net ([62.168.35.124]) by smtp.gmail.com with ESMTPSA id p128sm924484wmb.1.2017.10.26.03.50.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Oct 2017 03:50:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 12:50:07 +0200 Message-Id: <20171026105007.31777-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026105007.31777-1-richard.henderson@linaro.org> References: <20171026105007.31777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH v2 4/4] target/i386: Fix ANDN (bmi) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Richard Henderson , ehabkost@redhat.com, Ricardo Ribalda Delgado Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Ricardo Ribalda Delgado Operands on ANDN are swapped. Tested with the following function: long test_andn(long v1, long v2){ return (~v1 & v2); } Compiled with: gcc kk.c -mbmi -O3 -Wall 0000000000000910 : 910:c4 e2 c0 f2 c6 andn %rsi,%rdi,%rax 915:c3 retq 916:66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) 91d:00 00 00 and gcc kk.c -march=native -O3 -Wall 0000000000000930 : 930: 48 f7 d7 not %rdi 933: 48 89 f8 mov %rdi,%rax 936: 48 21 f0 and %rsi,%rax 939: c3 retq 93a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) The test showed than -mbmi version behaved differently than the -march native version. Signed-off-by: Ricardo Ribalda Delgado Message-Id: <20170713215137.5307-1-ricardo.ribalda@gmail.com> Signed-off-by: Richard Henderson --- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.13.6 diff --git a/target/i386/translate.c b/target/i386/translate.c index dd464b98b0..96cd04c6de 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -3810,7 +3810,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); - tcg_gen_andc_tl(cpu_T0, cpu_regs[s->vex_v], cpu_T0); + tcg_gen_andc_tl(cpu_T0, cpu_T0, cpu_regs[s->vex_v]); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot);