gas/testsuite/
[deliverable/binutils-gdb.git] / gas / testsuite / gas / i386 / x86-64-bundle.s
1 .bundle_align_mode 5
2
3 # We use these macros to test each pattern at every offset from
4 # bundle alignment, i.e. [0,31].
5
6 .macro offset_insn insn_name, offset
7 .p2align 5
8 \insn_name\()_offset_\offset\():
9 .if \offset
10 .space \offset, 0xf4
11 .endif
12 \insn_name
13 .endm
14
15 .macro test_offsets insn_name
16 offset_insn \insn_name, 0
17 offset_insn \insn_name, 1
18 offset_insn \insn_name, 2
19 offset_insn \insn_name, 3
20 offset_insn \insn_name, 4
21 offset_insn \insn_name, 5
22 offset_insn \insn_name, 6
23 offset_insn \insn_name, 7
24 offset_insn \insn_name, 8
25 offset_insn \insn_name, 9
26 offset_insn \insn_name, 10
27 offset_insn \insn_name, 11
28 offset_insn \insn_name, 12
29 offset_insn \insn_name, 13
30 offset_insn \insn_name, 14
31 offset_insn \insn_name, 15
32 offset_insn \insn_name, 16
33 offset_insn \insn_name, 17
34 offset_insn \insn_name, 18
35 offset_insn \insn_name, 19
36 offset_insn \insn_name, 20
37 offset_insn \insn_name, 21
38 offset_insn \insn_name, 22
39 offset_insn \insn_name, 23
40 offset_insn \insn_name, 24
41 offset_insn \insn_name, 25
42 offset_insn \insn_name, 26
43 offset_insn \insn_name, 27
44 offset_insn \insn_name, 28
45 offset_insn \insn_name, 29
46 offset_insn \insn_name, 30
47 offset_insn \insn_name, 31
48 .endm
49
50 # These are vanilla (non-relaxed) instructions of each length.
51 .macro test_1
52 clc
53 .endm
54 .macro test_2
55 add %eax,%eax
56 .endm
57 .macro test_3
58 and $3,%eax
59 .endm
60 .macro test_4
61 lock and $3,(%rax)
62 .endm
63 .macro test_5
64 mov $0x11223344,%eax
65 .endm
66 .macro test_6
67 movl %eax,0x11223344(%rsi)
68 .endm
69 .macro test_7
70 movl $0x11223344,0x7f(%rsi)
71 .endm
72 .macro test_8
73 lock addl $0x11223344,0x10(%rsi)
74 .endm
75 .macro test_9
76 lock addl $0x11223344,%fs:0x10(%rsi)
77 .endm
78 .macro test_10
79 movl $0x11223344,0x7ff(%rsi)
80 .endm
81 .macro test_11
82 lock addl $0x11223344,0x7ff(%rsi)
83 .endm
84 .macro test_12
85 lock addl $0x11223344,%fs:0x7ff(%rsi)
86 .endm
87 .macro test_13
88 lock addl $0x11223344,%fs:0x7ff(%r11)
89 .endm
90
91 test_offsets test_1
92 test_offsets test_2
93 test_offsets test_3
94 test_offsets test_4
95 test_offsets test_5
96 test_offsets test_6
97 test_offsets test_7
98 test_offsets test_8
99 test_offsets test_9
100 test_offsets test_10
101 test_offsets test_11
102 test_offsets test_12
103 test_offsets test_13
104
105 # The only relaxation cases are the jump instructions.
106 # For each of the three flavors of jump (unconditional, conditional,
107 # and conditional with prediction), we test a case that can be relaxed
108 # to its shortest form, and one that must use the long form.
109 .macro jmp_2
110 jmp jmp_2_\@
111 movl $0xdeadbeef,%eax
112 jmp_2_\@\():
113 movl $0xb00b,%eax
114 .endm
115 .macro jmp_5
116 jmp jmp_5_\@
117 .rept 128
118 clc
119 .endr
120 jmp_5_\@\():
121 movl $0xb00b,%eax
122 .endm
123
124 .macro cjmp_2
125 jz cjmp_2_\@
126 movl $0xdeadbeef,%eax
127 cjmp_2_\@\():
128 movl $0xb00b,%eax
129 .endm
130 .macro cjmp_6
131 jz cjmp_6_\@
132 .rept 128
133 clc
134 .endr
135 cjmp_6_\@\():
136 movl $0xb00b,%eax
137 .endm
138
139 .macro pjmp_3
140 jz,pt pjmp_3_\@
141 movl $0xdeadbeef,%eax
142 pjmp_3_\@\():
143 movl $0xb00b,%eax
144 .endm
145 .macro pjmp_7
146 jz,pt pjmp_7_\@
147 .rept 128
148 clc
149 .endr
150 pjmp_7_\@\():
151 movl $0xb00b,%eax
152 .endm
153
154 test_offsets jmp_2
155 test_offsets cjmp_2
156 test_offsets pjmp_3
157 test_offsets jmp_5
158 test_offsets cjmp_6
159 test_offsets pjmp_7
160
161 .p2align 5
162 hlt
This page took 0.032616 seconds and 4 git commands to generate.