public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Daniel Glastonbury" <dang@ratbaggames.com>
To: <gcc@gcc.gnu.org>
Subject: Teaching GCC about fmadd variant
Date: Mon, 22 Apr 2002 01:27:00 -0000	[thread overview]
Message-ID: <082e01c1e9d6$197bc720$7d00a8c0@dang2> (raw)

Hi,
  I'm looking for some help in teaching gcc how to use the fmadd variants
that my mips has.  Unlike the mips IV madd instruction, this mips has a
variant that goes something like this:

mula  fs, ft    : ACC <- fs*ft
madda fs, ft    : ACC <- ACC + fs*ft
madd  fd, fs, ft: fd <- ACC + fs*ft

The problem is there is no general way to move to/from the ACC register.

I tried to teach gcc about a new register, the fp acc, and then specify insn
patterns to try match on a new register contraint, which I called F.

here are the example insn patterns I'm using:
(define_insn ""
  [(set (match_operand:SF 0 "register_operand" "=f")
  (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
        (match_operand:SF 2 "register_operand" "f"))
     (match_operand:SF 3 "register_operand" "F")))]
     "TARGET_MIPS5900"
     "madd.s\\t%0,%1,%2"
     [(set_attr "type" "fmadd")
     (set_attr "mode" "SF")
     (set_attr "length" "1")])

(define_insn "R5900_maddas"
  [(set (match_operand:SF 0 "register_operand" "=F")
 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
     (match_operand:SF 2 "register_operand" "f"))
   (match_operand:SF 3 "register_operand" "F")))]
  "TARGET_MIPS5900"
  "madda.s\\t%1,%2"
  [(set_attr "type" "fmadd")
   (set_attr "mode" "SF")
   (set_attr "length" "1")])

(define_insn ""
  [(set (match_operand:SF 0 "register_operand" "=F")
  (mult:SF (match_operand:SF 1 "register_operand" "f")
     (match_operand:SF 2 "register_operand" "f")))]
     "TARGET_MIPS5900"
     "mula.s\\t%1,%2"
     [(set_attr "type" "fmadd")
     (set_attr "mode" "SF")
     (set_attr "length" "1")])

The problem is that I get an ICE because the compiler can't generate a
reload.  I believe it's trying to load the computation from a regular
mult:SF into the ACC register.

Can anyone point me in the right direction.  I've tried to glean as much
information as I could from the gcc internals manual, and from
mips.{c,h,md}, but I can't work out how to tell gcc to use a different
register.

I'm sorry if this is the wrong forum to ask this question.

thanks
Dan
--
Daniel Glastonbury, Senior Programmer, Ratbag Pty Ltd
Level 8, 63 Pirie Street, Adelaide, SA, Australia. 5000
T: +618 8223 5830 F: +618 8223 5746 W: http://www.ratbaggames.com


             reply	other threads:[~2002-04-22  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22  1:27 Daniel Glastonbury [this message]
2002-04-22  7:38 ` Daniel Jacobowitz
2002-04-23  5:43   ` Daniel Glastonbury

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='082e01c1e9d6$197bc720$7d00a8c0@dang2' \
    --to=dang@ratbaggames.com \
    --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).