public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/53949] [SH] Add support for mac.w / mac.l instructions
Date: Fri, 13 Jul 2012 10:34:00 -0000	[thread overview]
Message-ID: <bug-53949-4-PzEDHdpq5Q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53949-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53949

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-07-13 10:34:20 UTC ---
(In reply to comment #0)
> So far, GCC does not utilize the integer multiply-add instructions.
> On SH1 only the mac.w instruction is supported.
> On SH2 and above the mac.w and mac.l instructions are available.
> 
> Carry over from PR 39423 comment #20
> 
> > On a related thread, for further work, I'm thinking on adding support for the
> > MAC instruction, now that was have the multiply and add. But this requires
> > exposing the MACLH registers to reload. Had anyone had a thought on this ? I'd
> > like to give this a try pretty soon.

I think the biggest problem is that the mac operands have to be in memory.
For example:

long long fun (int a, int long b, long long c)
{
  return (long long)a * (long long)b + c;
}

would need to become something like ... 

mov.l  r4,@-r15
mov    r15,r1
mov.l  r5,@-r15
lds      r6,mach
lds      r7,macl
mac.l  @r15+,@r1+
sts      mach,r1
sts      macl,r0
rts
add     #4,r15

not using the mac instruction seems a bit simpler in this case:

dmuls.l  r4,r5
sts      mach,r1
clrt
sts      macl,r0
addc   r6,r0
rts
addc   r7,r1

I think the mac instructions can be very useful when they can be used inside of
loops,  but for this the whole post-inc memory stuff has to integrate properly
into
the surrounding code.

Chris, do you have any ideas/plans on how to handle the SR.S bit, for example
to implement
the ssmaddhisi4 pattern with mac.w?


  reply	other threads:[~2012-07-13 10:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13  9:01 [Bug target/53949] New: " olegendo at gcc dot gnu.org
2012-07-13 10:34 ` olegendo at gcc dot gnu.org [this message]
2012-07-13 11:01 ` [Bug target/53949] " chrbr at gcc dot gnu.org
2012-07-13 11:24 ` chrbr at gcc dot gnu.org
2012-07-15 12:11 ` olegendo at gcc dot gnu.org
2012-07-17 19:13 ` olegendo at gcc dot gnu.org
2012-07-17 23:05 ` kkojima at gcc dot gnu.org
2012-07-22 16:47 ` olegendo at gcc dot gnu.org
2012-10-11 20:43 ` olegendo at gcc dot gnu.org
2012-11-07 21:31 ` olegendo at gcc dot gnu.org
2013-05-04 13:39 ` olegendo at gcc dot gnu.org
2013-12-17 12:25 ` olegendo at gcc dot gnu.org
2013-12-17 12:37 ` olegendo at gcc dot gnu.org
2015-01-30 19:37 ` olegendo at gcc dot gnu.org
2015-02-01  0:37 ` olegendo at gcc dot gnu.org
2015-04-08 20:08 ` olegendo at gcc dot gnu.org

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=bug-53949-4-PzEDHdpq5Q@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).