1//
2// Copyright (c) 2016, Linaro Limited
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are met:
7//     * Redistributions of source code must retain the above copyright
8//       notice, this list of conditions and the following disclaimer.
9//     * Redistributions in binary form must reproduce the above copyright
10//       notice, this list of conditions and the following disclaimer in the
11//       documentation and/or other materials provided with the distribution.
12//     * Neither the name of the Linaro nor the
13//       names of its contributors may be used to endorse or promote products
14//       derived from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27//
28
29    .text
30    .thumb
31    .syntax unified
32    .align  5
33ASM_GLOBAL ASM_PFX(InternalMemCompareGuid)
34ASM_PFX(InternalMemCompareGuid):
35    push    {r4, lr}
36    ldr     r2, [r0]
37    ldr     r3, [r0, #4]
38    ldr     r4, [r0, #8]
39    ldr     r0, [r0, #12]
40    cbz     r1, 1f
41    ldr     ip, [r1]
42    ldr     lr, [r1, #4]
43    cmp     r2, ip
44    it      eq
45    cmpeq.n r3, lr
46    beq     0f
47    movs    r0, #0
48    pop     {r4, pc}
49
500:  ldr     r2, [r1, #8]
51    ldr     r3, [r1, #12]
52    cmp     r4, r2
53    it      eq
54    cmpeq.n r0, r3
55    bne     2f
56    movs    r0, #1
57    pop     {r4, pc}
58
591:  orrs    r2, r2, r3
60    orrs    r4, r4, r0
61    movs    r0, #1
62    orrs    r2, r2, r4
632:  it      ne
64    movne.n r0, #0
65    pop     {r4, pc}
66