From patchwork Mon May 27 21:18:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 799242 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a08:0:b0:354:fb4b:99cd with SMTP id m8csp25771wru; Mon, 27 May 2024 14:19:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUluNDmQNllC9a2VZdrfWj50ZSHfMtIkFF+NjdkVWpvqv7g9KdFtiSFclWZXMW1ldWVwPEogxP5IyAnoMtPUE4K X-Google-Smtp-Source: AGHT+IFSSqXEbUbynAC4VTH1joY7wujwgxj8GpEjeN4wuVg/SQeATNmo4cQPWnArk7Swmw7feQ0d X-Received: by 2002:a25:bfcc:0:b0:df7:943b:3885 with SMTP id 3f1490d57ef6-df7943b3a14mr5840020276.24.1716844785384; Mon, 27 May 2024 14:19:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716844785; cv=none; d=google.com; s=arc-20160816; b=WKipVx6kgfoBe4ooPH0pvdQw7rVmGleWANGYfo1eQZvPKhMp0OMTpgupVdY4CDEUU+ 7PegDmxTnqTn8k+idGPle3O3Gi7lJNJk1ffUNvnBvAY89FK42pi8XAR0fPS4+mKYDHCC /t1pr+rKU5H11QMcshpLIPQSvLwiWvPA+2iBoVoZw5/20lc5pktDyb8VdbzngoPj81qN VRjQ8xJCVbv9CXSH4YirEVGxDAFKVFxEA5+izXHzwbZjJaA0Q3FbBHOe67U1QxG2bo/g MBR5zRkzbuRPwQ5nUBzzy739RYx+HTHzXS6X0uuLoyH2RuepyPjXR79UoiV76q8MqKgX 7zsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=sg1iVxa+82en/q/7WfgY9cj5/18kkvyZ61i/JWvW0IA=; fh=hzNNYKTacOnX/pFrTgMTyElWGK9kyvH1o007fnxf7fU=; b=YvHtSiR0d/BSIMNO/CMn2wkqHFu9PlKBHK718cKMl4pvn+9AqPw4EPna+yfPT3beum zxq+ZTQ8UOxVsOZaxD2V2VAcKoATJEfVrehwBdTd/Ry+96uz/L8ilVn+/TOERKtbOcAW +YQrld8vGmr/O/lzgMmXwd/jDTZ2Pj13sDf4JaWkMF5anA9KUy3gheNjn3phHbRQGx0m ONdl8QZogfzG54bQDzIOYPBUCnAKZWKrJEs6TTNDOrKYbihTyQBrXh6zU6IKM0luMBzb QWf5EX+gIQHH2OqWGpzLjzzuD51OZrns6EYVQlToTJt2gBXGv8qbz98sK+THHUHcSNm1 woCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQio++kA; 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 d75a77b69052e-43fb17c131esi89452821cf.125.2024.05.27.14.19.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 May 2024 14:19:45 -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=GQio++kA; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBhkW-00079F-S7; Mon, 27 May 2024 17:19:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBhkV-00078Y-Gu for qemu-devel@nongnu.org; Mon, 27 May 2024 17:19:19 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBhkT-0003bs-NZ for qemu-devel@nongnu.org; Mon, 27 May 2024 17:19:19 -0400 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-681ad26f4a5so95666a12.2 for ; Mon, 27 May 2024 14:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716844756; x=1717449556; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sg1iVxa+82en/q/7WfgY9cj5/18kkvyZ61i/JWvW0IA=; b=GQio++kA7PDpaT32+kID26igFLBu0oi2v4s5uexU7YoAGLkJW7xMRe46RiwtBKU/j7 XpvI2ilNjJoGuR9A6v9uCpSeEw3ETGyjB7sqhdIEBE4f/OfDzWnu5L8w9tm/5Xpq2eyi Jv2TfHVR2sRW+bJpfnCWuCl5RDVL+hDYlgYy3ettg+5ncMHk87tg7EcLl1Z3Y+5jV17o RbHz7u0VRevDMOo7lNDiOeNxBcXa7UDsCzkn4mtCBA6KBqCq4M8HJruspA8C9pXwS6vv gFe5fnpv12ozhRJ/4QWyIrqGBlu1cbpCOqyX62zC8HRcy+bWNGX0ydPotPYkiI2HDz9f Bs2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716844756; x=1717449556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sg1iVxa+82en/q/7WfgY9cj5/18kkvyZ61i/JWvW0IA=; b=JeXe4KNOgqfwoveUvQGoxcBsNYssqdBhAnSNo630tSJzFSySgcm915CVd0r8gVLC0P 28tj4CxdOpgWFI9XwC6i4Oux4+IRz1SA3vgz1+dtbqTCXlFd7UgsqYAGPNWDDtVUgFCH DdAt4LT9YXhOMy++bhyR+Wn6C4fY54/WN7265NHJEGpRMU3wnJC37214IOSAgeaLkSqE WwdIWlllR8mj3+yXGvo24koOtXkChmHxtWYDiMRFLrCx8cjRml9xKVff8ByGpkMZ5m6d YJ23DsnQYiYvizKxVXyoi2Gn46K9gizsVLVEvEDtebNVGap6zlPRDykGdeQyklakUkRl WWbw== X-Gm-Message-State: AOJu0Yy8lU5SC7OhuzwNmlMVwtIw5zgvE/hrSL0nHK8xYxDL9cUAAyMe 2QjTWQVFw1NwmRLT3lg9Vg2OJpzbriuMerIM6omRS+G14LIFOMa7F+RpswQjGhVXnjX0DqDgUzd S X-Received: by 2002:a05:6a20:c703:b0:1b2:1f70:a1fc with SMTP id adf61e73a8af0-1b21f70a369mr9439827637.39.1716844756242; Mon, 27 May 2024 14:19:16 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd1d4d5fsm5265876b3a.165.2024.05.27.14.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 14:19:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, gaosong@loongson.cn Subject: [PATCH 02/18] tcg/loongarch64: Use fp load/store for I32 and I64 into vector regs Date: Mon, 27 May 2024 14:18:56 -0700 Message-Id: <20240527211912.14060-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527211912.14060-1-richard.henderson@linaro.org> References: <20240527211912.14060-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Song Gao --- tcg/loongarch64/tcg-target.c.inc | 36 +++++++++----------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 06ca1ab11c..b9078ac793 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -803,6 +803,12 @@ static void tcg_out_ldst(TCGContext *s, LoongArchInsn opc, TCGReg data, case OPC_ST_D: tcg_out32(s, encode_djsk12_insn(opc, data, addr, imm12)); break; + case OPC_FLD_S: + case OPC_FLD_D: + case OPC_FST_S: + case OPC_FST_D: + tcg_out32(s, encode_fdjsk12_insn(opc, data, addr, imm12)); + break; default: g_assert_not_reached(); } @@ -816,14 +822,14 @@ static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg dest, if (dest < TCG_REG_V0) { tcg_out_ldst(s, OPC_LD_W, dest, base, offset); } else { - tcg_out_dupm_vec(s, TCG_TYPE_I128, MO_32, dest, base, offset); + tcg_out_ldst(s, OPC_FLD_S, dest, base, offset); } break; case TCG_TYPE_I64: if (dest < TCG_REG_V0) { tcg_out_ldst(s, OPC_LD_D, dest, base, offset); } else { - tcg_out_dupm_vec(s, TCG_TYPE_I128, MO_64, dest, base, offset); + tcg_out_ldst(s, OPC_FLD_D, dest, base, offset); } break; case TCG_TYPE_V128: @@ -847,36 +853,14 @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg src, if (src < TCG_REG_V0) { tcg_out_ldst(s, OPC_ST_W, src, base, offset); } else { - /* TODO: Could use fst_s, fstx_s */ - if (offset < -0x100 || offset > 0xff || (offset & 3)) { - if (-0x800 <= offset && offset <= 0x7ff) { - tcg_out_opc_addi_d(s, TCG_REG_TMP0, base, offset); - } else { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); - tcg_out_opc_add_d(s, TCG_REG_TMP0, TCG_REG_TMP0, base); - } - base = TCG_REG_TMP0; - offset = 0; - } - tcg_out_opc_vstelm_w(s, src, base, offset, 0); + tcg_out_ldst(s, OPC_FST_S, src, base, offset); } break; case TCG_TYPE_I64: if (src < TCG_REG_V0) { tcg_out_ldst(s, OPC_ST_D, src, base, offset); } else { - /* TODO: Could use fst_d, fstx_d */ - if (offset < -0x100 || offset > 0xff || (offset & 7)) { - if (-0x800 <= offset && offset <= 0x7ff) { - tcg_out_opc_addi_d(s, TCG_REG_TMP0, base, offset); - } else { - tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_TMP0, offset); - tcg_out_opc_add_d(s, TCG_REG_TMP0, TCG_REG_TMP0, base); - } - base = TCG_REG_TMP0; - offset = 0; - } - tcg_out_opc_vstelm_d(s, src, base, offset, 0); + tcg_out_ldst(s, OPC_FST_D, src, base, offset); } break; case TCG_TYPE_V128: