1 // ====-- ashldi3.c - Implement __ashldi3 ---------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements __ashldi3 for the compiler_rt library.
11 //===----------------------------------------------------------------------===//
17 // Precondition: 0 <= b < bits_in_dword
19 COMPILER_RT_ABI di_int __ashldi3(di_int a, si_int b) {
20 const int bits_in_word = (int)(sizeof(si_int) * CHAR_BIT);
24 if (b & bits_in_word) /* bits_in_word <= b < bits_in_dword */ {
26 result.s.high = input.s.low << (b - bits_in_word);
27 } else /* 0 <= b < bits_in_word */ {
30 result.s.low = input.s.low << b;
31 result.s.high = (input.s.high << b) | (input.s.low >> (bits_in_word - b));
36 #if defined(__ARM_EABI__)
37 COMPILER_RT_ALIAS(__ashldi3, __aeabi_llsl)