~ubuntu-branches/ubuntu/wily/edk2/wily

« back to all changes in this revision

Viewing changes to StdLib/LibC/CRT/Ia32/ashrdi3.S

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2013-02-10 13:11:25 UTC
  • Revision ID: package-import@ubuntu.com-20130210131125-0zwkb8f8m4ecia4m
Tags: upstream-0~20121205.edae8d2d
ImportĀ upstreamĀ versionĀ 0~20121205.edae8d2d

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#   MathRShiftU64.S
 
15
#
 
16
# Abstract:
 
17
#
 
18
#   64-bit Math Worker Function.
 
19
#   Shifts a 64-bit unsigned value right by a certain number of bits.
 
20
#
 
21
#------------------------------------------------------------------------------
 
22
 
 
23
 
 
24
    .686:
 
25
    .code:
 
26
 
 
27
ASM_GLOBAL ASM_PFX(__ashrdi3)
 
28
 
 
29
#------------------------------------------------------------------------------
 
30
#
 
31
# void __cdecl __ashrdi3 (void)
 
32
#
 
33
#------------------------------------------------------------------------------
 
34
ASM_PFX(__ashrdi3):
 
35
    #
 
36
    # Checking: Only handle 64bit shifting or more
 
37
    #
 
38
    cmpb    $64, %cl
 
39
    jae     _Exit
 
40
 
 
41
    #
 
42
    # Handle shifting between 0 and 31 bits
 
43
    #
 
44
    cmpb    $32, %cl
 
45
    jae     More32
 
46
    shrd    %cl, %edx, %eax
 
47
    shr     %cl, %edx
 
48
    ret
 
49
 
 
50
    #
 
51
    # Handle shifting of 32-63 bits
 
52
    #
 
53
More32:
 
54
    movl    %edx, %eax
 
55
    xor     %edx, %edx
 
56
    and     $32, %cl
 
57
    shr     %cl, %eax
 
58
    ret
 
59
 
 
60
    #
 
61
    # Invalid number (less then 32bits), return 0
 
62
    #
 
63
_Exit:
 
64
    xor     %eax, %eax
 
65
    xor     %edx, %edx
 
66
    ret