[PATCH] Mips fast-isel - handle functions which return i8 or i6 .

Daniel Sanders daniel.sanders at imgtec.com
Wed Apr 22 03:43:43 PDT 2015


Comment at: lib/Target/Mips/MipsFastISel.cpp:1121-1124
@@ -1120,3 +1120,6 @@
     CCState CCInfo(CC, false, *FuncInfo.MF, RVLocs, *Context);
-    CCInfo.AnalyzeCallResult(RetVT, RetCC_Mips);
+    if (RetVT == MVT::i1 || RetVT == MVT::i8 || RetVT == MVT::i16)
+      CCInfo.AnalyzeCallResult(MVT::i32, RetCC_Mips);
+    else
+      CCInfo.AnalyzeCallResult(RetVT, RetCC_Mips);
Type promotion should be handled by RetCC_Mips where it can be used by both Fast ISel and SelectionDAG. I suggest adding 'CCIfType<[i1, i8, i16], CCPromoteToType<i32>>' to RetCC_MipsO32.

I'll explain how to run the ABI tester to verify the change off-list.

Comment at: lib/Target/Mips/MipsFastISel.cpp:1448-1449
@@ +1447,4 @@
+  // bail out to SelectionDAG.
+  if (((DestVT != MVT::i8) && (DestVT != MVT::i16) && (DestVT != MVT::i32)) ||
+      ((SrcVT != MVT::i1) && (SrcVT != MVT::i8) && (SrcVT != MVT::i16)))
+    return false;
This ought to be a test for integer types <= 32bits. For example, it's entirely possible to support i2 sign-extension to i11, or i25 zero-extension to i29. However, this will require emitIntZExt() and emitIntSExt*() to be updated to use shl/srl and shl/sra pairs, and in the case of emitIntZExt() also calculate the andi mask where appropriate.

That should be done in a later patch so no changes required at the moment.



More information about the llvm-commits mailing list