Home | History | Annotate | Download | only in mips
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ART_RUNTIME_ARCH_MIPS_MEMCMP16_MIPS_S_
     18 #define ART_RUNTIME_ARCH_MIPS_MEMCMP16_MIPS_S_
     19 
     20 #include "asm_support_mips.S"
     21 
     22 // u4 __memcmp16(const u2*, const u2*, size_t);
     23 ENTRY __memcmp16
     24   li  $t0,0
     25   li  $t1,0
     26   beqz  $a2,done   /* 0 length string */
     27   beq $a0,$a1,done    /* strings are identical */
     28 
     29   /* Unoptimised... */
     30 1:  lhu $t0,0($a0)
     31   lhu $t1,0($a1)
     32   addu  $a1,2
     33   bne $t0,$t1,done
     34   addu  $a0,2
     35   subu  $a2,1
     36   bnez  $a2,1b
     37 
     38 done:
     39   subu  $v0,$t0,$t1
     40   j $ra
     41 END __memcmp16
     42 
     43 #endif  // ART_RUNTIME_ARCH_MIPS_MEMCMP16_MIPS_S_
     44