Page MenuHomePhabricator

[PowerPC] Support constraint 'wi' in asm
ClosedPublic

Authored by HLJ2009 on Oct 14 2018, 8:24 PM.

Details

Summary

From the gcc manual, we can see that the specific limit of wi inline asm is “FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS”. The link is https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Machine-Constraints.html#Machine-Constraints.
If we use the following code to test

int foo(vector float __A)
{
  int res = 0;
  vector float vtmp;
  __asm__(
      "xxsldwi %x1,%x2,%x2,3;\n"
      "xscvspdp %x1,%x1;\n"
      "fctiw  %1,%1;\n"
      "mfvsrd  %0,%x1;\n"
      : "=r" (res),
        "=&wi" (vtmp)
      : "wa" (__A)
      : );
  return (res);
}

We found that it would produce the following error
asm_wi.c:12:2: error: invalid output constraint '=&wi' in asm
"=&wi" (vtmp)
^
1 error generated.
We should accept this constraint.

Diff Detail

Repository
rC Clang

Event Timeline

HLJ2009 created this revision.Oct 14 2018, 8:24 PM

gentle pinging

jsji accepted this revision.Oct 30 2018, 1:44 PM

This LGTM. Thanks for fixing.

This revision is now accepted and ready to land.Oct 30 2018, 1:44 PM
Closed by commit rC345809: [Clang][PowerPC] Support constraint 'wi' in asm (authored by helijia, committed by ). · Explain WhyOct 31 2018, 7:36 PM
This revision was automatically updated to reflect the committed changes.