Home | History | Annotate | Download | only in Arm
      1 /** @file
      2   Compiler intrinsic for 64-bit compare, ported from LLVM code.
      3 
      4   Copyright (c) 2008-2009, Apple Inc. All rights reserved.<BR>
      5 
      6   This program and the accompanying materials
      7   are licensed and made available under the terms and conditions of the BSD License
      8   which accompanies this distribution.  The full text of the license may be found at
      9   http://opensource.org/licenses/bsd-license.php
     10 
     11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 
     14 **/
     15 /**
     16   University of Illinois/NCSA
     17   Open Source License
     18 
     19   Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.
     20   All rights reserved.
     21 
     22   Developed by:
     23 
     24       LLVM Team
     25 
     26       University of Illinois at Urbana-Champaign
     27 
     28       http://llvm.org
     29 
     30   Permission is hereby granted, free of charge, to any person obtaining a copy of
     31   this software and associated documentation files (the "Software"), to deal with
     32   the Software without restriction, including without limitation the rights to
     33   use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
     34   of the Software, and to permit persons to whom the Software is furnished to do
     35   so, subject to the following conditions:
     36 
     37       * Redistributions of source code must retain the above copyright notice,
     38         this list of conditions and the following disclaimers.
     39 
     40       * Redistributions in binary form must reproduce the above copyright notice,
     41         this list of conditions and the following disclaimers in the
     42         documentation and/or other materials provided with the distribution.
     43 
     44       * Neither the names of the LLVM Team, University of Illinois at
     45         Urbana-Champaign, nor the names of its contributors may be used to
     46         endorse or promote products derived from this Software without specific
     47         prior written permission.
     48 
     49   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     50   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
     51   FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     52   CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     53   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     54   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
     55   SOFTWARE.
     56 **/
     57 
     58 
     59 #include "Llvm_int_lib.h"
     60 
     61 
     62 // Returns:  if (a <  b) returns 0
     63 //           if (a == b) returns 1
     64 //           if (a >  b) returns 2
     65 
     66 UINT32
     67 __ucmpdi2(UINT64 a, UINT64 b)
     68 {
     69     udwords x;
     70     x.all = a;
     71     udwords y;
     72     y.all = b;
     73     if (x.high < y.high)
     74         return 0;
     75     if (x.high > y.high)
     76         return 2;
     77     if (x.low < y.low)
     78         return 0;
     79     if (x.low > y.low)
     80         return 2;
     81     return 1;
     82 }
     83