blob: c8eac9bd1ce69a5beff0e3ad84d939223d975a96 [file] [log] [blame]
Andreas Gampe4d0589c2014-06-10 16:10:56 -07001/*
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
Andreas Gampe62401022014-06-10 21:57:00 -070020#include "asm_support_mips.S"
Andreas Gampe4d0589c2014-06-10 16:10:56 -070021
22// u4 __memcmp16(const u2*, const u2*, size_t);
Ian Rogers1d8cdbc2014-09-22 22:51:09 -070023ENTRY_NO_GP __memcmp16
Andreas Gampe62401022014-06-10 21:57:00 -070024 li $t0,0
25 li $t1,0
26 beqz $a2,done /* 0 length string */
27 beq $a0,$a1,done /* strings are identical */
Andreas Gampe4d0589c2014-06-10 16:10:56 -070028
Kenny Root00d597a2015-09-30 13:09:51 -070029 /* Unoptimized... */
Andreas Gampe62401022014-06-10 21:57:00 -0700301: 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
Andreas Gampe4d0589c2014-06-10 16:10:56 -070037
38done:
Andreas Gampe62401022014-06-10 21:57:00 -070039 subu $v0,$t0,$t1
40 j $ra
41END __memcmp16
Andreas Gampe4d0589c2014-06-10 16:10:56 -070042
43#endif // ART_RUNTIME_ARCH_MIPS_MEMCMP16_MIPS_S_