[SPARC] Support 'f' and 'e' inline asm constraints.

Patch by Patrick Boettcher.

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

llvm-svn: 302913
This commit is contained in:
James Y Knight 2017-05-12 16:01:23 +00:00
parent b680e9742a
commit eb96e44aea
2 changed files with 16 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}