[libc-commits] [libc] [libc][NFC] Unify `FPBits` implementations (PR #76033)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Wed Dec 20 07:22:48 PST 2023


================
@@ -84,13 +84,12 @@ struct FPBits<long double>
   }
 
   LIBC_INLINE constexpr void set_sign(bool signVal) {
-    bits &= ~SIGN_MASK;
-    StorageType sign1 = StorageType(signVal) << (TOTAL_LEN - 1);
-    bits |= sign1;
+    if (get_sign() != signVal)
----------------
gchatelet wrote:

Interestingly, it seems that clang is able to use `cmove` even with the first incarnation of the code (as opposed to GCC)
https://godbolt.org/z/x45jEszPe

https://github.com/llvm/llvm-project/pull/76033


More information about the libc-commits mailing list