[PATCH] D86547: [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z

Anatoly Trosinenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 30 12:06:56 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4bcd2588a986: [compiler-rt][builtins] Use c[tl]zsi macro instead of __builtin_c[tl]z (authored by atrosinenko).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86547

Files:
  compiler-rt/lib/builtins/floatsisf.c
  compiler-rt/lib/builtins/floatsitf.c
  compiler-rt/lib/builtins/floatunsisf.c
  compiler-rt/lib/builtins/floatunsitf.c
  compiler-rt/lib/builtins/fp_extend.h
  compiler-rt/lib/builtins/udivmoddi4.c


Index: compiler-rt/lib/builtins/udivmoddi4.c
===================================================================
--- compiler-rt/lib/builtins/udivmoddi4.c
+++ compiler-rt/lib/builtins/udivmoddi4.c
@@ -82,7 +82,7 @@
         r.s.high = n.s.high & (d.s.high - 1);
         *rem = r.all;
       }
-      return n.s.high >> __builtin_ctz(d.s.high);
+      return n.s.high >> ctzsi(d.s.high);
     }
     // K K
     // ---
@@ -112,7 +112,7 @@
           *rem = n.s.low & (d.s.low - 1);
         if (d.s.low == 1)
           return n.all;
-        sr = __builtin_ctz(d.s.low);
+        sr = ctzsi(d.s.low);
         q.s.high = n.s.high >> sr;
         q.s.low = (n.s.high << (n_uword_bits - sr)) | (n.s.low >> sr);
         return q.all;
Index: compiler-rt/lib/builtins/fp_extend.h
===================================================================
--- compiler-rt/lib/builtins/fp_extend.h
+++ compiler-rt/lib/builtins/fp_extend.h
@@ -33,9 +33,9 @@
   return __builtin_clzl(a);
 #else
   if (a & REP_C(0xffffffff00000000))
-    return __builtin_clz(a >> 32);
+    return clzsi(a >> 32);
   else
-    return 32 + __builtin_clz(a & REP_C(0xffffffff));
+    return 32 + clzsi(a & REP_C(0xffffffff));
 #endif
 }
 
Index: compiler-rt/lib/builtins/floatunsitf.c
===================================================================
--- compiler-rt/lib/builtins/floatunsitf.c
+++ compiler-rt/lib/builtins/floatunsitf.c
@@ -25,7 +25,7 @@
     return fromRep(0);
 
   // Exponent of (fp_t)a is the width of abs(a).
-  const int exponent = (aWidth - 1) - __builtin_clz(a);
+  const int exponent = (aWidth - 1) - clzsi(a);
   rep_t result;
 
   // Shift a into the significand field and clear the implicit bit.
Index: compiler-rt/lib/builtins/floatunsisf.c
===================================================================
--- compiler-rt/lib/builtins/floatunsisf.c
+++ compiler-rt/lib/builtins/floatunsisf.c
@@ -26,7 +26,7 @@
     return fromRep(0);
 
   // Exponent of (fp_t)a is the width of abs(a).
-  const int exponent = (aWidth - 1) - __builtin_clz(a);
+  const int exponent = (aWidth - 1) - clzsi(a);
   rep_t result;
 
   // Shift a into the significand field, rounding if it is a right-shift
Index: compiler-rt/lib/builtins/floatsitf.c
===================================================================
--- compiler-rt/lib/builtins/floatsitf.c
+++ compiler-rt/lib/builtins/floatsitf.c
@@ -33,7 +33,7 @@
   }
 
   // Exponent of (fp_t)a is the width of abs(a).
-  const int exponent = (aWidth - 1) - __builtin_clz(aAbs);
+  const int exponent = (aWidth - 1) - clzsi(aAbs);
   rep_t result;
 
   // Shift a into the significand field and clear the implicit bit.
Index: compiler-rt/lib/builtins/floatsisf.c
===================================================================
--- compiler-rt/lib/builtins/floatsisf.c
+++ compiler-rt/lib/builtins/floatsisf.c
@@ -33,7 +33,7 @@
   }
 
   // Exponent of (fp_t)a is the width of abs(a).
-  const int exponent = (aWidth - 1) - __builtin_clz(a);
+  const int exponent = (aWidth - 1) - clzsi(a);
   rep_t result;
 
   // Shift a into the significand field, rounding if it is a right-shift


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86547.404405.patch
Type: text/x-patch
Size: 3124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220130/ceeb94be/attachment.bin>


More information about the cfe-commits mailing list