[PATCH, rs6000] Fix constraints issue in _mm_cvtss_si{32,64}

Segher Boessenkool segher@kernel.crashing.org
Thu Nov 8 22:51:00 GMT 2018


Hi!

On Thu, Nov 08, 2018 at 02:18:51PM -0600, Bill Schmidt wrote:
> We recently discovered that GCC is getting lucky with register allocation of
> some inline assembly code, despite invalid register constraints.  In these
> two functions, a "wi" constraint (VSX valid for direct moves) was used for a 

"wi" is not direct move only, that is "wj".  "wi" is for DImode in VSX.
It allows all VSX registers (or nothing at all).

> temporary that, as written, is further constrained to be an FPR.  This patch
> fixes the problem by introducing a separate temporary with an "f" constraint
> and breaking the lifetime of the existing temporary.  The existing temporary
> can now have a less onerous "wa" constraint as it is no longer used within a
> direct move instruction.

It could already use a "wa", and the "f" isn't needed at all?  But it
should use xsrdpic then, i.e. the VSX instruction instead of the FP insn.
Maybe that only works for 64 bit though (for the overflow behaviour).  Hrm.
Although it doesn't currently implement overflow behaviour correctly either!

Your code is not wrong though, so okay for trunk.  Thanks!


Segher



More information about the Gcc-patches mailing list