122d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch /* Copyright (C) 2008 The Android Open Source Project 222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Licensed under the Apache License, Version 2.0 (the "License"); 422d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * you may not use this file except in compliance with the License. 522d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * You may obtain a copy of the License at 622d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 722d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * http://www.apache.org/licenses/LICENSE-2.0 822d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 922d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Unless required by applicable law or agreed to in writing, software 1022d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * distributed under the License is distributed on an "AS IS" BASIS, 1122d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * See the License for the specific language governing permissions and 1322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * limitations under the License. 1422d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch */ 1522d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 1622d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch /* 1722d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * File: zcmp.S 1822d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 1922d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Code: Generic 32-bit comparison operation. Provides a "revcmp" 2022d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * variable to specify the reverse comparison to perform 2122d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 2222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * For: if-eqz, if-gez, if-gtz, if-lez, if-ltz, if-nez 2322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 2422d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Description: Branch to the given destination if the given register's 2522d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * value compares with 0 as specified. 2622d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 2722d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Format: AA|op BBBB (21t) 2822d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * 2922d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Syntax: op vAA, +BBBB 3022d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch */ 3122d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 3222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch cmp $$0, (rFP, rINST, 4) # compare vAA with zero 3322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch j${revcmp} ${opcode}_2f # goto next instruction or branch 3422d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch FETCHs 1, %edx # %edx<- BBBB; branch offset 3522d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch sal $$1, %edx # %edx<- adjust byte offset 3622d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 3722d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch /* 3822d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * Inline common_backwardBranch 3922d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch */ 4022d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 41f8f23d402dc1eef107995b29ad4d91ee5b4e1c34Johnnie Birch js common_periodicChecks_backwardBranch # jump on backwards branch 4222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch1: 4322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch FINISH_RB %edx, %ecx # jump to next instruction 4422d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 4522d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch /* 4622d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch * FINISH code 4722d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch */ 4822d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch 4922d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch${opcode}_2f: 5022d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch movzbl 4(rPC), %edx # grab the next opcode 5122d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch movzbl 5(rPC), rINST # update the instruction 5222d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch addl $$4, rPC # update the program counter 5322d404a75a00cda0b0ebed1034c2808ba060b05fJohnnie Birch jmp *dvmAsmInstructionJmpTable(, %edx, 4) # jump to next instruction 54