1 ; Copyright (C) 2012-2017 Free Software Foundation, Inc.
2 ; Contributed by Red Hat.
4 ; This file is free software; you can redistribute it and/or modify it
5 ; under the terms of the GNU General Public License as published by the
6 ; Free Software Foundation; either version 3, or (at your option) any
9 ; This file is distributed in the hope that it will be useful, but
10 ; WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ; General Public License for more details.
14 ; Under Section 7 of GPL version 3, you are granted additional
15 ; permissions described in the GCC Runtime Library Exception, version
16 ; 3.1, as published by the Free Software Foundation.
18 ; You should have received a copy of the GNU General Public License and
19 ; a copy of the GCC Runtime Library Exception along with this program;
20 ; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 ; <http://www.gnu.org/licenses/>.
23 #ifdef __MSP430X_LARGE__
31 ;; int __cmpsi2 (signed long A, signed long B)
33 ;; Performs a signed comparison of A and B.
34 ;; If A is less than B it returns 0. If A is greater
35 ;; than B it returns 2. If they are equal it returns 1.
37 ;; Note - this code is also used by the __ucmpsi2 routine below.
40 .type __cmpsi2, @function
42 ;; A is in r12 (low), r13 (high)
43 ;; B is in r14 (low), r15 (high)
63 .size __cmpsi2, . - __cmpsi2
66 ;; int __ucmpsi2 (unsigned long A, unsigned long B)
68 ;; Performs an unsigned comparison of A and B.
69 ;; If A is less than B it returns 0. If A is greater
70 ;; than B it returns 2. If they are equal it returns 1.
72 ;;; Note - this function branches into the __cmpsi2 code above.
75 .type __ucmpsi2, @function
77 ;; A is in r12 (low), r13 (high)
78 ;; B is in r14 (low), r15 (high)
82 jn .L_top_bit_set_in_A
84 ;;; If the top bit of B is set, but A's is clear we know that A < B.
86 ;;; Neither A nor B has their top bit set so we can use the __cmpsi2 routine.
87 ;;; Note we use Jc rather than BR as that saves two bytes. The TST insn always
93 ;;; If both A and B have their top bit set we can use the __cmpsi2 routine.
95 ;;; Otherwise A has its top bit set and B does not so A > B.
98 .size __ucmpsi2, . - __ucmpsi2