From patchwork Thu Nov 11 14:10:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 47473 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0815B3857C64 for ; Thu, 11 Nov 2021 14:16:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 226413857823 for ; Thu, 11 Nov 2021 14:10:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 226413857823 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu Received: by mail-lj1-x231.google.com with SMTP id d11so12161092ljg.8 for ; Thu, 11 Nov 2021 06:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull-eu.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZLeGmZ4rVwk0KRCBm//8Vou29MREGqxU8Eaun5UCiZ0=; b=548hCUl3nA/9vZNhy9aZPRXCEsMZB7V/C4b76UEoLlk+Qkw+BMUkAHbrUiG1fY+CbW yF7M/SryEPc81PbrcQe5yEKaOg2oLhIQk+miMcD/h9SslvbFfUruhCAWnhMQroRR+au/ mKlmuJptejeUsG8TVA84pPDWxWXah+GurLmVZAm8FoKbHqTczeOFm+OZv54eaKxP3DHb Nr8JBDlYwEfWmUf7ZZqf9TG6rjYdT1gCHHgxdjty+wuaWRdOFZACRvqw2brZqfnWZq2M 2YezkYhaMIkhcmAhrXhLZn5XHFS5JBcaJn1EPcAchuK3Om3si2oO2n49MlwdCApYaASq hY7Q== 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=ZLeGmZ4rVwk0KRCBm//8Vou29MREGqxU8Eaun5UCiZ0=; b=5ChLfojCd1R83QlG4irOrt6c0QJ8iVTG8JrCL5oBMv/EafrhaFxhKwuxCj+oQqIBog JPuCHSWRHRH9ZA9EhCNRfdXz6lvZB4+LGqmQnT7OeA5NPZu1YtfyvCmeiYWgtKfyeFXW 76ngA44d43UGh7Vo3vSVTAngrMkPnhk7dGIvuH3qVdGi/b+RjJty6/uwEME0SgpOMSjh 8Oe5dogf7dyfHhb5C+xRoT0IJTDcxdc1baZaivmd9Lc95Fmc7r1VwHbLtIrXUnbZr9uE rKKRlVmZ4R2SmZ47hKzkbahFLQTjH3r8WgvNJ1Wg8pvbHX0kB++NgIP7yV3Lk1VTXQQo Birg== X-Gm-Message-State: AOAM532lqvo33dJmUYiF/WVZRm5s0/lletff4Da8rLDhRRx84CY6zqRo W2Jn5iMeV2pQh4wnug2LA3xJPGuKy7YANjDJ X-Google-Smtp-Source: ABdhPJwB7GefcYvtTrXWjf0B4Jz+sOu63leA6TiLgz5ZNmJN5+ukeCTXT1pxOX3+xfLPBf/qZlZ+PA== X-Received: by 2002:a2e:a376:: with SMTP id i22mr7397134ljn.201.1636639829854; Thu, 11 Nov 2021 06:10:29 -0800 (PST) Received: from ubuntu-focal.. ([2a01:4f9:3a:1e26::2]) by smtp.gmail.com with ESMTPSA id a23sm274427ljh.140.2021.11.11.06.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 06:10:29 -0800 (PST) From: Philipp Tomsich To: gcc-patches@gcc.gnu.org Subject: [PATCH v1 7/8] RISC-V: bitmanip: add orc.b as an unspec Date: Thu, 11 Nov 2021 15:10:19 +0100 Message-Id: <20211111141020.2738001-8-philipp.tomsich@vrull.eu> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211111141020.2738001-1-philipp.tomsich@vrull.eu> References: <20211111141020.2738001-1-philipp.tomsich@vrull.eu> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wilson@tuliptree.org, kito.cheng@gmail.com, Philipp Tomsich Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" As a basis for optimized string functions (e.g., the by-pieces implementations), we need orc.b available. This adds orc.b as an unspec, so we can expand to it. gcc/ChangeLog: * config/riscv/bitmanip.md (orcb2): Add orc.b as an unspec. * config/riscv/riscv.md: Add UNSPEC_ORC_B. Signed-off-by: Philipp Tomsich --- gcc/config/riscv/bitmanip.md | 8 ++++++++ gcc/config/riscv/riscv.md | 3 +++ 2 files changed, 11 insertions(+) diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md index 9e10280e306..000deb48b16 100644 --- a/gcc/config/riscv/bitmanip.md +++ b/gcc/config/riscv/bitmanip.md @@ -267,6 +267,14 @@ (define_insn "3" "\t%0,%1,%2" [(set_attr "type" "bitmanip")]) +;; orc.b (or-combine) is added as an unspec for the benefit of the support +;; for optimized string functions (such as strcmp). +(define_insn "orcb2" + [(set (match_operand:X 0 "register_operand" "=r") + (unspec:X [(match_operand:X 1 "register_operand")] UNSPEC_ORC_B))] + "TARGET_ZBB" + "orc.b\t%0,%1") + ;; ZBS extension. (define_insn "*bset" diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 225e5b259c1..7a2501ec7a9 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -45,6 +45,9 @@ (define_c_enum "unspec" [ ;; Stack tie UNSPEC_TIE + + ;; Zbb OR-combine instruction + UNSPEC_ORC_B ]) (define_c_enum "unspecv" [