- add third_party src.
[platform/framework/web/crosswalk.git] / src / native_client / tests / toolchain / nop_test.S
1 /*
2  * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7         .text
8
9 /*
10  * This test attempts to get both the assembler and the linker to generate
11  * all the different kinds of nop instructions they will generate when
12  * doing alignment padding in the code segment.  Running the output through
13  * the validator ensures that it accepts all these nop forms.
14  */
15
16 .macro try length
17         /*
18          * Create the circumstance where exactly |length| bytes must be
19          * filled to perform '.p2align 5', and then let the assembler fill
20          * it with its choice of nops.
21          */
22         .p2align 5
23 test_as_nop_\length\():
24         .fill 32 - \length, 1, 0xf4
25         .p2align 5
26         hlt
27
28          /*
29           * Now create the same circumstance in the linker when it stitches
30           * this section to the next one (which has sh_addralign=32).
31           */
32         .pushsection .text.nop.\length, "ax", @progbits
33         .p2align 5
34 test_ld_nop_\length\():
35         .fill 32 - \length, 1, 0xf4
36         .popsection
37 .endm
38
39 try 1
40 try 2
41 try 3
42 try 4
43 try 5
44 try 6
45 try 7
46 try 8
47 try 9
48 try 10
49 try 11
50 try 12
51 try 13
52 try 14
53 try 15
54 try 16
55 try 17
56 try 18
57 try 19
58 try 20
59 try 21
60 try 22
61 try 23
62 try 24
63 try 25
64 try 26
65 try 27
66 try 29
67 try 30
68 try 31
69
70         /*
71          * This section follows .text.nop.31 and creates (by virtue of its
72          * alignment) the need for the linker to generate the last nop
73          * sequence.
74          */
75         .pushsection .text.nop.end, "ax", @progbits
76         .p2align 5
77         hlt
78         .popsection