[PATCH] D67937: Fix int to bool errors exposed due to r372612

Rumeet Dhindsa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 19:58:12 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372684 (authored by rdhindsa, committed by ).
Herald added a subscriber: delcypher.

Changed prior to commit:
  https://reviews.llvm.org/D67937?vs=221441&id=221459#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67937/new/

https://reviews.llvm.org/D67937

Files:
  compiler-rt/trunk/lib/builtins/fp_add_impl.inc
  compiler-rt/trunk/lib/builtins/fp_lib.h
  compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc


Index: compiler-rt/trunk/lib/builtins/fp_add_impl.inc
===================================================================
--- compiler-rt/trunk/lib/builtins/fp_add_impl.inc
+++ compiler-rt/trunk/lib/builtins/fp_add_impl.inc
@@ -94,7 +94,7 @@
   const unsigned int align = aExponent - bExponent;
   if (align) {
     if (align < typeWidth) {
-      const bool sticky = bSignificand << (typeWidth - align);
+      const bool sticky = (bSignificand << (typeWidth - align)) != 0;
       bSignificand = bSignificand >> align | sticky;
     } else {
       bSignificand = 1; // Set the sticky bit.  b is known to be non-zero.
@@ -133,7 +133,7 @@
     // The result is denormal before rounding.  The exponent is zero and we
     // need to shift the significand.
     const int shift = 1 - aExponent;
-    const bool sticky = aSignificand << (typeWidth - shift);
+    const bool sticky = (aSignificand << (typeWidth - shift)) != 0;
     aSignificand = aSignificand >> shift | sticky;
     aExponent = 0;
   }
Index: compiler-rt/trunk/lib/builtins/fp_lib.h
===================================================================
--- compiler-rt/trunk/lib/builtins/fp_lib.h
+++ compiler-rt/trunk/lib/builtins/fp_lib.h
@@ -245,7 +245,7 @@
 static __inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo,
                                               unsigned int count) {
   if (count < typeWidth) {
-    const bool sticky = *lo << (typeWidth - count);
+    const bool sticky = (*lo << (typeWidth - count)) != 0;
     *lo = *hi << (typeWidth - count) | *lo >> count | sticky;
     *hi = *hi >> count;
   } else if (count < 2 * typeWidth) {
Index: compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
===================================================================
--- compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
+++ compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
@@ -113,7 +113,7 @@
     if (shift > srcSigBits) {
       absResult = 0;
     } else {
-      const bool sticky = significand << (srcBits - shift);
+      const bool sticky = (significand << (srcBits - shift)) != 0;
       src_rep_t denormalizedSignificand = significand >> shift | sticky;
       absResult = denormalizedSignificand >> (srcSigBits - dstSigBits);
       const src_rep_t roundBits = denormalizedSignificand & roundMask;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67937.221459.patch
Type: text/x-patch
Size: 2296 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190924/64868ac5/attachment.bin>


More information about the llvm-commits mailing list