| Issue |
209034
|
| Summary |
[PowerPC][SDAG] `fabs` on known bits of `ppc_f128` is wrong
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
folkertdev
|
The program below gives different results for clang with `-O0` versus `-O2`, where the `-O0` result agrees with GCC. So, LLVM optimizes incorrectly.
https://godbolt.org/z/sz5n5qKj9
I'm pretty sure this is wrong, the sign bit changes position on BE versus LE, and on LE it is not the most significant bit of the 128-bit value, but only of the hi double (bit 63 on LE, bit 127 on BE).
https://github.com/llvm/llvm-project/blob/83d95d89c520656306130b461252cd0ed9b4f542/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L4160-L4164
```c
/// Make this value non-negative.
void makeNonNegative() {
Zero.setSignBit();
}
/// Set the sign bit to 1.
void setSignBit() { setBit(BitWidth - 1); }
```
does not take the endianness into account.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs