1   /* Copyright (C) 2008 The Android Open Source Project
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10    * distributed under the License is distributed on an "AS IS" BASIS,
11    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12    * See the License for the specific language governing permissions and
13    * limitations under the License.
14    */
15
16   /*
17    * File: OP_CMP_LONG.S
18    *
19    * Code: Compare floating point values. Uses no substitutions.
20    *
21    * For: cmp-long
22    *
23    * Description: Perform a long comparison, storing 0 if the two
24    *              arguments are equal, 1 if the second argument is larger
25    *              or -1 if the first argument is larger.
26    *
27    * Format: AA|op CC|BB (23x)
28    *
29    * Syntax: op vAA, vBB, vCC
30    */
31
32    FETCH_BB    1, %ecx                 # %ecx<- BB
33    FETCH_CC    1, %edx                 # %edx<- CC
34    movl        4(rFP, %ecx, 4), %eax   # %eax<- vBBhi
35    cmp         4(rFP, %edx, 4), %eax   # compare vCChi and vBBhi
36    jl          .L${opcode}_less
37    jg          .L${opcode}_greater
38    movl        (rFP, %ecx, 4), %eax    # %eax<- vBBlo
39    cmp         (rFP, %edx, 4), %eax    # compare vCClo and vBBlo
40    ja          .L${opcode}_greater
41    jne         .L${opcode}_less
42    jmp         .L${opcode}_final
43%break
44
45.L${opcode}_final:
46    movl        $$0x0, (rFP, rINST, 4)  # vAA<- equal
47    FINISH      2                       # jump to next instruction
48
49.L${opcode}_less:
50    movl        $$0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
51    FINISH      2                       # jump to next instruction
52
53.L${opcode}_greater:
54    movl        $$0x1, (rFP, rINST, 4)  # vAA<- greater than
55    FINISH      2                       # jump to next instruction
56