From patchwork Wed Oct 6 15:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 515344 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp546031ime; Wed, 6 Oct 2021 08:42:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyZLt6ZShZ5+rRo07CJS3OfupMQabgIxBvsoOhu+OsXJHQa58avG3cirGdz9IkwrEnb8es X-Received: by 2002:ac8:7748:: with SMTP id g8mr27474117qtu.281.1633534959838; Wed, 06 Oct 2021 08:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633534959; cv=none; d=google.com; s=arc-20160816; b=mlz/CxdslbNPJCf5DoS6T/hGDEzyh+tmy+WLbf2XSaaIJJm5NoQyR4kSDlo+adu+dl 2ItodquCxJ8vTv1+mhoQozdAoDAPUqtNHqA9XdiqrgzTdNwW6/kvQPBdqSNpbHM81SZ6 AQ9xaMaQrAqcq0YvYyo5ipx9hSfLTCJIZvDekvSV7UmzazWZfJjlxTmcZPwitz7a17c5 jNTZk9QrQqowQWv+AAyIBohzWH/1Q1Nq1/qAWlsqtH5BkCyBx+xnmuaVFlBhZ+wpXhoj XqUeOztBlD6n4pY48Kprh7QYfQqo2hCSIBlCnEFHqOFdKquC85op9MD4PRoq+MavdFSG gh8w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jDEFrOuF5vzpvLt/BuSnZw7aY6SBxJIsD/hC5MysJfc=; b=te8Vczxma3RbLKtQtNc9YSu+NXgsk5mle5kkGqwW0UWXUluYTLZcQCN0AwcO9bpbEY rTal8pB2bD6XKuRki017y0cMx22ysdnMcs+K6Hm6yp2hzSk98P8j45K5YaUxjDpZjrvm PgCt5Fvm4gFWMMw5J3SbhKm3dHPVyQ/aOE7Q+1JCn/kxCk5DoITPVrPjtGb/RtATkCcw hYXi/8ho/Za6LxZsiuSnvnr2f7Y5cKOdrtoRum9jmsBa834LWwxofdSqSJG54PF5Y0QA sETETTsLzmIetJGmsefiTSooTVojix6sJIBj/g8jZNOA+7AzjbnTYmRqIO/yYhmkMRI5 /wSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jPXh3vA/"; 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 10si248675qtu.63.2021.10.06.08.42.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Oct 2021 08:42:39 -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="jPXh3vA/"; 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]:50814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mY943-0005dy-Ae for patch@linaro.org; Wed, 06 Oct 2021 11:42:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mY8j5-0002do-Oo for qemu-devel@nongnu.org; Wed, 06 Oct 2021 11:21:00 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:41870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mY8ip-0007rw-0o for qemu-devel@nongnu.org; Wed, 06 Oct 2021 11:20:59 -0400 Received: by mail-pg1-x530.google.com with SMTP id v11so2748760pgb.8 for ; Wed, 06 Oct 2021 08:20:34 -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 :mime-version:content-transfer-encoding; bh=jDEFrOuF5vzpvLt/BuSnZw7aY6SBxJIsD/hC5MysJfc=; b=jPXh3vA/2y8ZFfvws5q/V/TVfH73DRD/4xBU6gGniVyjlt6Tm2ReDsl5PjrRGVWn0L LUp9tVsZJiEVNefIhnjHhorUifTomJx0nDge4jV8+K/CIiwUnhog3xMeXuezTFLmrBTM LNf6P97QBkOG0HSODQjZwXpKu0fL1kKePiOCCG3qGMbPiUWSbb/2FpjeEIm0VWiXo8/U LNCwrisfZL/glCM8WLSSI15zHFL2ybdJV4bJmpdhRmZXQHglocokA8u2LGRlfpAjm239 QBHfaBLmuHFaqWQMAdIrs3ffYlZiTEKRaQhLMrAcYZoP6QRb8Doh6ivKPK5f3lkzej7R UkHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jDEFrOuF5vzpvLt/BuSnZw7aY6SBxJIsD/hC5MysJfc=; b=fwCLtv30KRzOt1ReI3T1exQX3k+zxWQ6JqKIP6P5T3Gh7iWL0AyU9LD+8sxbsl2wZE EGiGCNREJYmA/rAFCz7YVeEz3PObm6zxd1JLRguXgagW9SYbEclrGuNZhhlv/rNhKfl3 f5Lu5n84cR0HV+FIgjB8IMcbJqRQMxA7dam4pxkyeF1BFzz31MvOc56PzUcuMfVI9GB+ vh8Q/obpP1kb+8I97FRGRYoJpqgaukkxon/jfx07AOtafVrTKfB/M87xqb3QTUe0/kD8 DFcjj58QdfKN+GSS86vAx5oaOh+GaJ5KrQ5vlQZlZSGsvpRqBgXM0Jbck8CYsJo2x5gq iRtA== X-Gm-Message-State: AOAM530UsJKvz95FqX70x2eeNXtebUio320UI3k9jyR+VBvewgCT84fI vRYRRtpRv480m9LKwjEe571zqzDUE0TytA== X-Received: by 2002:aa7:8116:0:b0:44b:e0d1:25e9 with SMTP id b22-20020aa78116000000b0044be0d125e9mr38273882pfi.53.1633533633296; Wed, 06 Oct 2021 08:20:33 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id 130sm22239256pfz.77.2021.10.06.08.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 08:20:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 19/28] tcg/s390x: Implement tcg_out_mov for vector types Date: Wed, 6 Oct 2021 08:20:05 -0700 Message-Id: <20211006152014.741026-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211006152014.741026-1-richard.henderson@linaro.org> References: <20211006152014.741026-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: David Hildenbrand Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 72 +++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index d80f25e48e..586a4b5587 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -265,6 +265,11 @@ typedef enum S390Opcode { RX_STC = 0x42, RX_STH = 0x40, + VRRa_VLR = 0xe756, + + VRSb_VLVG = 0xe722, + VRSc_VLGV = 0xe721, + VRX_VL = 0xe706, VRX_VLLEZ = 0xe704, VRX_VST = 0xe70e, @@ -558,6 +563,39 @@ static int RXB(TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) | ((v4 & 0x10) << (4 + 0)); } +static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, + TCGReg v1, TCGReg v2, int m3) +{ + tcg_debug_assert(is_vector_reg(v1)); + tcg_debug_assert(is_vector_reg(v2)); + tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | (v2 & 0xf)); + tcg_out32(s, (op & 0x00ff) | RXB(v1, v2, 0, 0) | (m3 << 12)); +} + +static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, + intptr_t d2, TCGReg b2, TCGReg r3, int m4) +{ + tcg_debug_assert(is_vector_reg(v1)); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(is_general_reg(b2)); + tcg_debug_assert(is_general_reg(r3)); + tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | r3); + tcg_out16(s, b2 << 12 | d2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m4 << 12)); +} + +static void tcg_out_insn_VRSc(TCGContext *s, S390Opcode op, TCGReg r1, + intptr_t d2, TCGReg b2, TCGReg v3, int m4) +{ + tcg_debug_assert(is_general_reg(r1)); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(is_general_reg(b2)); + tcg_debug_assert(is_vector_reg(v3)); + tcg_out16(s, (op & 0xff00) | (r1 << 4) | (v3 & 0xf)); + tcg_out16(s, b2 << 12 | d2); + tcg_out16(s, (op & 0x00ff) | RXB(0, 0, v3, 0) | (m4 << 12)); +} + static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, TCGReg b2, TCGReg x2, intptr_t d2, int m3) { @@ -591,12 +629,38 @@ static void tcg_out_sh32(TCGContext* s, S390Opcode op, TCGReg dest, static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg dst, TCGReg src) { - if (src != dst) { - if (type == TCG_TYPE_I32) { + if (src == dst) { + return true; + } + switch (type) { + case TCG_TYPE_I32: + if (likely(is_general_reg(dst) && is_general_reg(src))) { tcg_out_insn(s, RR, LR, dst, src); - } else { - tcg_out_insn(s, RRE, LGR, dst, src); + break; } + /* fallthru */ + + case TCG_TYPE_I64: + if (likely(is_general_reg(dst))) { + if (likely(is_general_reg(src))) { + tcg_out_insn(s, RRE, LGR, dst, src); + } else { + tcg_out_insn(s, VRSc, VLGV, dst, 0, 0, src, 3); + } + break; + } else if (is_general_reg(src)) { + tcg_out_insn(s, VRSb, VLVG, dst, 0, 0, src, 3); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + case TCG_TYPE_V128: + tcg_out_insn(s, VRRa, VLR, dst, src, 0); + break; + + default: + g_assert_not_reached(); } return true; }