Article View: gnu.gcc.help
Article #50663Scond instructions - well actually not quite
From: David Alan Gilbert
Date: Tue, 31 Aug 1993 17:49
Date: Tue, 31 Aug 1993 17:49
54 lines
2639 bytes
2639 bytes
The Scond instructions are very useful - they set
a value to 0 if a condition is false or a constant
if the condition is true. My problem is this:
1) The constant that you set when true is picked at
compile time - I used 1. However the way which I
code the Scond instructions mean that I can place
a wide variety of constants into the true and false
arms very easily.
2) I could also make the result equal one of two registers - this
sounds useful for things like a=b?c:d
3) There is the case of code such as:
if (cond)
a=b
What define_insn or define_expand etc. do I have to do to pick up 2, and 3
and is there a way of making a more flexible (1).
The approach I tried was to add definitions of the form:
(define_insn ""
[(set (match_operand:SI 0 "register_operand" "=r,=r,=r,=r")
(if_then_else (eq (cc0) (const_int 0))
(match_operand:SI 1 "predicate" "r,I,r,I")
(match_operand:SI 2 "predicate" "r,r,I,I")))]
""
"*
output_asm_insn etc.
")
But it completely ignores these! Is there any way I can tell why - is it
my constraints/my predicates/ or am I doing something more seriously wrong?
My main interest in this comes from the dhrystone program which has a comparison
on a character variable and if it succeeds has Int_Loc=7. gcc presently
ends up using an 'sgtu' rule and a load of anding and oring - in actual
fact it was a LOT more compact with out the sgtu definitions in!
Any help on this would be greatly appreciated.
Dave
P.S. I know this is a little basic, but can someone give me an absolute
definition of when define_insn, and define_expand should be used. I think
I am write in thinking define_expand is for producing new bits of rtl,
but often you see that these just end up producing new specialist instructions
which are trapped as a new instruction.
--
-------------------------------------------------------------------------------
- David Alan Gilbert - gilbertd@cs.man.ac.uk - G7FHJ@GB7CRG -
------(Programmers don't sleep - they just park their heads)-------------------
Technical Details
Message-ID:
<gilbertd.746819368@cs.man.ac.uk>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!darwin.sura.net!europa.eng.gtefsd.com!uunet!pipex!uknet!mucs!cs.man.ac.uk!gilbertdShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,51d9b48bcb7d93d6,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-09-01 15:26:32 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!darwin.sura.net!europa.eng.gtefsd.com!uunet!pipex!uknet!mucs!cs.man.ac.uk!gilbertd From: gilbertd@cs.man.ac.uk (David Alan Gilbert) Newsgroups: gnu.gcc.help Subject: Scond instructions - well actually not quite Message-ID: <gilbertd.746819368@cs.man.ac.uk> Date: 31 Aug 93 17:49:28 GMT Sender: news@cs.man.ac.uk Lines: 54