[PATCH] D14149: __builtin_signbit fix for ppcf128 type
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 28 10:54:27 PDT 2015
rjmccall added a comment.
Just a few comment suggestions, but functionally LGTM.
Comment at: lib/CodeGen/CGBuiltin.cpp:246
@@ -244,1 +245,3 @@
+ // On little-Endian, high-double will be in low part of i128.
+ // Therefore, on big-Endian we shift high part to low part.
Width >>= 1;
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.
Comment at: lib/CodeGen/CGBuiltin.cpp:252
@@ +251,3 @@
+ // After we have high-dobule in the low part of i128
+ // we need to truncate it to extract the sign.
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.
More information about the cfe-commits