This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about Machine Description


yazdanbakhsh <amir.yazdanbakhsh@gmail.com> writes:

> I want to exclude all immediate or instruction. I did this by the following
> define_insn
>
> /------------------------------------------------------------------------------
> (define_insn "iorsi3" 
>   [(set (match_operand:SI 0 "register_operand" "=d,d")
> 	(ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
> 		(match_operand:SI 2 "uns_arith_operand" "d,K")))
> 		(clobber (match_scratch:SI 3 ""))]
>   ""
>   "@
>    or\\t%0,%1,%2
>    addi\\t%3,0x0,%x2\;or\\t%0,%1,%3"
>   [(set_attr "type"	"arith")
>    (set_attr "mode"	"SI")
>    (set_attr "length"	"1,2")])
> /------------------------------------------------------------------------------


No need for that, reload will do the work for you.  Just remove the
second alternative entirely.

(define_insn "iorsi3" 
  [(set (match_operand:SI 0 "register_operand" "=d")
	(ior:SI (match_operand:SI 1 "register_operand" "%d")
		(match_operand:SI 2 "register_operand" "d")))]
  ""
  "or\\t%0,%1,%2"
  [(set_attr "type"	"arith")
   (set_attr "mode"	"SI")
   (set_attr "length"	"1")])


By the way, in your define_insn you omitted the constraints from your
match_scratch.  I'm surprised it worked at all.  You should have used
"X,d".


> I use a temporary register 3, to store intermediate values. but after
> compilation the following error happen:
>
> ./libgcc2.c:669: internal error--unrecognizable insn:
> (insn 787 786 780 (set (reg:SI 104)
>         (ior:SI (reg:SI 104)
>             (const_int 65535))) -1 (insn_list 786 (nil))
>     (expr_list:REG_EQUAL (const_int 16777215)
>         (nil)))
> xgcc: Internal compiler error: program cc1 got fatal signal 6
> make: *** [libgcc2.a] Error 1

There is no clobber there, so the pattern doesn't match.  You would
have to find out what generated that insn.  It didn't come from the
usual path, which would be to call gen_iorsi3.  It must have come from
a define_expand or directly from C code.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]