PATCH: clang/LLVM - Sparc - inline ASM with floating pointer registers

Hi lists,

Sorry for cross-posting, but these two patches are of concern to clang
and llvm.

I'm compiling C-code which includes inline assembler which looks like
the following using the sparc-target:

static inline float fabsf(float a)
{
  float res;
  __asm __volatile__("fabss %1, %0;"
                     : "=f"(res)
                     : "f"(a));
  return res;
}

This fails with llvm/clang - trunk/master.

I patched clang and llvm and, as I'm new to both project, I'm having
doubts that it is enough - however it works.

What would be necessary to have it included in both projects?
Is my code correct for what I want to do?
What would have been a more appropriate process to submit?

best regards,

0001-SPARC-Allow-usage-of-floating-point-registers-in-inl.patch (2.14 KB)

0001-SPARC-allow-usage-of-floating-point-registers-in-inl.patch (1013 Bytes)

Hi Patrick,

I do not see a problem with those patches — apart from missing tests :wink:

Cheers,
Arnaud

Your change looks almost correct.

You need:

  • Test cases.
  • Add the new ‘f’ type to the documentation in LangRef.rst.
  • Check the type of the arg (f32, f64, or f128) to choose the right one of FPRegsRegClass, DFPRegsRegClass, QFPRegsRegClass.

Then, please submit for review, per http://llvm.org/docs/DeveloperPolicy.html
(Typically best to do so via Phabricator, http://llvm.org/docs/Phabricator.html)

Arnaud, James,

thank you for your feedback.

Your change looks almost correct.

You need:
- Test cases.

This one is the hardest. I don't really know where to start looking.
What kind of tests are needed?

Am I right assuming that for Clang I'll provide C-code and an
IR-reference and for LLVM IR-code and Sparc-ASM-output?

Do I need a failing test?

In regards to what I should do, which example would be the closest I
could base my work on? The test-directory is huge and that for a good
reason :-).

Then, please submit for review, per
http://llvm.org/docs/DeveloperPolicy.html
(Typically best to do so via Phabricator,
http://llvm.org/docs/Phabricator.html)

I created an account and having a quick glance I was not yet able to
find where to upload my patch for review (which was my original reason
for sending it here).

regards,