Author: jyknight
Date: Fri May 12 11:01:23 2017
New Revision: 302913

URL: http://llvm.org/viewvc/llvm-project?rev=302913&view=rev
Log:
[SPARC] Support 'f' and 'e' inline asm constraints.

Patch by Patrick Boettcher.

Differential Revision: https://reviews.llvm.org/D29117

Added:
    cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=302913&r1=302912&r2=302913&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri May 12 11:01:23 2017
@@ -6862,6 +6862,11 @@ public:
     case 'N': // Same as 'K' but zext (required for SIMode)
     case 'O': // The constant 4096
       return true;
+
+    case 'f':
+    case 'e':
+      info.setAllowsRegister();
+      return true;
     }
     return false;
   }

Added: cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/sparcv8-inline-asm.c?rev=302913&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/sparcv8-inline-asm.c (added)
+++ cfe/trunk/test/CodeGen/sparcv8-inline-asm.c Fri May 12 11:01:23 2017
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -triple sparc-unknown-unknown -emit-llvm %s -o - | 
FileCheck %s
+
+// CHECK: define float @fabsf(float %a)
+// CHECK: %{{.*}} = call float asm sideeffect "fabss $1, $0;", "=e,f"(float 
%{{.*}}) #1
+float fabsf(float a) {
+  float res;
+  __asm __volatile__("fabss  %1, %0;"
+                     : /* reg out*/ "=e"(res)
+                     : /* reg in */ "f"(a));
+  return res;
+}


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to