[llvm] [SystemZ] SIMM32 is a signed constant (PR #118634)
Kai Nacke via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 08:19:31 PST 2024
redstar wrote:
> but it would be nice to add a test case.
Turns out to be more difficult than expected. The reason seems to be that the target type is `MVT::i64`, so the most significant 32 bit are always zero. However, in our not-yet-upstreamed 32 bit version of the backend, the type of the constant is `MVT::i32`, and then then msb matters.
Thus, the simple test
```
define i32 @foo(i32 %arg0) {
%val = add i32 %arg0, -268435456
ret i32 %val
}
```
crashes when targeting 32 bit mode, and compiles fine for 64 bit mode. The generated instruction is the same (`afi r1,-268435456`), the only difference being the type of the constant. Currently I see no way how to test this.
https://github.com/llvm/llvm-project/pull/118634
More information about the llvm-commits
mailing list