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: zcmp.S
     18     *
     19     * Code: Generic 32-bit comparison operation. Provides a "revcmp"
     20     *       variable to specify the reverse comparison to perform
     21     *
     22     * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez
     23     *
     24     * Description: Branch to the given destination if the given register's
     25     *              value compares with 0 as specified.
     26     *
     27     * Format: AA|op BBBB (21t)
     28     *
     29     * Syntax: op vAA, +BBBB
     30     */
     31 
     32     cmp         $$0, (rFP, rINST, 4)    # compare vAA with zero
     33     j${revcmp}  ${opcode}_2f                    # goto next instruction or branch
     34     FETCHs      1, %edx                 # %edx<- BBBB; branch offset
     35     sal         $$1, %edx               # %edx<- adjust byte offset
     36 
     37    /*
     38     * Inline common_backwardBranch
     39     */
     40 
     41     js          common_periodicChecks2  # jump on backwards branch
     42 1:
     43     FINISH_RB   %edx, %ecx              # jump to next instruction
     44 
     45    /*
     46     * FINISH code
     47     */
     48 
     49 ${opcode}_2f:
     50     movzbl      4(rPC), %edx            # grab the next opcode
     51     movzbl      5(rPC), rINST           # update the instruction
     52     addl        $$4, rPC                # update the program counter
     53     jmp         *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction
     54