[i386] recognize haddpd

Marc Glisse marc.glisse@inria.fr
Tue Sep 11 11:30:00 GMT 2012


Hello,

any advice?
http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00044.html


On Sun, 2 Sep 2012, Marc Glisse wrote:

> Hello,
>
> this patch passes bootstrap+testsuite. It is probably wrong in many ways, but 
> I don't know enough to do more without some advice.
>
> The goal is to recognize that v[0]+v[1] can be computed with haddpd. With the 
> patch, v[0]-v[1] becomes hsubpd and v[1]+v[0] becomes haddpd. Also, thanks to 
> it, {v[0]-v[1], w[0]-w[1]} is now recognized as a single hsubpd.
>
> 1) Is a define_insn the right tool?
> 2) {v[0]-v[1], v[0]-v[1]} is not recognized as a hsubpd because vec_duplicate 
> doesn't match vec_concat. Do we really need to duplicate (no pun intended) 
> the pattern?
> 3) v[0]+v[1] is not recognized. Some pass changed their order, and nothing 
> tries the reverse order. I can see 3 ways: canonicalize the order at some 
> point, let combine try both orders for commutative operators or make the 
> patterns more flexible (I don't know how many would need changing).
> 4) I don't understand the set_attr part. I copied it from the haddpd 
> define_insn, and removed (set_attr "type" "sseadd") because it crashed the 
> compiler. isa and prefix make sense and they match the alternatives, but I am 
> not sure about "mode" (removing it still works IIRC).
>
>
> 2012-09-02  Marc Glisse  <marc.glisse@inria.fr>
>
> gcc/
> 	* config/i386/sse.md (*sse3_h<plusminus_insn>v2df3_low): New.
>
> gcc/testsuite/
> 	* gcc.target/i386/pr54400.c: New testcase.

-- 
Marc Glisse



More information about the Gcc-patches mailing list