[PATCH] D84054: [lld][ELF] Add LOG2CEIL builtin ldscript function

Isaac Richter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 09:14:49 PDT 2020


irichter marked an inline comment as done.
irichter added a comment.



In D84054#2168766 <https://reviews.llvm.org/D84054#2168766>, @grimar wrote:

> Yeah, it should be fine to support it. Added a suggestion about test.


The GNU implementation uses a while loop to compute the value directly, so I somewhat understand why they chose those values.

Since I'm using the builtin (C++) functions, I'd be more worried about floating-point weirdness causing inaccuracies. (I don't think that this should be an issue, since any rounding should be in less-significant bits that won't change the final result, but I'm not 100% sure about this.) I could test every transition (e.g. 0x0f, 0x10, 0x1f, 0x20, 0x3f, 0x40, ...), but that'll be >100 tests. I took a quick look at the libc and libcxx tests for log2, but those seem much more detailed than I'd expect to find in lld.

What do you think would be sufficient?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84054





More information about the llvm-commits mailing list