Different multiply operator for pointers and integers

Laura Tosoratto Laura.Tosoratto@roma1.infn.it
Thu Dec 16 18:13:00 GMT 2004


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?

Thanks,
Laura



More information about the Gcc mailing list