From: Nigel Stephens <nigel@mips.com>
To: Richard Sandiford <rsandifo@redhat.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
Ralf Baechle <ralf@linux-mips.org>,
Richard Henderson <rth@redhat.com>,
gcc-patches@gcc.gnu.org, linux-mips@linux-mips.org
Subject: Re: [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets
Date: Tue, 03 Aug 2004 10:54:39 +0100 [thread overview]
Message-ID: <410F60DF.9020400@mips.com> (raw)
In-Reply-To: <876580bm2e.fsf@redhat.com>
Richard Sandiford wrote:
>I think we should only use define_expands if there's a truly
>MIPS-specific feature in the expansion (as there is in the block
>move stuff, for example, where we use left/right loads and stores).
>
>
>
Fair enough.
>Now obviously I'm only guessing what insn sequence you're using,
>
>
OK, the simplest thing is for me to attach the define_insns. See below.
Note that there is one slightly controversial aspect of these sequences,
which is that they don't truncate the shift count, so a shift outside of
the range 0 to 63 will generate an "unusual" result. This didn't cause
any regression failures, and I believe that this is strictly speaking
acceptable for C, since a shift is undefined outside of this range - but
it could cause some "buggy" code to break. It wouldn't be hard to add an
extra mask with 0x3f if people were nervous about this - it's just that
I didn't have enough spare temp registers within the constraints of the
existing DImode patterns.
---- cut here ---
;; XXX Would be better done using define_expand, so it can be scheduled
;; XXX Note won't handle a shift count outside the range 0 - 63
(define_insn "ashldi3_internal_movc"
[(set (match_operand:DI 0 "register_operand" "=&d")
(ashift:DI (match_operand:DI 1 "register_operand" "d")
(match_operand:SI 2 "register_operand" "d")))
(clobber (match_operand:SI 3 "register_operand" "=&d"))]
"!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
&& ISA_HAS_CONDMOVE"
"subu\t%3,%.,%2\;\
sll\t%M0,%M1,%2\;\
srl\t%3,%L1,%3\;\
sll\t%L0,%L1,%2\;\
movz\t%3,%.,%2\;\
or\t%M0,%M0,%3\;\
and\t%3,%2,32\;\
movn\t%M0,%L0,%3\;\
movn\t%L0,%.,%3"
[(set_attr "type" "darith")
(set_attr "mode" "DI")
(set_attr "length" "36")])
;; Same length as before, but avoids branches
;; XXX Note won't handle a shift count outside the range 0 - 63
(define_insn "ashrdi3_internal_movc"
[(set (match_operand:DI 0 "register_operand" "=&d")
(ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
(match_operand:SI 2 "register_operand" "d")))
(clobber (match_operand:SI 3 "register_operand" "=&d"))]
"!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
&& ISA_HAS_CONDMOVE"
"subu\t%3,%.,%2\;\
srl\t%L0,%L1,%2\;\
sll\t%3,%M1,%3\;\
sra\t%M0,%M1,%2\;\
movz\t%3,%.,%2\;\
or\t%L0,%L0,%3\;\
and\t%3,%2,32\;\
movn\t%L0,%M0,%3\;\
movn\t%M0,%.,%3\;\
movn\t%3,%L0,%3\;\
sra\t%3,%3,31\;\
or\t%M0,%M0,%3"
[(set_attr "type" "darith")
(set_attr "mode" "DI")
(set_attr "length" "48")])
;;; XXX Note won't handle a shift count outside the range 0 - 63
(define_insn "lshrdi3_internal_movc"
[(set (match_operand:DI 0 "register_operand" "=&d")
(lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
(match_operand:SI 2 "register_operand" "d")))
(clobber (match_operand:SI 3 "register_operand" "=&d"))]
"!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
&& ISA_HAS_CONDMOVE"
"subu\t%3,%.,%2\;\
srl\t%L0,%L1,%2\;\
sll\t%3,%M1,%3\;\
srl\t%M0,%M1,%2\;\
movz\t%3,%.,%2\;\
or\t%L0,%L0,%3\;\
and\t%3,%2,32\;\
movn\t%L0,%M0,%3\;\
movn\t%M0,%.,%3"
[(set_attr "type" "darith")
(set_attr "mode" "DI")
(set_attr "length" "36")])
next prev parent reply other threads:[~2004-08-03 9:54 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-19 15:35 [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets Maciej W. Rozycki
2004-07-19 16:59 ` Richard Sandiford
2004-07-19 17:32 ` [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bittargets David Edelsohn
2004-07-19 17:33 ` [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets Maciej W. Rozycki
2004-07-19 17:37 ` Richard Sandiford
2004-07-19 21:38 ` Richard Henderson
2004-07-23 14:41 ` Maciej W. Rozycki
2004-07-23 20:27 ` Richard Henderson
2004-07-23 21:12 ` Ralf Baechle
2004-07-26 11:56 ` Maciej W. Rozycki
2004-08-02 20:03 ` Nigel Stephens
2004-08-03 5:30 ` Richard Sandiford
2004-08-03 9:22 ` Nigel Stephens
2004-08-03 9:36 ` Richard Sandiford
2004-08-03 9:54 ` Nigel Stephens [this message]
2004-08-04 19:57 ` Maciej W. Rozycki
2004-08-04 20:37 ` Nigel Stephens
2004-08-04 20:54 ` Maciej W. Rozycki
2004-08-04 23:39 ` Nigel Stephens
2004-08-07 19:01 ` Richard Sandiford
2004-08-09 22:08 ` Richard Henderson
2004-08-10 5:30 ` Richard Sandiford
2004-08-10 23:20 ` Richard Henderson
2004-08-11 0:24 ` Andreas Schwab
2004-08-11 0:40 ` Paul Brook
2004-08-11 4:32 ` Richard Henderson
2004-08-31 19:51 ` Richard Sandiford
2004-09-03 6:53 ` Richard Henderson
2004-09-03 7:05 ` Richard Sandiford
2004-09-03 7:08 ` Richard Henderson
2004-09-03 7:11 ` Richard Sandiford
2004-09-03 7:20 ` Richard Henderson
2004-09-03 7:29 ` Richard Sandiford
2004-09-03 20:15 ` Richard Henderson
2004-09-04 8:53 ` Richard Sandiford
2004-09-05 0:03 ` Richard Henderson
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=410F60DF.9020400@mips.com \
--to=nigel@mips.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=rsandifo@redhat.com \
--cc=rth@redhat.com \
/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