Home | History | Annotate | Download | only in x86-atom
      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_CMPL_FLOAT.S
     18     *
     19     * Code: Provides a "nan" variable to specify the return value for
     20     *       NaN. Provides a variable "sod" which appends a "s" or a "d"
     21     *       to the move and comparison instructions, depending on if we
     22     *       are working with a float or a double. For instructions
     23     *       cmpx-float and cmpx-double, the x will be eiher a g or a l
     24     *       to specify positive or negative bias for NaN.
     25     *
     26     * For: cmpg-double, dmpg-float, cmpl-double, cmpl-float
     27     *
     28     * Description: Perform the indicated floating point or long comparison,
     29     *              storing 0 if the two arguments are equal, 1 if the second
     30     *              argument is larger, or -1 if the first argument is larger.
     31     *
     32     * Format: AA|op CC|BB (23x)
     33     *
     34     * Syntax: op vAA, vBB, vCC
     35     */
     36 
     37 %default { "nan":"$0xFFFFFFFF" , "sod":"s" }
     38 
     39     FETCH_BB    1, %ecx                 # %ecx<- BB
     40     FETCH_CC    1, %edx                 # %edx<- CC
     41     FFETCH_ADV  2, %eax                 # %eax<- next instruction hi; fetch, advance
     42     movs$sod    (rFP, %ecx, 4), %xmm0   # %xmm0<- vBB
     43     comis$sod   (rFP, %edx, 4), %xmm0   # do comparison
     44     ja          .L${opcode}_greater
     45     jp          .L${opcode}_finalNan
     46     jz          .L${opcode}_final
     47 
     48 .L${opcode}_less:
     49     movl        $$0xFFFFFFFF, (rFP, rINST, 4) # vAA<- less than
     50     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     51 
     52 %break
     53 .L${opcode}_greater:
     54     movl        $$0x1, (rFP, rINST, 4)  # vAA<- greater than
     55     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     56 
     57 .L${opcode}_final:
     58     movl        $$0x0, (rFP, rINST, 4)  # vAA<- equal
     59     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     60 
     61 .L${opcode}_finalNan:
     62     movl        $nan, (rFP, rINST, 4)   # vAA<- NaN
     63     FGETOP_JMP  2, %eax                 # jump to next instruction; getop, jmp
     64