This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Different multiply operator for pointers and integers
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Laura Tosoratto'" <Laura dot Tosoratto at roma1 dot infn dot it>,<gcc at gcc dot gnu dot org>
- Cc: "'Alessandro Lonardo'" <alessandro dot lonardo at roma1 dot infn dot it>
- Date: Thu, 16 Dec 2004 18:31:47 -0000
- Subject: RE: Different multiply operator for pointers and integers
> -----Original Message-----
> From: Laura Tosoratto
> Sent: 16 December 2004 18:13
> Dave Korn wrote:
>
> >>-----Original Message-----
> >>From: gcc-owner On Behalf Of Richard Earnshaw
> >>Sent: 16 December 2004 16:40
> >>On Thu, 2004-12-16 at 16:32, Laura Tosoratto wrote:
> >>>In the same time, it needs all addresses to be hold in a
> >>specific part
> >>>of register file (we defined a reg_class to represent this
> >>set of regs) .
> >>You just need to provide multiple alternatives to the
> >>standard multiply operator.
> >>
> >>If your two register classes are matched by the constraint
> letters 'x'
> >>and 'y' respectively, then you just need a pattern something like
> >>
> >>(define_insn "muldi"
> >> [(set (match_operand:DI 0 "register_operand" "=x,y")
> >> (mult:DI (match_operand:DI 1 "register_operand" "%x,y")
> >> (match_operand:DI 2 "register_operand" "x,y")))]
> >> ""
> >> "@
> >> mult_fmt1 %0, %1, %2
> >> mult_fmt2 %0, %1, %2")
> >
> > Doesn't that assume that the registers that hold pointers
> can _only_ be used
> >for pointers and not for integers? It doesn't necessarily
> follow from Laura's
> >original description that those registers _can't_ hold
> integers, only that
> >pointers _must_ be in one of them.
> >
> > cheers,
> > DaveK
> >
> >
> Yes, those registers _can_ hold integers but they _must_ hold
> pointers.
> The mult_i instruction must be used when operands are
> integers, and the
> mult_a instruction must be used when one of the operands is a pointer.
>
> Can I do all the work with constraint letters?
I think it may work if you define your constraint letters to not just test the
register class, but also to check the mode of the rtx, using the workaround of
defining Pmode to not be the same as any of the usual modes, but I don't have
the depth and breadth of experience with gcc that the two Richards have, so I
would defer to their judgement if they say otherwise....
cheers,
DaveK
--
Can't think of a witty .sigline today....