pboettch updated this revision to Diff 85708.
pboettch added a comment.

Added  test-code.


https://reviews.llvm.org/D29117

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


Index: test/CodeGen/sparcv8-inline-asm.c
===================================================================
--- /dev/null
+++ 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) #0 {
+// CHECK: %2 = call float asm sideeffect "fabss  $1, $0;", "=f,f"(float %1) #1
+float fabsf(float a) {
+  float res;
+  __asm __volatile__("fabss  %1, %0;"
+                     : /* reg out*/ "=f"(res)
+                     : /* reg in */ "f"(a));
+  return res;
+}
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;
   }


Index: test/CodeGen/sparcv8-inline-asm.c
===================================================================
--- /dev/null
+++ 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) #0 {
+// CHECK: %2 = call float asm sideeffect "fabss  $1, $0;", "=f,f"(float %1) #1
+float fabsf(float a) {
+  float res;
+  __asm __volatile__("fabss  %1, %0;"
+                     : /* reg out*/ "=f"(res)
+                     : /* reg in */ "f"(a));
+  return res;
+}
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;
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D29117: SPARC: a... Patrick Boettcher via Phabricator via cfe-commits
    • [PATCH] D29117: SPA... Patrick Boettcher via Phabricator via cfe-commits

Reply via email to