From: Paul Koning <paulkoning@comcast.net>
To: GCC Development <gcc@gcc.gnu.org>
Subject: divmod pattern question
Date: Wed, 20 Jun 2018 05:16:00 -0000 [thread overview]
Message-ID: <65296BEC-0850-41E8-A5D0-FC8FFA4C17E5@comcast.net> (raw)
Gentlepeople,
I have a two-operand divide instruction that takes a double length dividend in a register pair, and produces the quotient in the first register and remainder in the second.
How do I write a divmod pattern for that? The quotient is easy enough, I write a match_operand for that register and a matching constraint ("0") for the input dividend. But what about the remainder? The remainder appears in a register that isn't explicitly mentioned in the RTL (it's the regnum one higher than the quotient, or if you like, the second subreg of the input (dividend) register.
I can make it a define_expand that adds a move from the remainder register into a new register which is the output operand, and count on the optimizer to optimize away that move. Is that the best answer? The current "mod" pattern does that, and I could keep that approach.
paul
next reply other threads:[~2018-06-19 18:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-20 5:16 Paul Koning [this message]
2018-06-20 5:31 ` Jeff Law
2018-06-20 13:05 ` Paul Koning
2018-06-20 8:24 ` Andreas Schwab
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=65296BEC-0850-41E8-A5D0-FC8FFA4C17E5@comcast.net \
--to=paulkoning@comcast.net \
--cc=gcc@gcc.gnu.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).