[PATCH] D51614: [Sparc] Use float register for integer constrained with "f" in inline asm

Daniel Cederman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 07:16:53 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL349045: [Sparc] Use float register for integer constrained with "f"  in inline asm (authored by dcederman, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51614?vs=163764&id=178062#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D51614/new/

https://reviews.llvm.org/D51614

Files:
  llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
  llvm/trunk/test/CodeGen/SPARC/inlineasm.ll


Index: llvm/trunk/test/CodeGen/SPARC/inlineasm.ll
===================================================================
--- llvm/trunk/test/CodeGen/SPARC/inlineasm.ll
+++ llvm/trunk/test/CodeGen/SPARC/inlineasm.ll
@@ -130,3 +130,16 @@
   tail call void asm sideeffect "faddd $0,$1,$2", "{f20},{f20},{f20}"(double 9.0, double 10.0, double 11.0)
   ret void
 }
+
+; CHECK-LABEL: test_constraint_f_e_i32_i64:
+; CHECK: ld [%o0+%lo(.LCPI13_0)], %f0
+; CHECK: ldd [%o0+%lo(.LCPI13_1)], %f2
+; CHECK: fadds %f0, %f0, %f0
+; CHECK: faddd %f2, %f2, %f0
+
+define void @test_constraint_f_e_i32_i64() {
+entry:
+  %0 = call float asm sideeffect "fadds $1, $2, $0", "=f,f,e"(i32 0, i32 0)
+  %1 = call double asm sideeffect "faddd $1, $2, $0", "=f,f,e"(i64 0, i64 0)
+  ret void
+}
Index: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
+++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
@@ -3261,23 +3261,23 @@
       else
         return std::make_pair(0U, &SP::IntRegsRegClass);
     case 'f':
-      if (VT == MVT::f32)
+      if (VT == MVT::f32 || VT == MVT::i32)
         return std::make_pair(0U, &SP::FPRegsRegClass);
-      else if (VT == MVT::f64)
+      else if (VT == MVT::f64 || VT == MVT::i64)
         return std::make_pair(0U, &SP::LowDFPRegsRegClass);
       else if (VT == MVT::f128)
         return std::make_pair(0U, &SP::LowQFPRegsRegClass);
-      llvm_unreachable("Unknown ValueType for f-register-type!");
-      break;
+      // This will generate an error message
+      return std::make_pair(0U, nullptr);
     case 'e':
-      if (VT == MVT::f32)
+      if (VT == MVT::f32 || VT == MVT::i32)
         return std::make_pair(0U, &SP::FPRegsRegClass);
-      else if (VT == MVT::f64)
+      else if (VT == MVT::f64 || VT == MVT::i64 )
         return std::make_pair(0U, &SP::DFPRegsRegClass);
       else if (VT == MVT::f128)
         return std::make_pair(0U, &SP::QFPRegsRegClass);
-      llvm_unreachable("Unknown ValueType for e-register-type!");
-      break;
+      // This will generate an error message
+      return std::make_pair(0U, nullptr);
     }
   } else if (!Constraint.empty() && Constraint.size() <= 5
               && Constraint[0] == '{' && *(Constraint.end()-1) == '}') {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51614.178062.patch
Type: text/x-patch
Size: 2334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181213/047dd290/attachment.bin>


More information about the llvm-commits mailing list