From patchwork Wed May 22 22:28:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164901 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1410945ili; Wed, 22 May 2019 15:28:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+/8ytrYGY6lSluIkoT6+srQgL624jP3BKMu7IumKFgWfSYISh7gm7OPp9dlYpmUAhR7Jb X-Received: by 2002:a17:906:1fc4:: with SMTP id e4mr53832260ejt.81.1558564130569; Wed, 22 May 2019 15:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558564130; cv=none; d=google.com; s=arc-20160816; b=YuIW4PEALbJdGm5pwNxgEOSsXfbm0wqwAe45c8+XelyIUux3V5Y0MCH64VTkBsai4f H1/x6W9xi7INsJiwg+3ZZS0+zsaKLUZigrr9PX9BjSrZbLpZ9qUdKJH3Cg+fOQcoHaMn KQmTeqdvo+BuZqj2hadyVlnBvxPSOw7UdMWv5hdtlpcAwKrbt4iFrLk4LEbBy16Rc6JE GCZ4+W1qKWsrX8ng2ukkpT5K/C3m8DJ/ET8HXRPRNjmByZJTilB7KIxpPnutiqSQJxCK lMMYb5GEeyx+xZH8H7//mIX6NNNtpial2zHNmQ8SHpmrjgCXCt12tkYo6xKu59zrFpiT QsTA== 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; bh=CNtLSsppNDq+qCEdta/UyzFB0xSoIc+vMFY+eO0LpIo=; b=m74Y3dKn6UKsQJ5DCAi+6Kh1y8zyJ2KKNvIKUIHPL6u8aOoCLauZhzNtEq2OtineJH q9n9YX4Mgx8QgD+cwjIy3UCbuSlkdnvDUMIGsvuIGkwW/5hqt0kgY+e1iVV520M5jfNd l8t8dMcjgDg87F7BRQU/Ud1i/qCiQBDU1Ky95bf3QcIDvaBsPdvjBh6pv4k7BvnPN1Cl lg5gTGtVjnyXkKyA22OCQ0zK7iS6lJwv1Gro7IFNDDnjB1UAO6yfoBjKof6EU32BpM4L 5R6+QJpuMzq8KaetLP9UneXFzUY7tfkAX7/GNSXGqtAjZSlh1scVLQW2S0SEYBoyA4Sv TgGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BJO33EC3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id l11si14739124eja.122.2019.05.22.15.28.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2019 15:28:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BJO33EC3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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 ([127.0.0.1]:52488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZj7-0002w3-Gq for patch@linaro.org; Wed, 22 May 2019 18:28:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTZin-0002vp-Pu for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTZil-0007Ie-T1 for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:29 -0400 Received: from mail-yb1-xb44.google.com ([2607:f8b0:4864:20::b44]:43922) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTZil-0007Hc-Ot for qemu-devel@nongnu.org; Wed, 22 May 2019 18:28:27 -0400 Received: by mail-yb1-xb44.google.com with SMTP id n145so1485153ybg.10 for ; Wed, 22 May 2019 15:28:26 -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=CNtLSsppNDq+qCEdta/UyzFB0xSoIc+vMFY+eO0LpIo=; b=BJO33EC3dc+1GlCW3R0VHfkl3T4pzUvt5KRIQuUjBCwhbwXo0iMvXjFAhgTdIAPYaF iCP5cM2ErgGDzfSPCuql6BCogt4SihuPMab9OcKsH/e/4xRJBviFAiqnmqoJnl9ycvij IUF4Sl4SoIgb5/3+dIsOif1M0USHSG9WJghQ812MOIM1zrnv3M1rV1oaweaWKZsg8h64 26kqeMZz0lkOzAQcBGoacwlEl8osbKt1Tteb02wKhxFDOX4ul6vuAB3GadXpVsukf622 P937WRO3K6VIMRkYjUQBH2HwL/ql+svqA0FtL5Gsnnrs7o0P0Z8OIkV58UdITMCkhcuB 7adg== 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=CNtLSsppNDq+qCEdta/UyzFB0xSoIc+vMFY+eO0LpIo=; b=VYRxOYD5a1vOm0HvrxYtVowalhJpckG6frd+XN+GVw8ZZb7VbKhKacfh72d4B34dSD EpHJcOD+SpAPQT5nOWw6XVfbZ3EZnDkAB643gxNrDJXpoL0eFzMwmUqMw1vOPTfg3xJe eqRMHhrSq9Y0aHHM5kbSxwLYTujTodAwzssyOY0crjfinjumVyne9YfVkaXgid0+vbUR m9T7LGazSgti3cXbvwmsXGx3FghMydB5A8vWzlqZGK6k5wSG//qLZrt+zejxIGtYQ05S /YJBwN3f2+cGeakut20ej/inXH8iwnGQ1vn4t1eK5DEWfaC86J7EJQ9ANMdC/8Qc65Pt K0kQ== X-Gm-Message-State: APjAAAVDHkmaG3vDsGRSlKD3B/Rvmol9BXRkB1ifWvD2jIfrQ3cAIvlH ufcuw0Gt34/MOaYY9Yeg8ccGeRk+WwI= X-Received: by 2002:a25:e04d:: with SMTP id x74mr17250123ybg.511.1558564105372; Wed, 22 May 2019 15:28:25 -0700 (PDT) Received: from localhost.localdomain ([71.46.56.17]) by smtp.gmail.com with ESMTPSA id q11sm2276453ywg.7.2019.05.22.15.28.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 May 2019 15:28:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 22 May 2019 18:28:06 -0400 Message-Id: <20190522222821.23850-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190522222821.23850-1-richard.henderson@linaro.org> References: <20190522222821.23850-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b44 Subject: [Qemu-devel] [PULL 01/16] tcg/i386: Fix dupi/dupm for avx1 and 32-bit hosts 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The VBROADCASTSD instruction only allows %ymm registers as destination. Rather than forcing VEX.L and writing to the entire 256-bit register, revert to using MOVDDUP with an %xmm register. This is sufficient for an avx1 host since we do not support TCG_TYPE_V256 for that case. Also fix the 32-bit avx2, which should have used VPBROADCASTW. Fixes: 1e262b49b533 Tested-by: Mark Cave-Ayland Reported-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.inc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index aafd01cb49..b3601446cd 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -358,6 +358,7 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type, #define OPC_MOVBE_MyGy (0xf1 | P_EXT38) #define OPC_MOVD_VyEy (0x6e | P_EXT | P_DATA16) #define OPC_MOVD_EyVy (0x7e | P_EXT | P_DATA16) +#define OPC_MOVDDUP (0x12 | P_EXT | P_SIMDF2) #define OPC_MOVDQA_VxWx (0x6f | P_EXT | P_DATA16) #define OPC_MOVDQA_WxVx (0x7f | P_EXT | P_DATA16) #define OPC_MOVDQU_VxWx (0x6f | P_EXT | P_SIMDF3) @@ -921,7 +922,7 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, } else { switch (vece) { case MO_64: - tcg_out_vex_modrm_offset(s, OPC_VBROADCASTSD, r, 0, base, offset); + tcg_out_vex_modrm_offset(s, OPC_MOVDDUP, r, 0, base, offset); break; case MO_32: tcg_out_vex_modrm_offset(s, OPC_VBROADCASTSS, r, 0, base, offset); @@ -963,12 +964,12 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, } else if (have_avx2) { tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTQ + vex_l, ret); } else { - tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSD, ret); + tcg_out_vex_modrm_pool(s, OPC_MOVDDUP, ret); } new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); } else { if (have_avx2) { - tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSD + vex_l, ret); + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); } else { tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); }