From patchwork Sun Oct 13 22:25:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 176092 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3789665ill; Sun, 13 Oct 2019 15:37:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwz+nki+TM+fwyygaVCeIBwNb0SjVV6lrXclv1DgRYJ0KLkT4sOBWBXcs3eRgH8dwlbJ6SZ X-Received: by 2002:a50:eb95:: with SMTP id y21mr25731506edr.155.1571006222357; Sun, 13 Oct 2019 15:37:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571006222; cv=none; d=google.com; s=arc-20160816; b=RgrLCsIWgTBSkaxZ1OLlIeICSYsrduyQ50XsxNqhoDpqGjpb3T51OHQUwri68fXuTg oBwVHmdGB86Qu4Xp83osBFfkfKDN/MjH7r9EwW7WLeBYDh4khUUUbk0EzknYpAzHyIBd PCCdDtYtaykvwoy5PKlvEpZy3VDZ6lkOOeZHwcdeQF/Qk5pE5M1uPdqXmCBCnaJQjGb6 78jzr5g8kP8Y8rRWlzeYKWNTOOREkB4r2/Hx1lVeQ5o1BGiyZS+Lx6sqsNjeiNiu70v5 C7ojSQC5MmLtId8dz3KUJlMatG1YH2vxbdLYV3D5/q5EOv1mcz+HGy47f5zZv0zxIuJ+ 8PiA== 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=eQFl1TFXthP4AT6NgGUJRpsDofwtKBJ7n5fJYlO6V1Y=; b=Q8K5mlQixHf1n65QisOZvEPONKo2Z3JAK/bav82D5+ssn7X/vPhYL6ucwlQrP38YIP lQqr0z6PrJg0/nvOV7lmmQuws9a0bl0Y/VUlVkF8A+NOwb/+vhyoM8fRTduCwA2yU6qR ufzK+5u+yMBQqjBXqjgboneCV75vTGYXD88vzOV5V1/Q0EaquKceZxKAiZIRJKxs0AXL FLE6e9IiVy8H9kb6BSJguDjPzBkm6/T/4tCByQnIgz0S4/yiq2ZxIiuk9N+V6/CkU4WE 1/0Orp1EAbcLE9hDGszneQCke2q4Sl7RbNXmShuSsE3eFUC2XdueH5oCsWx0PSAHfIVy ntjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ra11ZBum; 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 g5si9876985ejp.350.2019.10.13.15.37.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Oct 2019 15:37:02 -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=ra11ZBum; 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]:43218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmU0-0000pE-Rd for patch@linaro.org; Sun, 13 Oct 2019 18:37:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51409) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJmJl-00076F-09 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-00018t-8x for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:24 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:35794) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJmJh-00014c-AG for qemu-devel@nongnu.org; Sun, 13 Oct 2019 18:26:22 -0400 Received: by mail-pg1-x530.google.com with SMTP id p30so8941512pgl.2 for ; Sun, 13 Oct 2019 15:26: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=eQFl1TFXthP4AT6NgGUJRpsDofwtKBJ7n5fJYlO6V1Y=; b=ra11ZBumrgiUZtKOkdbajdgjI0Ui7WB3PzcfVJJQ8pAW+v6ozDasf/sUE5GCDcGek7 ah/h2czo7ydjBtog0hRMQBWNFlq8mL7g8AgAkv+Qfj9m9cdjy/MD4jpR5KgKnv1nyzXI XaWlg/z77spMO73l2S5YQfe0/SuJRuyVnOEqNvaNMnNjTNOKEjmEFdC/eFPaXElSMG8V teGfFm6ORQsKwJpQmil6aLjP2geSMExdgRzdF2OXfC9G/PUaSwYOd4rP/s7w9LUp+zck tDA0tkivrYjzbNwT7DRzAQUEA62LeSKPotugg3MXfv0+ikYYAUAkl8mhMMgOSlWrlHLa m+6w== 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=eQFl1TFXthP4AT6NgGUJRpsDofwtKBJ7n5fJYlO6V1Y=; b=Gy0opnEaGE7K9x9SWorN0T2eRdItrJ1zfEHhllZwXRfd7hAFdEeNwHqARk2tLFU1Fp u/wU99QAGlx+Qm6aBKXUyo6sBRhB7bTY8gbeOAUPGJ0UNs4zuYAmlG16z+ANkJpnVUgV BDwvSOJOY7uVupEJTdi1fR8oFkk8IfLaE9W5hYjQScrutDl2G/SYLfGzpYZZ39g1sUZk tj7PsWYEO7WRIJ4O307Hb5ccln3JzVucjPjJ0rwza9hDAl9s/6xBFd8QX8ar/OjVVB/9 VqJFkPJhOabGAckmefhzAPiosunbFl38Xa2x/fA4KeENlOTld0TGtBO+ZW7uMa0+6M05 3fqQ== X-Gm-Message-State: APjAAAUcsXN+8qQOgBPblq2O7VOyd2M6jNEPhssrx5SazYEpiCECuQ+A FOyyJ6SaH/U4JZI0+TaouJ+wJvVrh/Y= X-Received: by 2002:a63:ea45:: with SMTP id l5mr16785414pgk.189.1571005575331; Sun, 13 Oct 2019 15:26:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 15:26:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 22/23] tcg/ppc: Update vector support for v3.00 dup/dupi Date: Sun, 13 Oct 2019 15:25:43 -0700 Message-Id: <20191013222544.3679-23-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::530 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 conditional on MSR.VEC for TX=1, so we can consider these Altivec instructions. Reviewed-by: Aleksandar Markovic Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.inc.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/tcg/ppc/tcg-target.inc.c b/tcg/ppc/tcg-target.inc.c index 5b7d1bd2dc..d308d69aba 100644 --- a/tcg/ppc/tcg-target.inc.c +++ b/tcg/ppc/tcg-target.inc.c @@ -596,11 +596,14 @@ static int tcg_target_const_match(tcg_target_long val, TCGType type, #define XXPERMDI (OPCD(60) | (10 << 3) | 7) /* v2.06, force ax=bx=tx=1 */ #define XXSEL (OPCD(60) | (3 << 4) | 0xf) /* v2.06, force ax=bx=cx=tx=1 */ +#define XXSPLTIB (OPCD(60) | (360 << 1) | 1) /* v3.00, force tx=1 */ #define MFVSRD (XO31(51) | 1) /* v2.07, force sx=1 */ #define MFVSRWZ (XO31(115) | 1) /* v2.07, force sx=1 */ #define MTVSRD (XO31(179) | 1) /* v2.07, force tx=1 */ #define MTVSRWZ (XO31(243) | 1) /* v2.07, force tx=1 */ +#define MTVSRDD (XO31(435) | 1) /* v3.00, force tx=1 */ +#define MTVSRWS (XO31(403) | 1) /* v3.00, force tx=1 */ #define RT(r) ((r)<<21) #define RS(r) ((r)<<21) @@ -931,6 +934,10 @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, TCGReg ret, return; } } + if (have_isa_3_00 && val == (tcg_target_long)dup_const(MO_8, val)) { + tcg_out32(s, XXSPLTIB | VRT(ret) | ((val & 0xff) << 11)); + return; + } /* * Otherwise we must load the value from the constant pool. @@ -3021,7 +3028,22 @@ static bool tcg_out_dup_vec(TCGContext *s, TCGType type, unsigned vece, TCGReg dst, TCGReg src) { tcg_debug_assert(dst >= TCG_REG_V0); - tcg_debug_assert(src >= TCG_REG_V0); + + /* Splat from integer reg allowed via constraints for v3.00. */ + if (src < TCG_REG_V0) { + tcg_debug_assert(have_isa_3_00); + switch (vece) { + case MO_64: + tcg_out32(s, MTVSRDD | VRT(dst) | RA(src) | RB(src)); + return true; + case MO_32: + tcg_out32(s, MTVSRWS | VRT(dst) | RA(src)); + return true; + default: + /* Fail, so that we fall back on either dupm or mov+dup. */ + return false; + } + } /* * Recall we use (or emulate) VSX integer loads, so the integer is @@ -3482,6 +3504,7 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) static const TCGTargetOpDef sub2 = { .args_ct_str = { "r", "r", "rI", "rZM", "r", "r" } }; static const TCGTargetOpDef v_r = { .args_ct_str = { "v", "r" } }; + static const TCGTargetOpDef v_vr = { .args_ct_str = { "v", "vr" } }; static const TCGTargetOpDef v_v = { .args_ct_str = { "v", "v" } }; static const TCGTargetOpDef v_v_v = { .args_ct_str = { "v", "v", "v" } }; static const TCGTargetOpDef v_v_v_v @@ -3651,8 +3674,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) return &v_v_v; case INDEX_op_not_vec: case INDEX_op_neg_vec: - case INDEX_op_dup_vec: return &v_v; + case INDEX_op_dup_vec: + return have_isa_3_00 ? &v_vr : &v_v; case INDEX_op_ld_vec: case INDEX_op_st_vec: case INDEX_op_dupm_vec: