1/*
2 * Copyright (c) 2015, Google Inc. All rights reserved
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#include <asm.h>
25
26.altmacro
27
28/* only checks low 64 bits for now */
29.macro init_regs vall=r0, valh=r1, reg=0
30    vmov.32    d\reg, \vall, \valh
31.if \reg < 31
32    add     \vall, \vall, #1
33    add     \valh, \valh, #1
34    init_regs \vall, \valh, %(\reg+1)
35.endif
36.endm
37
38FUNCTION(fptest_arch_init)
39    init_regs
40    bx      lr
41
42.macro check_regs errors, vall, valh, tmpl, tmph, reg=0
43    vmov    \tmpl, \tmph, d\reg
44    cmp     \vall, \tmpl
45    cmpeq   \valh, \tmph
46    addne   \errors, \errors, #1
47.if \reg < 31
48    add     \vall, \vall, #1
49    add     \valh, \valh, #1
50    check_regs \errors, \vall, \valh, \tmpl, \tmph, %(\reg+1)
51.endif
52.endm
53
54FUNCTION(fptest_arch_check_state)
55    mov     r2, r1
56    mov     r1, r0
57    mov     r0, #0
58    check_regs r0, r1, r2, r3, ip
59    bx      lr
60