From patchwork Sun Oct 13 22:25:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 176087 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3787223ill; Sun, 13 Oct 2019 15:33:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfpMtK0ewbboW/a8q6FOkxcnEG41j3U2ERUH6YoiQccvZoqBOd2fL6f7aiH8KP9H25iH9C X-Received: by 2002:ae9:f714:: with SMTP id s20mr26748562qkg.262.1571006023282; Sun, 13 Oct 2019 15:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571006023; cv=none; d=google.com; s=arc-20160816; b=dDtTnjPsKvP0WgksA6WDZU7Lt/3I/KIaDHoX1LO0BWaDYGuVvOLyNOTjPBVVFOsGFV y6tqN6HDSYhGlNvWPN8axJWunpUr9ULcub4El8jekq2yBupfckC0Azhem1AdgzHgfN5e RYb1bDfZ43O7HNAhemedFk5CROwjbvhFHdyPtMPM18rCrvW3JdvXazOq0YbeYEFdRaCV aH6zgGzT41/2WbGAsUauJxRFnEEyz+Q5u74MaMDd4zd7iyJrAimT6zbsov1lbyFdtPAS 8wHe8V/3veIjWAE4c8iF4PMZXjRV+kQlTrSaqBvqSMnjwR4S3OxeXiOG/u+sVoeLzFdI nIeQ== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=Ca0/JTgWp5vQ6VZt3FKmDT0cq5/Y2RTYUY9dPjXj27o=; b=dFE9qWue7dREVj3AcOyD0w+Rh5suWUipe5FjCsbblXwkixYKwnyrrznodmQzbKjNZM G0n+nmEFjWyn+HRZzVk4DBp1LJT7f29zBX+RBgd+RReu0qsiITpOrQmKIjOyZQGnKl/6 xPR0J2frEQsMX7LuPIA/PW2wT9wURl9aLniFc8avVVVXV9PFca9XdO6WxvCoS4gv2/4n fAZzetZWirRagp+BjjtOMgNUAshY0BWdv2C6HPC4pSlVZ7qw2bFPqBmsXcT/2HrRUUNh ctL9VKRBrJ4p+LSsnR02JrRZYQk0KTDFjsJtNnSDNuGZW1z0D3vIj7fsN2fXMJMxgxUX 4kcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xhd4QTC0; 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=pass (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 r53si17321003qtb.284.2019.10.13.15.33.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Oct 2019 15:33:43 -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=pass header.i=@linaro.org header.s=google header.b=xhd4QTC0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmQo-0005h3-9V for patch@linaro.org; Sun, 13 Oct 2019 18:33:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51410) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmJl-00076G-0g for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJmJj-00018k-8R for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:24 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:41187) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJmJf-000142-EO for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:21 -0400 Received: by mail-pf1-x42c.google.com with SMTP id q7so9250227pfh.8 for ; Sun, 13 Oct 2019 15:26:15 -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=Ca0/JTgWp5vQ6VZt3FKmDT0cq5/Y2RTYUY9dPjXj27o=; b=xhd4QTC0KxQKaY5XSiafEMKIyaoyuwS1rh5ZG+mO98TROVit5Ta3pw5RUU9Qywr1IO 6LBwD1R+8Ay8RCgoy/pRWOUZn/QckUhaDQZ7r+gy2bs+5or3MVx7rRV5vuoprSA5Qj35 2CcsNMCwL1TiS70Lct9ywaRUPa2Ati9hoaxMvxC5eagNU3ej0Zunx4glcs8Kll1M34up Shtev8jNmXUVwN/xyaRU8dcHFKLfCeUf0nd14rr3l+1zEn8A9sDg9TxCvTalBXpbacTh EdO/qXKn77Yynr+uQ5cP4EuCV/EX7210pTvY+yHEo5QjIheiqhDgnv+aYeq7hHR/MQ5M EwrQ== 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=Ca0/JTgWp5vQ6VZt3FKmDT0cq5/Y2RTYUY9dPjXj27o=; b=j2O7Da9hWa1Gb4RNvVIEwuTMS0XmMWdoSEOWga3N/bf27NrcBhv2PEnLErqH4dcILE sagFkyJVGlUA++3nM9hmJat3969rAKk/CDNcCjqO4vJ/c0VzCjVkY+4SuPdS96bOKTFP FHdPQup7Ml1SUmXl0x/HtcrPjoz75xAa/VFbGKc3Ubd5I/sU845JAPb4J7BRbwIUkgRE n7AV/Qnx3eVEmySg5g82NcUIt5fx4BDl28/+XWOjmmMT+V92EurKHMU75imRU7gRmA7l xOPjAcegM+H+PjYYv5C8+jvnjqAioR5tXCPXh95dyLzV+51MixBtwtgdOb8IyzH409RY IUcg== X-Gm-Message-State: APjAAAWNG7vCY3r5mvWQNGVa4jeFs92OH5ZRLrTU+By5QJ5LIik/0GVv VaX4wW8Okglq1c8t+cqgsqbIbYJx26w= X-Received: by 2002:a63:1e59:: with SMTP id p25mr29501986pgm.361.1571005574041; Sun, 13 Oct 2019 15:26:14 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id d76sm15940571pfd.185.2019.10.13.15.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 15:26:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 21/23] tcg/ppc: Update vector support for v3.00 load/store Date: Sun, 13 Oct 2019 15:25:42 -0700 Message-Id: <20191013222544.3679-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191013222544.3679-1-richard.henderson@linaro.org> References: <20191013222544.3679-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::42c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" These new instructions are a mix of those like LXSD that are only conditional only on MSR.VEC and those like LXV that are conditional on MSR.VEC for TX=1. Thus, in the end, we can consider all of these as Altivec instructions. Reviewed-by: Aleksandar Markovic Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.inc.c | 47 ++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index bd9259c60f..5b7d1bd2dc 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -471,11 +471,16 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, #define LXSDX (XO31(588) | 1) /* v2.06, force tx=1 */ #define LXVDSX (XO31(332) | 1) /* v2.06, force tx=1 */ #define LXSIWZX (XO31(12) | 1) /* v2.07, force tx=1 */ +#define LXV (OPCD(61) | 8 | 1) /* v3.00, force tx=1 */ +#define LXSD (OPCD(57) | 2) /* v3.00 */ +#define LXVWSX (XO31(364) | 1) /* v3.00, force tx=1 */ #define STVX XO31(231) #define STVEWX XO31(199) #define STXSDX (XO31(716) | 1) /* v2.06, force sx=1 */ #define STXSIWX (XO31(140) | 1) /* v2.07, force sx=1 */ +#define STXV (OPCD(61) | 8 | 5) /* v3.00, force sx=1 */ +#define STXSD (OPCD(61) | 2) /* v3.00 */ #define VADDSBS VX4(768) #define VADDUBS VX4(512) @@ -1114,7 +1119,7 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, TCGReg base, tcg_target_long offset) { tcg_target_long orig = offset, l0, l1, extra = 0, align = 0; - bool is_store = false; + bool is_int_store = false; TCGReg rs = TCG_REG_TMP1; switch (opi) { @@ -1127,11 +1132,19 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, break; } break; + case LXSD: + case STXSD: + align = 3; + break; + case LXV: + case STXV: + align = 15; + break; case STD: align = 3; /* FALLTHRU */ case STB: case STH: case STW: - is_store = true; + is_int_store = true; break; } @@ -1140,7 +1153,7 @@ static void tcg_out_mem_long(TCGContext *s, int opi, int opx, TCGReg rt, if (rs == base) { rs = TCG_REG_R0; } - tcg_debug_assert(!is_store || rs != rt); + tcg_debug_assert(!is_int_store || rs != rt); tcg_out_movi(s, TCG_TYPE_PTR, rs, orig); tcg_out32(s, opx | TAB(rt & 31, base, rs)); return; @@ -1205,7 +1218,8 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, case TCG_TYPE_V64: tcg_debug_assert(ret >= TCG_REG_V0); if (have_vsx) { - tcg_out_mem_long(s, 0, LXSDX, ret, base, offset); + tcg_out_mem_long(s, have_isa_3_00 ? LXSD : 0, LXSDX, + ret, base, offset); break; } tcg_debug_assert((offset & 7) == 0); @@ -1217,7 +1231,8 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, case TCG_TYPE_V128: tcg_debug_assert(ret >= TCG_REG_V0); tcg_debug_assert((offset & 15) == 0); - tcg_out_mem_long(s, 0, LVX, ret, base, offset); + tcg_out_mem_long(s, have_isa_3_00 ? LXV : 0, + LVX, ret, base, offset); break; default: g_assert_not_reached(); @@ -1258,7 +1273,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, case TCG_TYPE_V64: tcg_debug_assert(arg >= TCG_REG_V0); if (have_vsx) { - tcg_out_mem_long(s, 0, STXSDX, arg, base, offset); + tcg_out_mem_long(s, have_isa_3_00 ? STXSD : 0, + STXSDX, arg, base, offset); break; } tcg_debug_assert((offset & 7) == 0); @@ -1271,7 +1287,8 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, break; case TCG_TYPE_V128: tcg_debug_assert(arg >= TCG_REG_V0); - tcg_out_mem_long(s, 0, STVX, arg, base, offset); + tcg_out_mem_long(s, have_isa_3_00 ? STXV : 0, + STVX, arg, base, offset); break; default: g_assert_not_reached(); @@ -3042,7 +3059,11 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_debug_assert(out >= TCG_REG_V0); switch (vece) { case MO_8: - tcg_out_mem_long(s, 0, LVEBX, out, base, offset); + if (have_isa_3_00) { + tcg_out_mem_long(s, LXV, LVX, out, base, offset & -16); + } else { + tcg_out_mem_long(s, 0, LVEBX, out, base, offset); + } elt = extract32(offset, 0, 4); #ifndef HOST_WORDS_BIGENDIAN elt ^= 15; @@ -3051,7 +3072,11 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, break; case MO_16: tcg_debug_assert((offset & 1) == 0); - tcg_out_mem_long(s, 0, LVEHX, out, base, offset); + if (have_isa_3_00) { + tcg_out_mem_long(s, LXV | 8, LVX, out, base, offset & -16); + } else { + tcg_out_mem_long(s, 0, LVEHX, out, base, offset); + } elt = extract32(offset, 1, 3); #ifndef HOST_WORDS_BIGENDIAN elt ^= 7; @@ -3059,6 +3084,10 @@ static bool tcg_out_dupm_vec(TCGContext *s, TCGType type, unsigned vece, tcg_out32(s, VSPLTH | VRT(out) | VRB(out) | (elt << 16)); break; case MO_32: + if (have_isa_3_00) { + tcg_out_mem_long(s, 0, LXVWSX, out, base, offset); + break; + } tcg_debug_assert((offset & 3) == 0); tcg_out_mem_long(s, 0, LVEWX, out, base, offset); elt = extract32(offset, 2, 2);