public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@vrull.eu>
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, wilson@tuliptree.org,
	Philipp Tomsich <philipp.tomsich@vrull.eu>
Subject: [PATCH v1 7/8] RISC-V: bitmanip: add orc.b as an unspec
Date: Thu, 11 Nov 2021 15:10:19 +0100	[thread overview]
Message-ID: <20211111141020.2738001-8-philipp.tomsich@vrull.eu> (raw)
In-Reply-To: <20211111141020.2738001-1-philipp.tomsich@vrull.eu>

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 (orcb<mode>2): Add orc.b as an unspec.
	* config/riscv/riscv.md: Add UNSPEC_ORC_B.

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
---

 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 "<bitmanip_optab><mode>3"
   "<bitmanip_insn>\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 "orcb<mode>2"
+  [(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<mode>"
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" [
-- 
2.32.0


  parent reply	other threads:[~2021-11-11 14:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 14:10 [PATCH v1 0/8] Improvements to bitmanip-1.0 (Zb[abcs]) support Philipp Tomsich
2021-11-11 14:10 ` [PATCH v1 1/8] bswap: synthesize HImode bswap from SImode or DImode Philipp Tomsich
2021-11-17 14:51   ` Kito Cheng
2021-11-19 10:20   ` Richard Biener
2021-11-19 10:21     ` Richard Biener
2021-11-11 14:10 ` [PATCH v1 2/8] RISC-V: costs: handle BSWAP Philipp Tomsich
2021-11-17 14:52   ` Kito Cheng
2021-11-11 14:10 ` [PATCH v1 3/8] RISC-V: costs: support shift-and-add in strength-reduction Philipp Tomsich
2021-11-11 14:10 ` [PATCH v1 4/8] RISC-V: bitmanip: fix constant-loading for (1ULL << 31) in DImode Philipp Tomsich
2021-11-11 14:10 ` [PATCH v1 5/8] RISC-V: bitmanip: improvements to rotate instructions Philipp Tomsich
2021-11-11 14:10 ` [PATCH v1 6/8] RISC-V: bitmanip: add splitter to use bexti for "(a & (1 << BIT_NO)) ? 0 : -1" Philipp Tomsich
2021-11-18  9:45   ` Kito Cheng
2021-11-11 14:10 ` Philipp Tomsich [this message]
2021-11-11 14:10 ` [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR Philipp Tomsich
2021-11-11 16:00   ` Kito Cheng
2021-11-11 16:18     ` Philipp Tomsich
2021-11-11 16:27       ` Kito Cheng
2021-11-11 16:42         ` Kito Cheng
2021-11-11 18:33           ` Philipp Tomsich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211111141020.2738001-8-philipp.tomsich@vrull.eu \
    --to=philipp.tomsich@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=wilson@tuliptree.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).