[all-commits] [llvm/llvm-project] d92e54: [libc] Use __builtin_clz to find leading 1 in hypot

Siva Chandra via All-commits all-commits at lists.llvm.org
Thu Jan 20 15:33:04 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d92e5412ea571158b5b524855d19b5eafa0567ce
      https://github.com/llvm/llvm-project/commit/d92e5412ea571158b5b524855d19b5eafa0567ce
  Author: Clint Caywood <caywood at google.com>
  Date:   2022-01-20 (Thu, 20 Jan 2022)

  Changed paths:
    M libc/src/__support/FPUtil/Hypot.h

  Log Message:
  -----------
  [libc] Use __builtin_clz to find leading 1 in hypot

This is an optimization that using a single CPU instruction on supported
architectures (amd64 and aarch64, but possibly others) to replace what was
previously an iterative look-up-table algorithm.

Originally I suggested using inline assembly for this in
https://reviews.llvm.org/D117584.

Reviewed By: lntue, sivachandra

Differential Revision: https://reviews.llvm.org/D117684




More information about the All-commits mailing list