Shuffle regression

Hi all,

I think I found a regression in the shuffle instruction. I’ve attached a replacement of fibonacci.cpp to reproduce the issue. It runs fine on release 2.3 but revision 52648 fails, and I suspect that the issue is still present.

2.3 generates the following x86 code:

03A10010 push ebp

03A10011 mov ebp,esp

03A10013 and esp,0FFFFFFF0h

03A10019 movups xmm0,xmmword ptr ds:[141D280h]

03A10020 xorps xmm1,xmm1

03A10023 movaps xmm2,xmm0

03A10026 shufps xmm2,xmm1,32h

03A1002A movaps xmm1,xmm0

03A1002D shufps xmm1,xmm2,84h

03A10031 shufps xmm0,xmm1,23h

03A10035 shufps xmm1,xmm1,40h

03A10039 shufps xmm1,xmm0,2Eh

03A1003D movups xmmword ptr ds:[14262C0h],xmm1

03A10044 mov esp,ebp

03A10046 pop ebp

03A10047 ret

While 52648 generates this:

03C60010 push ebp

03C60011 mov ebp,esp

03C60013 and esp,0FFFFFFF0h

03C60019 movups xmm0,xmmword ptr ds:[148E280h]

03C60020 xorps xmm1,xmm1

03C60023 movaps xmm2,xmm0

03C60026 shufps xmm2,xmm1,32h

03C6002A movaps xmm1,xmm0

03C6002D shufps xmm1,xmm2,84h

03C60031 shufps xmm1,xmm1,40h

03C60035 psrldq xmm0,0Ch

03C6003A shufps xmm1,xmm0,2Eh

03C6003E movups xmmword ptr ds:[148E280h],xmm1

03C60045 mov esp,ebp

03C60047 pop ebp

03C60048 ret

As I’m not using any optimization passes in this one I suspect that the issue is somewhere in instruction selection. Note the questionable use of the psrldq instruction.

If anyone could have a look at this that would be great. I’ll try to narrow down the change that caused this regression…


Nicolas Capens

fibonacci.cpp (2.07 KB)

I have fixed a related bug: 52740. Can you check if that fixes this problem?


52740 indeed fixes it. Thank you!