Function__builtin_signbit returns wrong value for type ppcf128 on big endian machines. This patch fixes how value is generated in that case, and generate correct value.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Just a few comment suggestions, but functionally LGTM.
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
246 | Hmm, let's merge these the old and new comments a bit: We want the sign bit of the higher-order double. The bitcast we just | |
253 | Typo: dobule. Also, we're not quite extracting the sign yet; we're truncating as a way to extract the higher-order double, which we'll extract the sign from in a second. |
Hmm, let's merge these the old and new comments a bit:
We want the sign bit of the higher-order double. The bitcast we just
did works as if the double-double was stored to memory and then
read as an i128. The "store" will put the higher-order double in the
lower address in both little- and big-Endian modes, but the "load"
will treat those bits as a different part of the i128: the low bits in
little-Endian, the high bits in big-Endian. Therefore, on big-Endian
we need to shift the high bits down to the low before truncating.