This is the codegen equivalent of D124692.
There's some (experimental?) app for verifying IR -> AArch asm, so the codegen tests can be used to exercise that.
As shown in https://github.com/llvm/llvm-project/issues/55150 - the existing fold may be wrong when converting to a signed value.
This is a quick fix to avoid the miscompile.
https://alive2.llvm.org/ce/z/KtaDmd
We could go further - there was no test coverage added for this group of folds with:
https://github.com/llvm/llvm-project/commit/3e0023b8f6277b4b1335214bdf5ea4a76005fe33
...it seems to have been tacked on for completeness with respect to the IR transforms.
And I don't see any evidence that these patterns arise in SDAG, so we could delete the whole FoldIntToFPToInt() call.