Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / aapcs64 / abitest.S
blob68845fbcdb5e6984d6154b3a8bcd2b04b7ce1f8f
1         .global dumpregs
2         .global myfunc
3         .type dumpregs,%function
4         .type myfunc,%function
5 dumpregs:
6 myfunc:
7       mov       x16, sp
8       mov       x17, sp
9       sub       sp,  sp, 352 // 336 for registers and 16 for old sp and lr
11       stp       x8, x9, [x17, #-16]! //320
13       stp       q6, q7, [x17, #-32]! //288
14       stp       q4, q5, [x17, #-32]! //256
15       stp       q2, q3, [x17, #-32]! //224
16       stp       q0, q1, [x17, #-32]! //192
18       stp       x6, x7, [x17, #-16]! //176
19       stp       x4, x5, [x17, #-16]! //160
20       stp       x2, x3, [x17, #-16]! //144
21       stp       x0, x1, [x17, #-16]! //128
23       stp       w6, w7, [x17, #-8]!  //120
24       stp       w4, w5, [x17, #-8]!  //112
25       stp       w2, w3, [x17, #-8]!  //104
26       stp       w0, w1, [x17, #-8]!  // 96
28       stp       s6, s7, [x17, #-8]!  // 88
29       stp       s4, s5, [x17, #-8]!  // 80
30       stp       s2, s3, [x17, #-8]!  // 72
31       stp       s0, s1, [x17, #-8]!  // 64
33       stp       d6, d7, [x17, #-16]! // 48
34       stp       d4, d5, [x17, #-16]! // 32
35       stp       d2, d3, [x17, #-16]! // 16
36       stp       d0, d1, [x17, #-16]! //  0
38       add       x0, sp,  #16
39       stp       x16, x30, [x17, #-16]!
41       adrp      x9, which_kind_of_test          // determine the type of test
42       add       x9, x9, :lo12:which_kind_of_test
43       ldr       w9, [x9, #0]
44       cmp       w9, #1
45       bgt       LABEL_TEST_FUNC_RETURN
46       bl        testfunc                        // parameter passing test or va_arg code gen test
47       b         LABEL_RET
48 LABEL_TEST_FUNC_RETURN:
49       adrp      x9, testfunc_ptr
50       add       x9, x9, :lo12:testfunc_ptr
51       ldr       x9, [x9, #0]
52       blr       x9                              // function return value test
53       adrp      x9, saved_return_address
54       add       x9, x9, :lo12:saved_return_address
55       ldr       x9, [x9, #0]
56       str       x9, [sp, #8]                    // Update the copy of LR reg saved on stack
57 LABEL_RET:
58       ldp       x0, x30, [sp]
59       mov       sp, x0
60       ret
62 .weak   testfunc
63 .weak   testfunc_ptr
64 .weak   saved_return_address