[MIPS][LS2][2/5] Vector intrinsics

Maxim Kuvyrkov maxim@codesourcery.com
Wed Jun 11 20:34:00 GMT 2008


Richard Sandiford wrote:
> Maxim Kuvyrkov <maxim@codesourcery.com> writes:

...

>> +;; Addition of doubleword integers stored in FP registers.
>> +;; Overflow is treated by wraparound.
>> +(define_insn "paddd"
>> +  [(set (match_operand:DI 0 "register_operand" "=f")
>> +        (plus:DI (match_operand:DI 1 "register_operand" "f")
>> +		 (match_operand:DI 2 "register_operand" "f")))]
>> +  "HAVE_LOONGSON_VECTOR_MODES"
>> +  "paddd\t%0,%1,%2")
> 
> I don't think this pattern or psubd will ever be used for 64-bit ABIs;
> they'll be trumped by the normal addition and subtraction patterns.
> Thus paddd (...) and psub (...) will actually expand to "daddu" and
> "dsubu", moving to and from FPRs if necessary.

I think this is separate problem from what this patch tries to solve. 
The main objective of this patch is to add intrinsics that can be used 
to write hand-optimized code.

I tried to write a proper support for all the different cases of DImode 
add/sub today and the result just doesn't look good enough.

> Also, you _might_ end up
> using these patterns for 64-bit addition on 32-bit ABIs, even though the
> cost of moving to and from FPRs is higher than the usual add/shift
> sequence.

Right.  Although, my recollection from last time I looked at splitter is 
that if splitter sees something it can split, it splits it.

For the time being, I propose to replace 'plus' in paddd and 'minus' in 
psubd with unspecs.  This way the intrinsics will still work, and 
there'll be no clashes with add<mode>3 and sub<mode>3.

I attached two patches that implement different approaches.  My opinion 
is that we shouldn't complicate things and, therefore, should accept the 
simple solution.

> Finally, I adjusted the patch so that it applies on top of the
> built-in-table patch I sent yesterday in the [3/5] thread.
> 
> I've not done anything about the paddd/psubd thing; I'll leave
> that to you ;)  Otherwise, does this look OK to you?

Yes, the patch looks great, thanks.  I'm testing it right now together 
with the simple fix for paddd/psubd issue.

--
Maxim
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fsf-ls2ef-2.1-vector.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080611/71fb20bf/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fsf-ls2ef-2.2-vector.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080611/71fb20bf/attachment-0001.ksh>


More information about the Gcc-patches mailing list