From nobody Tue Nov 18 21:11:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612755785; cv=none; d=zohomail.com; s=zohoarc; b=erMN/E8Beno1QqCoEkxnwAwfFQwJIHNWv6oug345JcENU7JyYll8+MyB2Nff6GgUWswOulln+IdT5KMCn26lkoscdSq/I4vKnZhiZV8/jWhzrXaPA16ypSzs/x/PpftmrNcxg3yMYv0ISqV/B5LL3Sp0pcRIzdALlzEHQebAddY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612755785; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zYP1IfZ2NgNagaWKOae93CbEPgSejc7STMKgpEi9Vio=; b=QCaGL7+b2bOTAUepV1geeGuNcclPuHceP5L+91oZJjuq2u9CJwkaxyItx2c5JiTmlyPTx9Hd6u9pLjVyV6uFKj1pJk6mqeNAVygvTSb2IZmCjUe3EnlLdCb9iKS8IfkR4lT3IN+rkzg9kuvF9kAcdLs4JOYOFPiNvocI5rxfuyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612755785448204.4132451873379; Sun, 7 Feb 2021 19:43:05 -0800 (PST) Received: from localhost ([::1]:40324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8xS2-0003FW-Qk for importer@patchew.org; Sun, 07 Feb 2021 22:43:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8wdt-00081t-Ax for qemu-devel@nongnu.org; Sun, 07 Feb 2021 21:51:13 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:42358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8wdr-0001Kf-7C for qemu-devel@nongnu.org; Sun, 07 Feb 2021 21:51:13 -0500 Received: by mail-pl1-x635.google.com with SMTP id s15so7024479plr.9 for ; Sun, 07 Feb 2021 18:51:10 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id p12sm10308690pju.35.2021.02.07.18.51.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 18:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zYP1IfZ2NgNagaWKOae93CbEPgSejc7STMKgpEi9Vio=; b=gGwzj3IYJ+5GsgBXm7U8Xg3LguG+vE+kDbcKOvivfgorbC5Q0dXufWIWoh1JrVF6UE LDnH/wHqqMvmJUSDuznp1kPhH0QoFWGN8UwPnRqPHN+3aNKXWaFJtl39eQRvdt7IZZA8 6DFU5ElM0AH/NRBmYIpbuifn8F/bNeCWaxdeC5BCXp8xOh4zJVA3QJHE50ySidvPnXAN jTiqH5uyVnXcOFwA3D2fJf+6QoD07nvAjHWskenVZnBdC6UZhVk3tiYsCKJvN00yuKhZ VL2KwpeJH0pjIsm5MxwY9LWg4AxiPogSlBHoia5shFZQIWzGbq4grVTSORpofVLPCIBQ qfZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zYP1IfZ2NgNagaWKOae93CbEPgSejc7STMKgpEi9Vio=; b=j3JWIWCSgG6jfw2HvSRBybudGaWKqwHrMeg6f9bHefc3wLdwKYtARr+IZlxkURLeY+ EC29kFm2kvUk0Og7oEmU6llDV329NTOhfLx2Y6CeuSW388UzRUZdMF1Qnn8L64rhBW7O /IaWcef42I1IzzbMQdWMdwR5prgh/J0DONKglhiyX/y3ICljJk89zbmG6rsDCrGGtN2X 0p/BsJ3KG9pm6JVAyfioFFpvrzpWafjtqyEjRDte/bDDleAI0ll/GO9PeFe9qTAP9RDA 5rri14Ed5QT8oyau3xDGOpJBhXFvfw6dbH9l8a2Pi6BkEYipLh4tWT1BxStz+Wg2F0nS rbcA== X-Gm-Message-State: AOAM531m1sfM8L5D/0xm2jOFYKJPbpO2VHCtPBmsBr75WuYcVx1d7Xd1 /NcgJdr5812bMaKFZwCixSYTX2y/+XqsEw== X-Google-Smtp-Source: ABdhPJxKf9kBeuTIWtNkOfHMTnzb63etDF/QXdsw/H1h0tp5l0ksFXfo+9hynOyEUG9u8LTWzQ1/rg== X-Received: by 2002:a17:902:242:b029:dc:3baf:2033 with SMTP id 60-20020a1709020242b02900dc3baf2033mr14148708plc.36.1612752669210; Sun, 07 Feb 2021 18:51:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 05/16] tcg/s390x: Implement tcg_out_ld/st for vector types Date: Sun, 7 Feb 2021 18:50:50 -0800 Message-Id: <20210208025101.271726-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208025101.271726-1-richard.henderson@linaro.org> References: <20210208025101.271726-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 117 +++++++++++++++++++++++++++++++++---- 1 file changed, 105 insertions(+), 12 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 4656efea83..df10ee0feb 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -265,6 +265,12 @@ typedef enum S390Opcode { RX_STC =3D 0x42, RX_STH =3D 0x40, =20 + VRX_VL =3D 0xe706, + VRX_VLLEZ =3D 0xe704, + VRX_VST =3D 0xe70e, + VRX_VSTEF =3D 0xe70b, + VRX_VSTEG =3D 0xe70a, + NOP =3D 0x0707, } S390Opcode; =20 @@ -532,6 +538,26 @@ static void tcg_out_insn_RSY(TCGContext *s, S390Opcode= op, TCGReg r1, #define tcg_out_insn_RX tcg_out_insn_RS #define tcg_out_insn_RXY tcg_out_insn_RSY =20 +static int RXB(TCGReg v1, TCGReg v2, TCGReg v3, TCGReg v4) +{ + return ((v1 & 16) << (7 - 3)) + | ((v2 & 16) << (6 - 3)) + | ((v3 & 16) << (5 - 3)) + | ((v4 & 16) << (4 - 3)); +} + +static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, + TCGReg b2, TCGReg x2, intptr_t d2, int m3) +{ + tcg_debug_assert(v1 >=3D TCG_REG_V0 && v1 <=3D TCG_REG_V31); + tcg_debug_assert(d2 >=3D 0 && d2 <=3D 0xfff); + tcg_debug_assert(x2 <=3D TCG_REG_R15); + tcg_debug_assert(b2 <=3D TCG_REG_R15); + tcg_out16(s, (op & 0xff00) | ((v1 & 15) << 4) | x2); + tcg_out16(s, (b2 << 12) | d2); + tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, 0, 0) | (m3 << 12)); +} + /* Emit an opcode with "type-checking" of the format. */ #define tcg_out_insn(S, FMT, OP, ...) \ glue(tcg_out_insn_,FMT)(S, glue(glue(FMT,_),OP), ## __VA_ARGS__) @@ -708,25 +734,92 @@ static void tcg_out_mem(TCGContext *s, S390Opcode opc= _rx, S390Opcode opc_rxy, } } =20 +static void tcg_out_vrx_mem(TCGContext *s, S390Opcode opc_vrx, + TCGReg data, TCGReg base, TCGReg index, + tcg_target_long ofs, int m3) +{ + if (ofs < 0 || ofs >=3D 0x1000) { + if (ofs >=3D -0x80000 && ofs < 0x80000) { + tcg_out_insn(s, RXY, LAY, TCG_TMP0, base, index, ofs); + base =3D TCG_TMP0; + index =3D TCG_REG_NONE; + ofs =3D 0; + } else { + tcg_out_movi(s, TCG_TYPE_PTR, TCG_TMP0, ofs); + if (index !=3D TCG_REG_NONE) { + tcg_out_insn(s, RRE, AGR, TCG_TMP0, index); + } + index =3D TCG_TMP0; + ofs =3D 0; + } + } + tcg_out_insn_VRX(s, opc_vrx, data, base, index, ofs, m3); +} =20 /* load data without address translation or endianness conversion */ -static inline void tcg_out_ld(TCGContext *s, TCGType type, TCGReg data, - TCGReg base, intptr_t ofs) +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg data, + TCGReg base, intptr_t ofs) { - if (type =3D=3D TCG_TYPE_I32) { - tcg_out_mem(s, RX_L, RXY_LY, data, base, TCG_REG_NONE, ofs); - } else { - tcg_out_mem(s, 0, RXY_LG, data, base, TCG_REG_NONE, ofs); + switch (type) { + case TCG_TYPE_I32: + if (likely(data < 16)) { + tcg_out_mem(s, RX_L, RXY_LY, data, base, TCG_REG_NONE, ofs); + break; + } + tcg_out_vrx_mem(s, VRX_VLLEZ, data, base, TCG_REG_NONE, ofs, MO_32= ); + break; + + case TCG_TYPE_I64: + if (likely(data < 16)) { + tcg_out_mem(s, 0, RXY_LG, data, base, TCG_REG_NONE, ofs); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + tcg_out_vrx_mem(s, VRX_VLLEZ, data, base, TCG_REG_NONE, ofs, MO_64= ); + break; + + case TCG_TYPE_V128: + /* Hint quadword aligned. */ + tcg_out_vrx_mem(s, VRX_VL, data, base, TCG_REG_NONE, ofs, 4); + break; + + default: + g_assert_not_reached(); } } =20 -static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg data, - TCGReg base, intptr_t ofs) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg data, + TCGReg base, intptr_t ofs) { - if (type =3D=3D TCG_TYPE_I32) { - tcg_out_mem(s, RX_ST, RXY_STY, data, base, TCG_REG_NONE, ofs); - } else { - tcg_out_mem(s, 0, RXY_STG, data, base, TCG_REG_NONE, ofs); + switch (type) { + case TCG_TYPE_I32: + if (likely(data < 16)) { + tcg_out_mem(s, RX_ST, RXY_STY, data, base, TCG_REG_NONE, ofs); + } else { + tcg_out_vrx_mem(s, VRX_VSTEF, data, base, TCG_REG_NONE, ofs, 1= ); + } + break; + + case TCG_TYPE_I64: + if (likely(data < 16)) { + tcg_out_mem(s, 0, RXY_STG, data, base, TCG_REG_NONE, ofs); + break; + } + /* fallthru */ + + case TCG_TYPE_V64: + tcg_out_vrx_mem(s, VRX_VSTEG, data, base, TCG_REG_NONE, ofs, 0); + break; + + case TCG_TYPE_V128: + /* Hint quadword aligned. */ + tcg_out_vrx_mem(s, VRX_VST, data, base, TCG_REG_NONE, ofs, 4); + break; + + default: + g_assert_not_reached(); } } =20 --=20 2.25.1