Allow MIPS FastISel to handle functions which return i1/i8/i16 signed/unsigned.
Details
Diff Detail
Event Timeline
Testcase?
lib/Target/Mips/MipsFastISel.cpp | ||
---|---|---|
1103–1104 | 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. | |
1404–1405 | 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. |
Thanks. It still needs a testcase though. You may be able to re-use the calling convention test at test/CodeGen/Mips/cconv/return.ll if support for loads is good enough.
Added a testcase and modified the patch to handle ret values for i1/i8/i16
when they don't require sign/zero extension.
There's not any test for FastISel outside from the test/CodeGen/Mips/Fast-ISel directory. That's why I added the tests in the Fast-ISel directory. In the future, I would like to rename the test/CodeGen/Mips/Fast-ISel/retabi.ll file to ret.ll as we check essentially for the ret IR instruction.
LGTM
That's true at the moment, but in the long term I'd like to merge the ABI tests for FastISel with the ABI tests for SelectionDAG. I'd be surprised if they produce significantly different output for such simple tests.
test/CodeGen/Mips/Fast-ISel/retabi.ll | ||
---|---|---|
34 ↗ | (On Diff #24605) | It's mandatory to use $2 so $[[REG_S:[0-9]+]] should check for $2 instead. Similar for the other new test cases. |
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.