From: "H.J. Lu" <hjl.tools@gmail.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: Uros Bizjak <ubizjak@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: PATCH: PR target/44588: Very inefficient 8bit mod/div
Date: Wed, 23 Jun 2010 20:27:00 -0000 [thread overview]
Message-ID: <AANLkTimjSpj58pf_1ZaPu5DgNtBn7BLLGGeobQJZ3f1k@mail.gmail.com> (raw)
In-Reply-To: <4C22624E.1050207@gnu.org>
On Wed, Jun 23, 2010 at 12:36 PM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 06/23/2010 09:35 PM, H.J. Lu wrote:
>>
>> On Wed, Jun 23, 2010 at 12:16 PM, Paolo Bonzini<bonzini@gnu.org> wrote:
>>>
>>> On 06/23/2010 08:24 PM, H.J. Lu wrote:
>>>>
>>>> [(set (match_operand:HI 0 "register_operand" "=a")
>>>> (div:HI
>>>> (match_operand:HI 1 "register_operand" "0")
>>>> (match_operand:QI 2 "nonimmediate_operand" "qm")))
>>>> (clobber (reg:CC FLAGS_REG))]
>>>
>>> Maybe this:
>>>
>>> [(set (match_operand:QI 0 "register_operand" "=a")
>>> (subreg:QI
>>> (div:HI
>>> (match_operand:HI 1 "register_operand" "0")
>>> (match_operand:QI 2 "nonimmediate_operand" "qm")) 0))
>>> (clobber (reg:CC FLAGS_REG))]
>>>
>>
>> It doesn't make a big difference since only lower 8bit
>> is set by it.
>
> For full divmod you have to shift mod and ior of course. I understood that
> you were talking of *<u>divqi3.
>
I can't do shift/ior on QI output from *<u>divqi3. I have
;; Divide AX by r/m8, with result stored in
;; AL <- Quotient
;; AH <- Remainder
(define_insn "*<u>divqi3"
[(set (match_operand:QI 0 "register_operand" "=a")
(any_div:QI
(match_operand:HI 1 "register_operand" "0")
(match_operand:QI 2 "nonimmediate_operand" "qm")))
(clobber (reg:CC FLAGS_REG))]
"TARGET_QIMODE_MATH"
"<sgnprefix>div{b}\t%2"
[(set_attr "type" "idiv")
(set_attr "mode" "QI")])
and use
;; Used to extract remainder from AH by 8bit divmod. Use unspec so
;; that we can extract it from AL.
(define_insn "*movqi_extzh"
[(set (match_operand:QI 0 "nonimmediate_operand" "=Qm,?R")
(unspec:QI [(match_operand 1 "register_operand" "Q,Q")]
UNSPEC_MOVQI_EXTZH))]
to extract it from AL
--
H.J.
next prev parent reply other threads:[~2010-06-23 19:50 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 20:38 H.J. Lu
2010-06-22 17:08 ` H.J. Lu
2010-06-22 18:28 ` Uros Bizjak
2010-06-22 18:36 ` H.J. Lu
2010-06-22 19:12 ` Uros Bizjak
2010-06-22 20:08 ` H.J. Lu
2010-06-23 6:26 ` Uros Bizjak
2010-06-23 16:54 ` H.J. Lu
2010-06-23 18:37 ` Paolo Bonzini
2010-06-23 18:46 ` H.J. Lu
2010-06-23 19:00 ` Paolo Bonzini
2010-06-23 19:08 ` H.J. Lu
2010-06-23 19:53 ` Paolo Bonzini
2010-06-23 20:22 ` H.J. Lu
2010-06-23 20:22 ` Paolo Bonzini
2010-06-23 20:27 ` H.J. Lu [this message]
2010-06-23 21:50 ` H.J. Lu
2010-06-23 22:44 ` H.J. Lu
2010-06-24 0:05 ` Paolo Bonzini
2010-06-24 0:54 ` H.J. Lu
2010-06-24 3:47 ` Paolo Bonzini
2010-06-24 17:38 ` H.J. Lu
2010-06-24 17:58 ` Paolo Bonzini
2010-06-24 19:01 ` Uros Bizjak
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=AANLkTimjSpj58pf_1ZaPu5DgNtBn7BLLGGeobQJZ3f1k@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=bonzini@gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=ubizjak@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).