public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* fuse multiple ops into one new op
@ 2014-08-01 23:18 Cherry Vanc
  2014-08-02  7:02 ` Marc Glisse
  2014-08-02  9:52 ` Jeff Law
  0 siblings, 2 replies; 8+ messages in thread
From: Cherry Vanc @ 2014-08-01 23:18 UTC (permalink / raw)
  To: gcc-help

I need to fuse multiple instructions into a single one.
...
r1 = (r1) op1 (const)
...
...
r1 = (r1) op2 (r2)
...
...
r3 = op3 (r1)
...

I defined a peephole2 pattern in my GCC backend .md file. If these
three instructions are contiguous, then I do get my test "testnew"
instruction. If these instructions are far apart, I dont.

(define_peephole2
  [(set (match_operand:DI 0 "register_operand" "")
    (op1:DI (match_dup 0) (match_operand:SI 1 "immediate_operand" "") ))
  (set (match_dup 0)
    (op2:DI (match_operand:DI 2 "register_operand" "") (match_dup 0)))
  (set (match_dup 0)
    (sign_extend:DI (op3:SI (match_dup 0))))]
  "TARGET_MYCORE"
  [(set (match_dup 0) (sign_extend:DI (op3:SI (op2:SI (op1:SI
(match_dup 0) (match_dup 1)) (match_dup 0)))))]
  "")

(define_insn "*testnew"
  [(set (match_operand:DI 0 "register_operand" "=d")
        (sign_extend:DI (op3:SI (op2:SI (op1:SI (match_dup 0)
(match_operand:SI 1 "immediate_operand" "I")) (match_dup 0)))))]
  "TARGET_MYCORE"
  "testnew 36"
  [(set_attr "mode" "DI")])

How can I fuse multiple instructions that are far apart into a new
single opcode that MYCORE has ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-07 18:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-01 23:18 fuse multiple ops into one new op Cherry Vanc
2014-08-02  7:02 ` Marc Glisse
2014-08-02  9:09   ` Oleg Endo
2014-08-02  9:52 ` Jeff Law
2014-08-05 23:26   ` Cherry Vanc
2014-08-05 23:27     ` Cherry Vanc
2014-08-06  5:51     ` Marc Glisse
2014-08-07 18:35       ` Cherry Vanc

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).