Fixing sign extension in makeLibCall for MIPS64. In MIPS64 architecture all 32 bit arguments (int, unsigned int, float 32 (soft float)) must be sign extended. This fixes test "MultiSource/Applications/oggenc/"
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This is target-independent code, what does, "This should not affect other architectures." mean? Maybe you need a new target callback? Why does this affect only FRINT and not also FCEIL, FTRUNC, FNEARBYINT, FROUND, FFLOOR?
test/CodeGen/Mips/mips64rintfsf.ll | ||
---|---|---|
21 ↗ | (On Diff #20406) | Please remove any unnecessary attributes. |
I think you are right about target callback, did you have something like this in mind ? I currently found the problem in this function. The problem exist in other functions, but I haven't seen it manifest yet. I will do some extra tests on those functions next. I have seen GCC and LLVM (for other cases) do sign extension on float arguments.
include/llvm/Target/TargetLowering.h | ||
---|---|---|
1074 ↗ | (On Diff #21578) | Can you please add a comment before the function? |
lib/Target/Mips/MipsISelLowering.cpp | ||
3034 ↗ | (On Diff #21578) | Nit: remove empty line. |
3035 ↗ | (On Diff #21578) | I believe you should be checking for Subtarget.abiUsesSoftFloat() too. |
3036 ↗ | (On Diff #21578) | Remove empty line. |
lib/Target/Mips/MipsISelLowering.h | ||
477 ↗ | (On Diff #21578) | Add an empty line above this. |
Regarding the other functions, is there a reason why the obvious modification to the regression test for this one won't work?
Generically, I'd like to see as much testing coverage as possible; when you make the change, I think that it should be done for all of the functions in a consistent manner. Please test as much as you can, but if there are some you can't on your target, that's okay.
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | ||
---|---|---|
494 ↗ | (On Diff #21591) | Why did you name the callback shouldSignExtendFloat32InAbiCall when the use is not specific to f32? I recommend having the callback take the type, and taking Float32 out of the name. |
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | ||
---|---|---|
494 ↗ | (On Diff #21591) | The need for this change comes from MIPS64 decision to keep 32-bit values in registers by sign-extending them to 64 bits. |
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | ||
---|---|---|
494 ↗ | (On Diff #21591) | No, this is target-independent code. |
makeLibCall function is patched, now every function argument and return value are sign extended if needed. In MIPS64 architecture all 32 bit arguments (int, unsigned int, float 32) must be sign extended. In makeLibCall function 32 bit arguments are converted to int32, so there is check if is any MIPS64 architecture, soft float ABI, and int 32 type then do sign extension. This patch is only for MIPS64 and doesn't affect other architectures.
include/llvm/Target/TargetLowering.h | ||
---|---|---|
1075 ↗ | (On Diff #22252) | This is certainly better, my only issue now is with the function name. The term 'ABI call' seems ambiguous (and appears in the Mips backend, but nowhere else in the same way), and this specifically applies to calls generated with makeLibCall. How about naming it? shouldSignExtendTypeInLibCall which seems to fit better with general LLVM terminology. |