| /* ===-- clzsi2.c - Implement __clzsi2 -------------------------------------=== |
| * 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 count leading zeros for 32bit arguments. |
| * ===----------------------------------------------------------------------=== |
| DEFINE_COMPILERRT_FUNCTION(__clzsi2) |
| * r1: count of leading zeros in n + 1 |
| * r2: scratch register for shifted r0 |
| * if ((r0 >> SHIFT) == 0) |
| * for descending powers of two as SHIFT. |
| * The basic block invariants at this point are (r0 >> 2) == 0 and |
| * r0 != 0. This means 1 <= r0 <= 3 and 0 <= (r0 >> 1) <= 1. |
| * r0 | (r0 >> 1) == 0 | (r0 >> 1) == 1 | -(r0 >> 1) | 1 - (r0 >> 1) |
| * ---+----------------+----------------+------------+-------------- |
| * The r1's initial value of 1 compensates for the 1 here. |
| #endif // __ARM_FEATURE_CLZ |
| END_COMPILERRT_FUNCTION(__clzsi2) |