Different multiply operator for pointers and integers

Richard Earnshaw rearnsha@gcc.gnu.org
Thu Dec 16 16:40:00 GMT 2004


On Thu, 2004-12-16 at 16:32, Laura Tosoratto wrote:
> Hi,
> we're porting GCC on a parallel architecture with a large register file 
> and where pointers and integers have the same 64 bit format.
> However the machine manages pointers arithmetics and integers 
> arithmetics through two different multiply instructions.
> 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) .
> We found two ways to implement these features:
> -defining Pmode as different from other integer modes ( PSImode or 
> similar), and so providing different sets of insn patterns for pointers 
> and integers
> or
> -introducing the address multiply operator at the tree level.
> 
> Which choice do you think would be the most effective?

Neither, by the sound of it.

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")




More information about the Gcc mailing list