This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using SCRATCH Register for a mov op,
- From: Pierre Mallard <pierremallard at yahoo dot fr>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 4 Nov 2002 11:03:12 +0100 (CET)
- Subject: Re: Using SCRATCH Register for a mov op,
Hi and thanks for paying attention to my problem,
I still got a problem around those scratch regs :
Here is how I define a mohi (I 'm gonna define
define_split later):
(define_expand "movhi"
[(parallel[(set (match_operand:HI 0
"general_operand" "=r,r,m,r,r")
(match_operand:HI 1 "general_operand"
"r,m,r,I,i"))
(clobber (match_scratch:QI 2 ""))])]
""
"{
rtx temp;
/* One of the ops has to be in a register */
if (!register_operand(operand0, HImode)
&& !register_operand(operand1, HImode))
{
operands[1] = copy_to_mode_reg(HImode,
operand1);
}
}")
(define_insn "*movhi"
[(set (match_operand:HI 0 "nonimmediate_operand"
"=r,r,m,r,r")
(match_operand:HI 1 "general_operand"
"r,m,r,I,i"))
(clobber (match_scratch:QI 2 "=X,&r,X,X,X"))]
"(register_operand (operands[0],HImode)||
register_operand (operands[1],HImode))"
"* return output_movhi (insn, operands, NULL);"
[(set_attr "length" "1,2,2,1,2")
(set_attr "cc" "none,none,none,none,none")
(set_attr "type" "none,load,none,none,none")])
But It looks like the reload pass still generate movhi
without using scratch regs :
../../gcc-3.0.4/gcc/libgcc2.c: In function `__modhi3':
../../gcc-3.0.4/gcc/libgcc2.c:773: Insn does not
satisfy its constraints:
(insn 1064 1061 1055 (parallel[
(set (reg:HI 22 r22)
(mem:HI (reg:HI 22 r22) 8))
(clobber (scratch:QI))
] ) 1 {*movhi} (nil)
(nil))
../../gcc-3.0.4/gcc/libgcc2.c:773: Internal compiler
error in reload_cse_simplify_operands, at
reload1.c:8368
--- Richard Henderson <rth@redhat.com> a écrit : > On
Wed, Oct 30, 2002 at 05:45:57PM +0100, Pierre
> Mallard wrote:
> > I'd like to use scratch reg for operation such as
> > reg X = mem(reg X) generated during the RELOAD
> PASS.
> > with X a number of a hard reg same for both side
> of
> > expression
>
> You'll have to use a PARALLEL with a (clobber
> (match_scratch)).
>
>
> r~
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com