[PATCH] D29117: SPARC: allow usage of floating-point registers in inline ASM

Patrick Boettcher via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 24 23:45:24 PST 2017


pboettch created this revision.
Herald added a subscriber: jyknight.

Make clang recognize floating point registers in inline assembler
when using the targeting Sparc.

This code now works:

static inline float fabsf(float a)
{

  float res;
  __asm __volatile__("fabss  %1, %0;"
                     : "=f"(res)
                     : "f"(a));
  return res;

}


https://reviews.llvm.org/D29117

Files:
  lib/Basic/Targets.cpp


Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6707,6 +6707,10 @@
     case 'N': // Same as 'K' but zext (required for SIMode)
     case 'O': // The constant 4096
       return true;
+
+    case 'f':
+      info.setAllowsRegister();
+      return true;
     }
     return false;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29117.85702.patch
Type: text/x-patch
Size: 390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170125/5ff2a1a3/attachment.bin>


More information about the cfe-commits mailing list