From: James Y Knight Date: Fri, 12 May 2017 16:01:23 +0000 (+0000) Subject: [SPARC] Support 'f' and 'e' inline asm constraints. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e92a9a577b6e0fdc1490d6580c013d3fdb5eed13;p=clang [SPARC] Support 'f' and 'e' inline asm constraints. Patch by Patrick Boettcher. Differential Revision: https://reviews.llvm.org/D29117 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302913 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 33eb0b05dd..92c561aa94 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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; } diff --git a/test/CodeGen/sparcv8-inline-asm.c b/test/CodeGen/sparcv8-inline-asm.c new file mode 100644 index 0000000000..711a2a0afb --- /dev/null +++ b/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; +}