From patchwork Mon Dec 11 09:47:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Lewis X-Patchwork-Id: 17830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6932101vqy; Mon, 11 Dec 2023 01:48:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IG51wBn2yGu81driV8q+YzFzftOE5FXvDcAyutlo6nYTPC0rflk4ZxPuoGWzuvD64PRJUAq X-Received: by 2002:a05:6102:5086:b0:464:421c:a56b with SMTP id bl6-20020a056102508600b00464421ca56bmr2270437vsb.0.1702288091330; Mon, 11 Dec 2023 01:48:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702288091; cv=pass; d=google.com; s=arc-20160816; b=nAoPodIMSQk4vunKKDBJ4A3rypl7Csqc8QroYF28HqB3mVj47RNeklqL8B0vCvNVBa caEFyD76WebdtQZncfy7UG0I7+bPHzKO4NwAz8Y5FC+SBq5Cjp5QEUvdko+C9e2nzqSO NYp+gDbt2b3+eNZkB1z9lTvbk2e4Ddr3D0+jDnPB5w5ACIoYE//YiJ7OgWJOPoH9N5nS 4V4jekB4B8U2eSI0bKxZ1dwVTTAqrWlQAMCH6QuO3YS2zOQ0h3ctRLUogdcqJH+GkTxP Fjyrm4XbDnQWxgAEJm78uBiXTu7ERwUunSHTtxOJz4HIo8Py83e/ovIDiqfNv1Pe0loY +QNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=56euOX0XxtlVWqVyJnuF2ysjwyy+lALNLK66PQxAfUc=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=RzlWtSuc7Xulkq7sZREbIzxX4Ngj0McDMnLl6ctGwgaMQb8N5JLLPTdXM2DbK4fKdi FFdCyNs6pPIcRyrJeT2xouPWsLSHGAtkw9fnbZVZWcohivYE5KeTB/cRYAr4lpfhAJ/K +YjI8V3YCjwp2kk+xpDCbF5SHGZG8xXjpZabY5vn3O7Tmkx19npTj6QNsFAjWXNmVxrC GvTwCnbp2MrT7A4SpWvahn57HukUa//twJQAdMcJK3FJUJ96vqD+BXp5o5KImx2OFSM2 atqMwOAc8FWD1gsS0NYhZwunQr7AcsmuBTwENu40vyyQQvc2dapovEabbtksXmAciSrg h0xA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=uqYGdNOs; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m11-20020ac807cb000000b0041957757d67si7462689qth.14.2023.12.11.01.48.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:48:11 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=uqYGdNOs; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C6BC3857437 for ; Mon, 11 Dec 2023 09:48:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id D656B3858D33 for ; Mon, 11 Dec 2023 09:47:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D656B3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D656B3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702288063; cv=none; b=Va6u5Zdurwqw/KZ+d+K8YXvUsfo+wWD6eOlyqVLgJhvyGIxQbSa8NjuHeWZekYz5mlZTpHzcMqdzstmmJ+2QBveP+P7CtY0eNzAz63r2s9zNlDGisHRpEAH6KrVI8BZpRSLZXAV87laYBVEJSo0MA0TTwaGZ95mB0b7Dt8plrDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702288063; c=relaxed/simple; bh=rXqyjGxdjbiOAN7c0CKbOFoNFdzEqmtgVNApFk2tFys=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=utlOgiij4soYGepYrGlEZsjP5KRXuFUuP9BX0B57MJ/B4mogSBBpaU9WlfgfFCRImREJS6QZoSZUFwBfbBRXAwh/tBUXLltrbspnOCf0umdCX+WgVLgHztiaoO95joqKivh+bRQLEFxNbtHT+3KBSy8i1cZ3GKdHLpLpY0YPW/4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3332fc9b9b2so3918725f8f.1 for ; Mon, 11 Dec 2023 01:47:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702288060; x=1702892860; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=56euOX0XxtlVWqVyJnuF2ysjwyy+lALNLK66PQxAfUc=; b=uqYGdNOsLyACA++b3qnP7biejLKQ6Ddq7MIhvnwgDZLZkcS63qYjkEAEfSPyFP3gnh QZqJeYrEFIonshyZZL2Bsst+GvJAE1m6MnFyAMjX+8hb/rP7kp00iPejh0CbIi53FHCR Hs2yvPWnI9aROBjEg+w7JLH0yhRZbjaN4IVU3cqSc66ezJaeii/BQmKn4qb1o9X1x5rt hMuHt8rdrInv8Hdb/qmPHcroBair+NrTv1uPxkb2OxILLTf4Ezt01fBgK2FEikrtG3zI gPcGertVCAKO7uS7oyNA2Fsi1xcqHZheLmtQs1K1u/c8WFIsKGLchHzestOFAe/n2i3i S1Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702288060; x=1702892860; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=56euOX0XxtlVWqVyJnuF2ysjwyy+lALNLK66PQxAfUc=; b=SrlY4qJDoe+VuitrhVi9NQeZ/JXyglukLY5yPDElCi5TTjoAJA1pbeP4YZxfp4t/P9 JaAQG2wq/bIC8L9aymXnJucDgdWtuvSOqSIMTHUTV/++yTIAPdSrbYVtY8jzbs31jEaq 4rGoQynCmVbXdb36+T0TPBn9QVR0BllZG5Y8bsRFWjAECSSIsB1FK4GeTRLVs7RkjTG5 4ierLUpVuPs51KKPaH/or4CVw7Iojv4f/OcD2MIT/E2DwLOeB8hTQYVxXtacz0oszpGk Kl5GZHFh02u/sRfuzsZyXDI5Q1V9T7bi514BkWvuKl3gTT4Bg8R2nr7QMQCTy3d8k6XQ /faQ== X-Gm-Message-State: AOJu0YwdXJV7Et8RGeF0ARQKCdZPk3MbxD7ZtCCpyw6jX+ug64O4XCN0 xxi8trllALIHBr9nxulzxgrydlX9OPFAybMmFJ7Kag== X-Received: by 2002:adf:f9d0:0:b0:333:4e3a:b803 with SMTP id w16-20020adff9d0000000b003334e3ab803mr856628wrr.277.1702288060200; Mon, 11 Dec 2023 01:47:40 -0800 (PST) Received: from slewis-laptop.ba.rivosinc.com ([51.52.155.69]) by smtp.gmail.com with ESMTPSA id a16-20020adffad0000000b003333b8eb84fsm8128298wrs.113.2023.12.11.01.47.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:47:39 -0800 (PST) From: Sergei Lewis To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/3] RISC-V: vectorised memory operations Date: Mon, 11 Dec 2023 09:47:25 +0000 Message-Id: <20231211094728.1623032-1-slewis@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784978437563138049 X-GMAIL-MSGID: 1784978437563138049 This patchset permits generation of inlined vectorised code for movmem, setmem and cmpmem, if and only if the operation size is at least one and at most eight vector registers' worth of data. Further vectorisation rapidly becomes debatable due to code size concerns; however, for these simple cases we do have an unambiguous performance win without sacrificing too much code size compared to a libc call. Signed-off-by: Sergei Lewis --- Sergei Lewis (3): RISC-V: movmem for RISCV with V extension RISC-V: setmem for RISCV with V extension RISC-V: cmpmem for RISCV with V extension gcc/config/riscv/riscv-protos.h | 2 + gcc/config/riscv/riscv-string.cc | 193 ++++++++++++++++++ gcc/config/riscv/riscv.md | 51 +++++ .../gcc.target/riscv/rvv/base/cmpmem-1.c | 85 ++++++++ .../gcc.target/riscv/rvv/base/cmpmem-2.c | 69 +++++++ .../gcc.target/riscv/rvv/base/movmem-1.c | 59 ++++++ .../gcc.target/riscv/rvv/base/setmem-1.c | 99 +++++++++ 7 files changed, 558 insertions(+) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/cmpmem-2.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/movmem-1.c create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/setmem-1.c