This is an archive of the discontinued LLVM Phabricator instance.

[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
This revision was automatically updated to reflect the committed changes.