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: Questions about match_scratch in machine description files


Fred Fish <fnf at public dot ninemoons dot com> writes:
> Another thing I don't understand, again using mips.md as an example,
> is that some templates use match_scratch but don't appear to use any
> of the temporary operands.  For example:
> 
>   (define_insn "mulsi3_mult3"
>     [(set (match_operand:SI 0 "register_operand" "=d,l")
>           (mult:SI (match_operand:SI 1 "register_operand" "d,d")
>                    (match_operand:SI 2 "register_operand" "d,d")))
>      (clobber (match_scratch:SI 3 "=h,h"))
>      (clobber (match_scratch:SI 4 "=l,X"))
>      (clobber (match_scratch:SI 5 "=a,a"))]
>     "GENERATE_MULT3_SI
>      || TARGET_MAD"
>     "*
>   {
>     if (which_alternative == 1)
>       return \"mult\\t%1,%2\";
>     if (TARGET_MAD
>         || TARGET_MIPS5400
>         || TARGET_MIPS5500
>         || ISA_MIPS32
>         || ISA_MIPS32R2
>         || ISA_MIPS64)
>       return \"mul\\t%0,%1,%2\";
>     return \"mult\\t%0,%1,%2\";
>   }"
>     [(set_attr "type"     "imul")
>      (set_attr "mode"     "SI")])
> 
> In the above, I don't see any use of %3, %4, or %5, so why are those
> match_scratch expressions there?

The idea is that 'mult r1,r2' stores the useful result in lo
('l' constraint) but also changes the value of hi ('h' constraint)
and the very dubious "hilo" register ('a').

Same thing for the three-operand mult expect that the useful
result is stored in a GPR and all of lo, hi and "hilo" are
clobbered.

Richard


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