[PATCH] D29116: Regression in 4.0-rc: SPARC: allow %f-registers for inline-assembly
Patrick Boettcher via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 00:22:19 PST 2017
pboettch updated this revision to Diff 85704.
pboettch added a comment.
Added test-code in inlineasm.ll
https://reviews.llvm.org/D29116
Files:
lib/Target/Sparc/SparcISelLowering.cpp
test/CodeGen/SPARC/inlineasm.ll
Index: test/CodeGen/SPARC/inlineasm.ll
===================================================================
--- test/CodeGen/SPARC/inlineasm.ll
+++ test/CodeGen/SPARC/inlineasm.ll
@@ -94,3 +94,12 @@
%0 = call i64 asm sideeffect "xor $1, %g0, $0", "=r,0,~{i1}"(i64 5);
ret i64 %0
}
+
+;; Ensures that inline-asm accepts and uses %f registers
+; CHECK-LABEL: fabsf
+; CHECK: fabss %f0, %f0
+define float @fabsf(float) local_unnamed_addr #2 {
+entry:
+ %1 = tail call float asm sideeffect "fabss $1, $0;", "=f,f"(float %0) #7
+ ret float %1
+}
Index: lib/Target/Sparc/SparcISelLowering.cpp
===================================================================
--- lib/Target/Sparc/SparcISelLowering.cpp
+++ lib/Target/Sparc/SparcISelLowering.cpp
@@ -3383,7 +3383,9 @@
if (Constraint.size() == 1) {
switch (Constraint[0]) {
default: break;
- case 'r': return C_RegisterClass;
+ case 'r':
+ case 'f':
+ return C_RegisterClass;
case 'I': // SIMM13
return C_Other;
}
@@ -3457,6 +3459,18 @@
MVT VT) const {
if (Constraint.size() == 1) {
switch (Constraint[0]) {
+ case 'f':
+ if (VT == MVT::f32)
+ return std::make_pair(0U, &SP::FPRegsRegClass);
+ else if (VT == MVT::f64)
+ return std::make_pair(0U, &SP::DFPRegsRegClass);
+ else if (VT == MVT::f128)
+ return std::make_pair(0U, &SP::QFPRegsRegClass);
+
+ llvm_unreachable("Unknown ValueType for f-register-type!");
+
+ break;
+
case 'r':
if (VT == MVT::v2i32)
return std::make_pair(0U, &SP::IntPairRegClass);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29116.85704.patch
Type: text/x-patch
Size: 1635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170125/adb4e08d/attachment.bin>
More information about the llvm-commits
mailing list