* how to force reloader(?) to respect clobber directive?
@ 2002-02-26 1:20 Dmitry
2002-02-26 9:51 ` Richard Henderson
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry @ 2002-02-26 1:20 UTC (permalink / raw)
To: gcc
Fellows,
I define:
(define_insn "tstsi"
[(set (cc0) (match_operand:SI 0 "register_operand" "r"))
(clobber (match_dup 0))]
""
"* return msp430_emit_tstsi(insn, operands, NULL);"
[(set_attr "length" "2")
(set_attr "cc" "compare")])
Compiler produces a code in which 0 operand clobbered and used after this insn as being saved.
Should I define something extra to say to gcc to threat 0 operand as clobbered after insn?
Thanks,
~d
*********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 314-8860, 5585314
*********************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to force reloader(?) to respect clobber directive?
2002-02-26 1:20 how to force reloader(?) to respect clobber directive? Dmitry
@ 2002-02-26 9:51 ` Richard Henderson
2002-02-26 11:41 ` Dimmy
0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2002-02-26 9:51 UTC (permalink / raw)
To: Dmitry; +Cc: gcc
On Tue, Feb 26, 2002 at 12:13:43PM +0300, Dmitry wrote:
> (define_insn "tstsi"
> [(set (cc0) (match_operand:SI 0 "register_operand" "r"))
> (clobber (match_dup 0))]
The constraint must be "+r" in this case.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to force reloader(?) to respect clobber directive?
2002-02-26 9:51 ` Richard Henderson
@ 2002-02-26 11:41 ` Dimmy
2002-02-26 11:47 ` Jan Hubicka
0 siblings, 1 reply; 5+ messages in thread
From: Dimmy @ 2002-02-26 11:41 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc
Thanks Richard,
"+r" did not help much.
Actually, I transform a condition code of the insn followed by.
So, for the code given:
long foo(long a, long b)
{
if(a>0) goto ee;
return a;
ee:
return b;
}
gcc wants to use LE condition code. Whithin tstsi operation I'm setting cond code for the next insn to LT.
Then I get: ('a' being passed in r14,r15, 'b' - in r12,r13; returns in r14,r15)
----------------
aa:
/* prologue: frame size = 0 */
.L__FrameSize_aa=0x0
/* prologue end (size=0) */
/* UID:11 ** ADDR:0 ** COST:16 *
(insn:QI 11 34 12 (parallel[
(set (cc0)
(reg/v:SI 14 r14 [22]))
(clobber (reg/v:SI 14 r14 [22]))
] ) 19 {tstsi} (insn_list 4 (nil))
(expr_list:REG_DEAD (reg/v:SI 14 r14 [22])
(nil)))
*****************/
sub #1, r14 ; 11 tstsi [length = 2]
subc #0, r15
/* UID:12 ** ADDR:2 ** COST:26 *
(jump_insn 12 11 22 (set (pc)
(if_then_else (lt (cc0)
(const_int 0 [0x0]))
(label_ref 32)
(pc))) 132 {blt} (nil)
(expr_list:REG_BR_PROB (const_int 3999 [0xf9f])
(nil)))
*****************/
jl .L1 ; .L1 ; 12 blt [length = 2]
.L3:
/* UID:26 ** ADDR:4 ** COST:4 *
(insn 26 35 32 (set (reg/i:SI 14 r14)
(reg/v:SI 12 r12 [23])) 48 {*movsi3} (nil)
(expr_list:REG_DEAD (reg/v:SI 12 r12 [23])
(nil)))
*****************/
mov r12, r14 ; 26 *movsi3 [length = 2]
mov r13, r15
.L1:
/* epilogue: frame size=0 */
ret
/* epilogue end (size=1) */
/* function aa size 7 (6) */
.Lfe1:
.size aa,.Lfe1-aa
----------------
So, as follows from the RTL dump reg:SI 14 dead, but gcc uses it as return operand.
Did I miss something here?
On Tue, 26 Feb 2002 09:44:56 -0800
Richard Henderson <rth@redhat.com> wrote:
> On Tue, Feb 26, 2002 at 12:13:43PM +0300, Dmitry wrote:
> > (define_insn "tstsi"
> > [(set (cc0) (match_operand:SI 0 "register_operand" "r"))
> > (clobber (match_dup 0))]
>
> The constraint must be "+r" in this case.
>
>
> r~
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to force reloader(?) to respect clobber directive?
2002-02-26 11:41 ` Dimmy
@ 2002-02-26 11:47 ` Jan Hubicka
2002-02-26 12:49 ` Dimmy
0 siblings, 1 reply; 5+ messages in thread
From: Jan Hubicka @ 2002-02-26 11:47 UTC (permalink / raw)
To: Dimmy; +Cc: Richard Henderson, gcc
> > On Tue, Feb 26, 2002 at 12:13:43PM +0300, Dmitry wrote:
> > > (define_insn "tstsi"
> > > [(set (cc0) (match_operand:SI 0 "register_operand" "r"))
> > > (clobber (match_dup 0))]
> >
> > The constraint must be "+r" in this case.
My guess is that when expanding the insn you overwrite the input operand,
you should not.
In such situations you should probably use match_scratch construct to
get the output operand.
Honza
> >
> >
> > r~
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how to force reloader(?) to respect clobber directive?
2002-02-26 11:47 ` Jan Hubicka
@ 2002-02-26 12:49 ` Dimmy
0 siblings, 0 replies; 5+ messages in thread
From: Dimmy @ 2002-02-26 12:49 UTC (permalink / raw)
To: Jan Hubicka; +Cc: rth, gcc
Jan,
yes, match_scratch does work...
But this is not that simple:
I have to decide do I or do I not need a scratch register upon next insn condition code.
So, if I can pass 'insn' to the preparation statement in expander (i need something like:
rtx nextinsn = NEXT_INSN(insn);) - everything fine!
But how?
Thanks,
Dmitry.
On Tue, 26 Feb 2002 20:34:16 +0100
Jan Hubicka <jh@suse.cz> wrote:
> > > On Tue, Feb 26, 2002 at 12:13:43PM +0300, Dmitry wrote:
> > > > (define_insn "tstsi"
> > > > [(set (cc0) (match_operand:SI 0 "register_operand" "r"))
> > > > (clobber (match_dup 0))]
> > >
> > > The constraint must be "+r" in this case.
> My guess is that when expanding the insn you overwrite the input operand,
> you should not.
> In such situations you should probably use match_scratch construct to
> get the output operand.
>
> Honza
> > >
> > >
> > > r~
> > >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-02-26 19:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26 1:20 how to force reloader(?) to respect clobber directive? Dmitry
2002-02-26 9:51 ` Richard Henderson
2002-02-26 11:41 ` Dimmy
2002-02-26 11:47 ` Jan Hubicka
2002-02-26 12:49 ` Dimmy
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).