[compiler-rt] r372684 - Fix int to bool errors exposed due to r372612.

Rumeet Dhindsa via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 19:59:02 PDT 2019


Author: rdhindsa
Date: Mon Sep 23 19:59:02 2019
New Revision: 372684

URL: http://llvm.org/viewvc/llvm-project?rev=372684&view=rev
Log:

Fix int to bool errors exposed due to r372612.
  
Differential Revision: https://reviews.llvm.org/D67937
M    lib/builtins/fp_add_impl.inc
M    lib/builtins/fp_lib.h
M    lib/builtins/fp_trunc_impl.inc

Modified:
    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

Modified: compiler-rt/trunk/lib/builtins/fp_add_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_add_impl.inc?rev=372684&r1=372683&r2=372684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_add_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_add_impl.inc Mon Sep 23 19:59:02 2019
@@ -94,7 +94,7 @@ static __inline fp_t __addXf3__(fp_t a,
   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 @@ static __inline fp_t __addXf3__(fp_t a,
     // 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;
   }

Modified: compiler-rt/trunk/lib/builtins/fp_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_lib.h?rev=372684&r1=372683&r2=372684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_lib.h (original)
+++ compiler-rt/trunk/lib/builtins/fp_lib.h Mon Sep 23 19:59:02 2019
@@ -245,7 +245,7 @@ static __inline void wideLeftShift(rep_t
 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) {

Modified: compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc?rev=372684&r1=372683&r2=372684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc Mon Sep 23 19:59:02 2019
@@ -113,7 +113,7 @@ static __inline dst_t __truncXfYf2__(src
     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;




More information about the llvm-commits mailing list