public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Predicated execution / if-conversion?
@ 2004-01-21 15:58 Jan Hoogerbrugge
  2004-01-21 18:44 ` Richard Henderson
  2004-01-21 19:04 ` Jim Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Hoogerbrugge @ 2004-01-21 15:58 UTC (permalink / raw)
  To: gcc

Hi,

My target processor supports predicated execution so I want to
exploit this. Like conditional branches in my architecture,
prediction works on the least significant bit of a register.
So I have to use BImode for the result of compare operations.

Could somebody tell me how to start with modelling predicated
execution? With a few exceptions, all operations can be
predicated. I noticed that the FRV port defines the IFCVT
macros. Is that necessary or only to model more complex cases?
What do I have to do in the .md file? Are there ports that
I should study? I noticed  "%," and current_insn_predicate
in the ia64 port. How does this work?

Thanks,
Jan

_________________________________________________________________
Play online games with your friends with MSN Messenger 
http://messenger.msn.nl/

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

* Re: Predicated execution / if-conversion?
  2004-01-21 15:58 Predicated execution / if-conversion? Jan Hoogerbrugge
@ 2004-01-21 18:44 ` Richard Henderson
  2004-01-21 19:04 ` Jim Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2004-01-21 18:44 UTC (permalink / raw)
  To: Jan Hoogerbrugge; +Cc: gcc

On Wed, Jan 21, 2004 at 04:33:33PM +0100, Jan Hoogerbrugge wrote:
> Could somebody tell me how to start with modelling predicated
> execution?  With a few exceptions, all operations can be
> predicated.

Then your best model is ia64.  You need to add

;; Predication.  True iff this instruction can be predicated.
(define_attr "predicable" "no,yes" (const_string "yes"))

and then set the attribute to "no" for those exceptions.
You also need to add

;; General predication pattern
(define_cond_exec
  [(match_operator 0 "predicate_operator"
    [(match_operand:BI 1 "register_operand" "c")
     (const_int 0)])]
  ""
  "")

> I noticed that the FRV port defines the IFCVT
> macros. Is that necessary or only to model more complex cases?

Complex cases.  FRV has a reasonably restricted form of predication.

> I noticed  "%," and current_insn_predicate in the ia64 port.
> How does this work?

The insn scanner in final recognizes the 

	(cond_exec (predicate)
	  (regular-insn))

form, sets up current_insn_predicate with (predicate), and then
calls the output pattern.  This is a conveniece to make the 
output patterns easier to write.  The "%," processing happens
in ia64_print_operand.

As for the rest of the output, that depends on your assembly
syntax.  IA-64 uses a prefix, and so is handed by the prefix
in define_cond_exec; ARM uses a suffix, and so is handled by
arm_print_operand with "%?".  Hopefully your syntax isn't 
more horrible than one of those two alternatives.  ;-)


r~

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

* Re: Predicated execution / if-conversion?
  2004-01-21 15:58 Predicated execution / if-conversion? Jan Hoogerbrugge
  2004-01-21 18:44 ` Richard Henderson
@ 2004-01-21 19:04 ` Jim Wilson
  2004-01-22  4:19   ` Geert Bosch
  1 sibling, 1 reply; 5+ messages in thread
From: Jim Wilson @ 2004-01-21 19:04 UTC (permalink / raw)
  To: Jan Hoogerbrugge; +Cc: gcc

Jan Hoogerbrugge wrote:
> I should study? I noticed  "%," and current_insn_predicate
> in the ia64 port. How does this work?

See the "Conditional Execution" section of the documentation which 
explains how this works.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

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

* Re: Predicated execution / if-conversion?
  2004-01-21 19:04 ` Jim Wilson
@ 2004-01-22  4:19   ` Geert Bosch
  2004-01-22  5:54     ` Jim Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Bosch @ 2004-01-22  4:19 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Jan Hoogerbrugge, gcc


On Jan 21, 2004, at 14:04, Jim Wilson wrote:
> Jan Hoogerbrugge wrote:
>> I should study? I noticed  "%," and current_insn_predicate
>> in the ia64 port. How does this work?
>
> See the "Conditional Execution" section of the documentation which 
> explains how this works.

This indicates that a comment referencing the documentation would be 
useful.

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

* Re: Predicated execution / if-conversion?
  2004-01-22  4:19   ` Geert Bosch
@ 2004-01-22  5:54     ` Jim Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Wilson @ 2004-01-22  5:54 UTC (permalink / raw)
  To: Geert Bosch; +Cc: Jan Hoogerbrugge, gcc

On Wed, 2004-01-21 at 19:39, Geert Bosch wrote:
> This indicates that a comment referencing the documentation would be 
> useful.

This is a simple case of RTFM.  I see no point in adding comments that
remind people to read the documentation.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

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

end of thread, other threads:[~2004-01-22  4:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 15:58 Predicated execution / if-conversion? Jan Hoogerbrugge
2004-01-21 18:44 ` Richard Henderson
2004-01-21 19:04 ` Jim Wilson
2004-01-22  4:19   ` Geert Bosch
2004-01-22  5:54     ` Jim Wilson

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