]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/CRT/Ia32/shldi3.S
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / CRT / Ia32 / shldi3.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials are licensed and made available
5 # under the terms and conditions of the BSD License which accompanies this
6 # distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php.
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 # Module Name:
13 #
14 # MathLShiftS64.S
15 #
16 # Abstract:
17 #
18 # 64-bit Math Worker Function.
19 # Shifts a 64-bit signed value left by a certain number of bits.
20 #
21 #------------------------------------------------------------------------------
22
23 .686:
24 .code:
25
26 ASM_GLOBAL ASM_PFX(__ashldi3)
27
28 #------------------------------------------------------------------------------
29 #
30 # void __cdecl __ashldi3 (void)
31 #
32 #------------------------------------------------------------------------------
33 ASM_PFX(__ashldi3):
34 #
35 # Handle shifting of 64 or more bits (return 0)
36 #
37 cmpb $64, %cl
38 jae ReturnZero
39
40 #
41 # Handle shifting of between 0 and 31 bits
42 #
43 cmpb $32, %cl
44 jae More32
45 shld %cl, %eax, %edx
46 shl %cl, %eax
47 ret
48
49 #
50 # Handle shifting of between 32 and 63 bits
51 #
52 More32:
53 movl %eax, %edx
54 xor %eax, %eax
55 and $31, %cl
56 shl %cl, %edx
57 ret
58
59 ReturnZero:
60 xor %eax, %eax
61 xor %edx, %edx
62 ret