From patchwork Sat Jun 26 05:02:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 467415 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2135688jao; Fri, 25 Jun 2021 22:03:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAbMB1Q9FF4djktQe/s2T8O+8pG297c68V6HFtdCyz5plRcoCj44eWjFzwffwLd0H8UT/A X-Received: by 2002:a37:5cc6:: with SMTP id q189mr14975824qkb.305.1624683810465; Fri, 25 Jun 2021 22:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624683810; cv=none; d=google.com; s=arc-20160816; b=UE3rZcFpOC3WP1+yY1wjRCHz49G0h/mSA5EAWTXOZkkydiVC9fnpJJ3PscIdjEmlb1 r5T37Ni9NRQgg3uQBbX/vkh1H99P+x2BA5AV1R9WbkXWzfnlHZesupqCFAok0vZr2Dt2 KHMjALlaQzjul3jUrOU2u9VVKHUZS8v4vpk+3+2Cl+N7Of2g7bHbDmTxVX9nUWD+Q1Ah Dd8nXgiYdE59KfHjAQIVF0ql5lTH8Ody8XKkGjygsQq50vLjRLp8sa796MF5va0d+lPI xxGnyvkdIr/F8oO9QYew/RB1c8ItFEYi7Bf7cFTOl2SSqyP9YTreNGn9MsSJx102ceiI FZOw== 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=3nfkczzkS4RCP30J/oNDtjtKPmz4zWVXF5NhXJHdqeQ=; b=LvYQJk5Lirjo2giyX8jfBoUvEmkowritddEEY2kB3YPVD3Xubc81ZA2QT2vxw+opi4 pXSPo5Nj4ZF54XCjq/CXZmoGLYqpFdm8G7ZB+AfglM+WScOn+WRuuEQrtbOR02/sY2Vl AcRsHGB8QVhbm9JumJKqDdsTT7BuyyqguH9DSxS9dIXQjb03dElVZswaJ/NF2j/wQc5x vNUdgb6iEM93FjKRgrqHY9lvTRbCa6Ilol3OPOKRSgoobdvklKxYhv9O+YMQSSDDo1cw UIXbhbzXhcGds59ZWBlyksZbq/0hZf47+0X1NsXwuwtPhbcEcml+J6qCOb6QlvM27N4p 8J9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Txtc993j; 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 u1si5533918qvf.125.2021.06.25.22.03.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jun 2021 22:03:30 -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=Txtc993j; 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]:36342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lx0TZ-0006tV-UY for patch@linaro.org; Sat, 26 Jun 2021 01:03:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lx0TK-0006nS-KE for qemu-devel@nongnu.org; Sat, 26 Jun 2021 01:03:14 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:41700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lx0TI-0008F2-TL for qemu-devel@nongnu.org; Sat, 26 Jun 2021 01:03:14 -0400 Received: by mail-pg1-x533.google.com with SMTP id u190so9994373pgd.8 for ; Fri, 25 Jun 2021 22:03:12 -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=3nfkczzkS4RCP30J/oNDtjtKPmz4zWVXF5NhXJHdqeQ=; b=Txtc993j1Uhio4TA+HR/lpMNQAPg/orT+jvb/uTK8Zi8EUp1LMvNDk90y8U8HTv3yM H6pJRe/0Vzl60oJd/EY3zuTV7oGXanigmPIxK2jPbpHBobhxdfVuVvdvDJ32DaNM1kj3 gHuAhB0LAiTEmQZ2PmiUsmkOL9B1K5Iq0c3kjb8Khhq03mUW2/Hqu68Vl4QQfYpiidZV jnuQFyB2drD9etl7C8cl7osx9IHrelxOQoTV766ti5Hg9BkK1dKO0nAzAzK9Qa1nnCnH B+c2UMfomvgamEOj56+GXk3h7a0OS15BEymsJEIZRxoaGQIZZzT+QdQ+SbKuGahk+/id Qytw== 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:mime-version:content-transfer-encoding; bh=3nfkczzkS4RCP30J/oNDtjtKPmz4zWVXF5NhXJHdqeQ=; b=gAF8Wf9nLoRfjVYCZFnvoSX0GKLLCRP9qSkT+RY54kyg9sH6L/6ORoyH+Ir9hVghBU qKhw/BRvBqX2W+/byfBMNBlcDybadyVFTHuqjL1B5HxwbJwR6119XW8ig9EdtCuq9MUp Rosk2MZaDfF6L2+E2GOD0r3PeXD3Zm8Kfk3WhqOJhB2d4oC6AiyCegUsRQtitPO+IEt5 U+BnVSiWe3njhvSBOfMtfE0azNm85SQImzx2z5cbrHlCO+XJS3DGVODJgc0uIAv4VTnx gSCnLQsIf5UJSkCbZ4bwYIXgHzOj5ek6AMQFo9ZPOcXydQJKKd8eUhQ6t+q2S3SsfuTV tgDQ== X-Gm-Message-State: AOAM53213zg7La94D5DrWFvCovgtAxIeTxfuz1PApU12EEcSJRm+ooKP do4D3uw2Y6X41FCuv9bhJymhDTHtfPgudQ== X-Received: by 2002:a63:f54f:: with SMTP id e15mr12918663pgk.64.1624683791485; Fri, 25 Jun 2021 22:03:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id c62sm7389768pfa.12.2021.06.25.22.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 22:03:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 06/16] tcg/s390x: Implement tcg_out_mov for vector types Date: Fri, 25 Jun 2021 22:02:57 -0700 Message-Id: <20210626050307.2408505-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210626050307.2408505-1-richard.henderson@linaro.org> References: <20210626050307.2408505-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 72 +++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) -- 2.25.1 Reviewed-by: David Hildenbrand diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index b6ea129e14..c4e12a57f3 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, @@ -548,6 +553,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(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(v2 >= TCG_REG_V0 && v2 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | (v2 & 15)); + 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(v1 >= TCG_REG_V0 && v1 <= TCG_REG_V31); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_debug_assert(r3 <= TCG_REG_R15); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 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(r1 <= TCG_REG_R15); + tcg_debug_assert(d2 >= 0 && d2 <= 0xfff); + tcg_debug_assert(b2 <= TCG_REG_R15); + tcg_debug_assert(v3 >= TCG_REG_V0 && v3 <= TCG_REG_V31); + tcg_out16(s, (op & 0xff00) | (r1 << 4) | (v3 & 15)); + 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) { @@ -581,12 +619,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(dst < 16 && src < 16)) { 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(dst < 16)) { + if (likely(src < 16)) { + tcg_out_insn(s, RRE, LGR, dst, src); + } else { + tcg_out_insn(s, VRSc, VLGV, dst, 0, 0, src, 3); + } + break; + } else if (src < 16) { + 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; }