🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51488

Strange insn behaviour

#51488
From: M Y Ben Gershon
Date: Mon, 10 May 1993 16:26
48 lines
2253 bytes
In tracing bugs in the ARM code backend for gcc, I have come across a strange
phenomenon, which only occurs in one place in one program.

In x.c.lreg:

(set (reg:SI 57)
    (plus:SI (mult:SI (reg/v:SI 36)
             (const int 4))
        (reg:SI 11 fp))) 13 {mult_accumulate}

then (after 2 deleted insns):

(set (reg:SF 61)
   (mem/s:SF (plus:SI (reg:SI 57)
        (const int -48))) 71 {movsf}

This is fine, as I have a multiply+accumulate instruction for the ARM, and
the mult_accumulate pattern in arm.md matches fine.

However, in x.c.greg onwards (x.c.jump2...) the pattern has become:

(set (reg:SI 12 sp)
    (mult:SI (reg/v:SI 4 r4)
             (const int 4)))

(set (reg:SI 0 r0)
    (plus:SI (plus:SI (reg:SI 12 ip)
            (reg:SI 13 sp))
             (const int 48))) 13 {mult_accumulate}

Now this is VERY odd.  How can the same pattern match '(plus:SI (mult:SI'
and also '(plus:SI (plus:SI' ?

What happens is that the insn template then generates a mult_accumulate
instruction instead of two additions, because 'mult_accumulate' should
only match '(plus:SI (mult:SI'.  It reads as:

(define_insn "mult_accumulate"
  [(set (match_operand:SI 0 "register_operand" "=r,=&r,=&r,=&r,=&r")
        (plus:SI
          (mult:SI (match_operand:SI 1 "arm_rhs_operand" "r,r,n,r,r")
                   (match_operand:SI 2 "arm_rhs_operand" "L,n,r,r,r"))
          (match_operand:SI 3 "arm_rhs_operand" "r,r,r,n,r")))]

Any help would be greatly appreciated.

Michael Ben-Gershon
mybg@doc.ic.ac.uk
Technical Details
Message-ID: <1slvojINN20e@swan.doc.ic.ac.uk>
Path: arc1-ca.pugleaf.net!gmd.de!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!pipex!doc.ic.ac.uk!doc.ic.ac.uk!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,f883832ff630488c,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-05-10 11:49:31 PST
Path: arc1-ca.pugleaf.net!gmd.de!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!uunet!pipex!doc.ic.ac.uk!doc.ic.ac.uk!not-for-mail
From: mybg@doc.ic.ac.uk (M Y Ben Gershon)
Newsgroups: gnu.gcc.help
Subject: Strange insn behaviour
Date: 10 May 1993 17:26:59 +0100
Organization: Department of Computing, Imperial College, University of London, UK.
Lines: 49
Sender: mybg@doc.ic.ac.uk (Michael Ben-Gershon)
Distribution: gnu
Message-ID: <1slvojINN20e@swan.doc.ic.ac.uk>
NNTP-Posting-Host: swan.doc.ic.ac.uk