This revision was automatically updated to reflect the committed changes.
Closed by commit rL302913: [SPARC] Support 'f' and 'e' inline asm constraints. 
(authored by jyknight).

Changed prior to commit:
  https://reviews.llvm.org/D29117?vs=85708&id=98782#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29117

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


Index: cfe/trunk/lib/Basic/Targets.cpp
===================================================================
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -6862,6 +6862,11 @@
     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;
   }
Index: cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
===================================================================
--- cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
+++ cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
@@ -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;
+}


Index: cfe/trunk/lib/Basic/Targets.cpp
===================================================================
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -6862,6 +6862,11 @@
     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;
   }
Index: cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
===================================================================
--- cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
+++ cfe/trunk/test/CodeGen/sparcv8-inline-asm.c
@@ -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