[PATCH] D78300: [builtins] Do not assume sizeof(long long)==8 in int_div_impl.inc

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 01:03:04 PDT 2020


bjope updated this revision to Diff 258244.
bjope added a comment.

Use "unsigned long long" instead of "long long" to match __builtin_clzll.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78300

Files:
  compiler-rt/lib/builtins/int_div_impl.inc


Index: compiler-rt/lib/builtins/int_div_impl.inc
===================================================================
--- compiler-rt/lib/builtins/int_div_impl.inc
+++ compiler-rt/lib/builtins/int_div_impl.inc
@@ -1,4 +1,16 @@
-#define clz(a) (sizeof(a) == 8 ? __builtin_clzll(a) : __builtin_clz(a))
+//===----- int_div_impl.inc - integer division --------------------*- C -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements helpers for udivXi3 and umodXi3.
+//
+//===----------------------------------------------------------------------===//
+
+#define clz(a) (sizeof(a) == sizeof(unsigned long long) ? __builtin_clzll(a) : __builtin_clz(a))
 
 // Adapted from Figure 3-40 of The PowerPC Compiler Writer's Guide
 static __inline fixuint_t __udivXi3(fixuint_t n, fixuint_t d) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78300.258244.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200417/9da2fc95/attachment.bin>


More information about the llvm-commits mailing list