[279] | 1 | # gas comment with ``gnu'' style quotes
|
---|
| 2 |
|
---|
| 3 | /* some directive tests */
|
---|
| 4 |
|
---|
| 5 | .byte 0xff
|
---|
| 6 | .byte 1, 2, 3
|
---|
| 7 | .short 1, 2, 3
|
---|
| 8 | .word 1, 2, 3
|
---|
| 9 | .long 1, 2, 3
|
---|
| 10 | .int 1, 2, 3
|
---|
| 11 | .align 8
|
---|
| 12 | .byte 1
|
---|
| 13 | /* .align 16, 0x90 gas is too clever for us with 0x90 fill */
|
---|
[331] | 14 | .balign 4, 0x92
|
---|
[279] | 15 | .align 16, 0x91 /* 0x91 tests the non-clever behaviour */
|
---|
| 16 | .skip 3
|
---|
| 17 | .skip 15, 0x90
|
---|
| 18 | .string "hello\0world"
|
---|
[331] | 19 | /* Macro expansion should work like with C, the #n shouldn't be parsed
|
---|
| 20 | as asm line comment */
|
---|
| 21 | #define __stringify(n) #n
|
---|
| 22 | #define stringify(n) __stringify(n)
|
---|
| 23 | .skip 8,0x90
|
---|
| 24 | .asciz stringify(BLA)
|
---|
| 25 | .skip 8,0x90
|
---|
[279] | 26 |
|
---|
[331] | 27 | # 28 "asmtest.S" # a line directive (and a line comment)
|
---|
| 28 | movl %eax, %ebx # some more asm comment
|
---|
[279] | 29 | /* some label tests */
|
---|
| 30 | L1:
|
---|
| 31 | movl %eax, %ebx
|
---|
| 32 | mov 0x10000, %eax
|
---|
| 33 | L2:
|
---|
| 34 | movl $L2 - L1, %ecx
|
---|
| 35 | var1:
|
---|
| 36 | nop ; nop ; nop ; nop
|
---|
| 37 |
|
---|
| 38 | mov var1, %eax
|
---|
| 39 |
|
---|
| 40 | /* instruction tests */
|
---|
| 41 | movl %eax, %ebx
|
---|
| 42 | mov 0x10000, %eax
|
---|
| 43 | mov 0x10000, %ax
|
---|
| 44 | mov 0x10000, %al
|
---|
| 45 | mov %al, 0x10000
|
---|
| 46 |
|
---|
| 47 | mov $1, %edx
|
---|
| 48 | mov $1, %dx
|
---|
[331] | 49 | mov $1, %cl
|
---|
[279] | 50 | movb $2, 0x100(%ebx,%edx,2)
|
---|
| 51 | movw $2, 0x100(%ebx,%edx,2)
|
---|
| 52 | movl $2, 0x100(%ebx,%edx,2)
|
---|
| 53 | movl %eax, 0x100(%ebx,%edx,2)
|
---|
| 54 | movl 0x100(%ebx,%edx,2), %edx
|
---|
| 55 | movw %ax, 0x100(%ebx,%edx,2)
|
---|
| 56 |
|
---|
[331] | 57 | movw $0x1122,%si
|
---|
| 58 | movl $0x112233,%edx
|
---|
| 59 | movl $0x80000000, %esi
|
---|
| 60 | movl $-0x7fffffff, %edi
|
---|
| 61 | #ifdef __x86_64__
|
---|
| 62 | mov $0x11223344,%rbx
|
---|
| 63 | movq $0x11223344,%rbx
|
---|
| 64 | mov $0x1122334455,%rbx
|
---|
| 65 | movq $0x1122334455,%rbx
|
---|
| 66 | movl $0x11334455,(%rbx)
|
---|
| 67 | #endif
|
---|
| 68 |
|
---|
[279] | 69 | mov %eax, 0x12(,%edx,2)
|
---|
| 70 |
|
---|
[331] | 71 | #ifdef __i386__
|
---|
[279] | 72 | mov %cr3, %edx
|
---|
| 73 | mov %ecx, %cr3
|
---|
| 74 | movl %cr3, %eax
|
---|
| 75 | movl %tr3, %eax
|
---|
| 76 | movl %db3, %ebx
|
---|
| 77 | movl %dr6, %eax
|
---|
[331] | 78 | #else
|
---|
| 79 | mov %cr3, %rdx
|
---|
| 80 | mov %rcx, %cr3
|
---|
| 81 | movq %cr3, %rax
|
---|
| 82 | movq %db3, %rbx
|
---|
| 83 | movq %dr6, %rax
|
---|
| 84 | mov %cr8, %rsi
|
---|
| 85 | mov %rdi, %cr8
|
---|
| 86 | #endif
|
---|
[279] | 87 | movl %fs, %ecx
|
---|
| 88 | movl %ebx, %fs
|
---|
| 89 |
|
---|
[331] | 90 | #ifdef __x86_64__
|
---|
| 91 | movq %r8, %r9
|
---|
| 92 | movq %r10, %r11
|
---|
| 93 | movq %r12, %r13
|
---|
| 94 | movq %r14, %r15
|
---|
| 95 | movq %rax, %r9
|
---|
| 96 | movq %r15, %rsi
|
---|
| 97 | inc %r9b
|
---|
| 98 | dec %r10w
|
---|
| 99 | not %r11d
|
---|
| 100 | negq %r12
|
---|
| 101 | decb %r13b
|
---|
| 102 | incw %r14w
|
---|
| 103 | notl %r15d
|
---|
| 104 | #endif
|
---|
| 105 |
|
---|
[279] | 106 | movsbl 0x1000, %eax
|
---|
| 107 | movsbw 0x1000, %ax
|
---|
| 108 | movswl 0x1000, %eax
|
---|
| 109 |
|
---|
| 110 | movzbl 0x1000, %eax
|
---|
| 111 | movzbw 0x1000, %ax
|
---|
| 112 | movzwl 0x1000, %eax
|
---|
| 113 |
|
---|
| 114 | movzb 0x1000, %eax
|
---|
| 115 | movzb 0x1000, %ax
|
---|
| 116 |
|
---|
[331] | 117 | mov $0x12345678,%eax
|
---|
| 118 |
|
---|
| 119 | #ifdef __x86_64__
|
---|
| 120 | movzb 0x1000, %rax
|
---|
| 121 | movzbq 0x1000, %rbx
|
---|
| 122 | movsbq 0x1000, %rdx
|
---|
| 123 | movzwq 0x1000, %rdi
|
---|
| 124 | movswq 0x1000, %rdx
|
---|
| 125 | movslq %eax, %rcx
|
---|
| 126 | mov $0x12345678,%rax
|
---|
| 127 | mov $0x12345678,%rdx
|
---|
| 128 | mov $0x12345678,%r10
|
---|
| 129 | mov $0x123456789abcdef0,%rax
|
---|
| 130 | mov $0x123456789abcdef0,%rcx
|
---|
| 131 | mov $0x123456789abcdef0,%r11
|
---|
| 132 | #endif
|
---|
[279] | 133 |
|
---|
[331] | 134 | #ifdef __i386__
|
---|
[279] | 135 | pushl %eax
|
---|
| 136 | push %eax
|
---|
| 137 | push %cs
|
---|
[331] | 138 | #else
|
---|
| 139 | pushq %rax
|
---|
| 140 | push %rax
|
---|
| 141 | #endif
|
---|
| 142 | pushw %ax
|
---|
[279] | 143 | push %gs
|
---|
| 144 | push $1
|
---|
| 145 | push $100
|
---|
[331] | 146 | push 0x42(%eax)
|
---|
| 147 | pop 0x43(%esi)
|
---|
[279] | 148 |
|
---|
[331] | 149 | #ifdef __i386__
|
---|
[279] | 150 | popl %eax
|
---|
| 151 | pop %eax
|
---|
| 152 | pop %ds
|
---|
[331] | 153 | #else
|
---|
| 154 | popq %rax
|
---|
| 155 | pop %rax
|
---|
| 156 | #endif
|
---|
| 157 | popw %ax
|
---|
[279] | 158 | pop %fs
|
---|
| 159 |
|
---|
| 160 | xchg %eax, %ecx
|
---|
| 161 | xchg %edx, %eax
|
---|
| 162 | xchg %bx, 0x10000
|
---|
| 163 | xchg 0x10000, %ebx
|
---|
| 164 | xchg 0x10000, %dl
|
---|
| 165 |
|
---|
| 166 | in $100, %al
|
---|
| 167 | in $100, %ax
|
---|
| 168 | in $100, %eax
|
---|
| 169 | in %dx, %al
|
---|
| 170 | in %dx, %ax
|
---|
| 171 | in %dx, %eax
|
---|
| 172 | inb %dx
|
---|
| 173 | inw %dx
|
---|
| 174 | inl %dx
|
---|
| 175 |
|
---|
| 176 | out %al, $100
|
---|
| 177 | out %ax, $100
|
---|
| 178 | out %eax, $100
|
---|
| 179 |
|
---|
| 180 | /* NOTE: gas is bugged here, so size must be added */
|
---|
| 181 | outb %al, %dx
|
---|
| 182 | outw %ax, %dx
|
---|
| 183 | outl %eax, %dx
|
---|
| 184 |
|
---|
| 185 | leal 0x1000(%ebx), %ecx
|
---|
| 186 | lea 0x1000(%ebx), %ecx
|
---|
| 187 |
|
---|
[331] | 188 | #ifdef __i386__
|
---|
[279] | 189 | les 0x2000, %eax
|
---|
| 190 | lds 0x2000, %ebx
|
---|
[331] | 191 | lss 0x2000, %edx
|
---|
| 192 | #endif
|
---|
[279] | 193 | lfs 0x2000, %ecx
|
---|
| 194 | lgs 0x2000, %edx
|
---|
| 195 |
|
---|
| 196 | addl $0x123, %eax
|
---|
| 197 | add $0x123, %ebx
|
---|
[331] | 198 | add $-16, %ecx
|
---|
| 199 | add $-0x123, %esi
|
---|
| 200 | add $1, %bx
|
---|
| 201 | add $1, %ebx
|
---|
| 202 | add $-1, %bx
|
---|
| 203 | add $-1, %ebx
|
---|
| 204 | add $127, %bx
|
---|
| 205 | addl $127, %ebx
|
---|
| 206 | addl $-128, %ebx
|
---|
| 207 | addl $-128, %ebx
|
---|
| 208 | addl $-129, %ebx
|
---|
| 209 | addl $128, %ebx
|
---|
| 210 | addl $255, %ebx
|
---|
| 211 | addl $256, %ebx
|
---|
| 212 | andb $0xf, %ah
|
---|
| 213 | andb $-15, %cl
|
---|
| 214 | xorb $127, %dh
|
---|
| 215 | cmpb $42, (%eax)
|
---|
[279] | 216 | addl $0x123, 0x100
|
---|
| 217 | addl $0x123, 0x100(%ebx)
|
---|
| 218 | addl $0x123, 0x100(%ebx,%edx,2)
|
---|
| 219 | addl $0x123, 0x100(%esp)
|
---|
| 220 | addl $0x123, (3*8)(%esp)
|
---|
| 221 | addl $0x123, (%ebp)
|
---|
| 222 | addl $0x123, (%esp)
|
---|
| 223 | cmpl $0x123, (%esp)
|
---|
| 224 |
|
---|
[331] | 225 | #ifdef __x86_64__
|
---|
| 226 | xor %bl,%ah
|
---|
| 227 | xor %bl,%r8b
|
---|
| 228 | xor %r9b,%bl
|
---|
| 229 | xor %sil,%cl
|
---|
| 230 | add %eax,(%r8d)
|
---|
| 231 | add %ebx,(%r9)
|
---|
| 232 | add %edx,(%r10d,%r11d)
|
---|
| 233 | add %ecx,(%r12,%r13)
|
---|
| 234 | add %esi,(%r14,%r15,4)
|
---|
| 235 | add %edi,0x1000(%rbx,%r12,8)
|
---|
| 236 | add %r11,0x1000(%ebp,%r9d,8)
|
---|
| 237 | movb $12, %ah
|
---|
| 238 | movb $13, %bpl
|
---|
| 239 | movb $14, %dil
|
---|
| 240 | movb $15, %r12b
|
---|
| 241 | #endif
|
---|
| 242 |
|
---|
[279] | 243 | add %eax, (%ebx)
|
---|
| 244 | add (%ebx), %eax
|
---|
| 245 |
|
---|
| 246 | or %dx, (%ebx)
|
---|
| 247 | or (%ebx), %si
|
---|
| 248 |
|
---|
| 249 | add %cl, (%ebx)
|
---|
| 250 | add (%ebx), %dl
|
---|
| 251 |
|
---|
| 252 | inc %edx
|
---|
| 253 | incl 0x10000
|
---|
| 254 | incb 0x10000
|
---|
| 255 | dec %dx
|
---|
| 256 |
|
---|
| 257 | test $1, %al
|
---|
| 258 | test $1, %cl
|
---|
| 259 |
|
---|
| 260 | testl $1, 0x1000
|
---|
| 261 | testb $1, 0x1000
|
---|
| 262 | testw $1, 0x1000
|
---|
| 263 | test %eax, %ebx
|
---|
| 264 | test %eax, 0x1000
|
---|
| 265 | test 0x1000, %edx
|
---|
| 266 |
|
---|
| 267 | not %edx
|
---|
| 268 | notw 0x10000
|
---|
| 269 | notl 0x10000
|
---|
| 270 | notb 0x10000
|
---|
| 271 |
|
---|
| 272 | neg %edx
|
---|
| 273 | negw 0x10000
|
---|
| 274 | negl 0x10000
|
---|
| 275 | negb 0x10000
|
---|
| 276 |
|
---|
| 277 | imul %ecx
|
---|
| 278 | mul %edx
|
---|
| 279 | mulb %cl
|
---|
| 280 |
|
---|
| 281 | imul %eax, %ecx
|
---|
| 282 | imul 0x1000, %cx
|
---|
| 283 | imul $10, %eax, %ecx
|
---|
| 284 | imul $10, %ax, %cx
|
---|
| 285 | imul $10, %eax
|
---|
| 286 | imul $0x1100000, %eax
|
---|
| 287 | imul $1, %eax
|
---|
| 288 |
|
---|
| 289 | idivw 0x1000
|
---|
| 290 | div %ecx
|
---|
| 291 | div %bl
|
---|
| 292 | div %ecx, %eax
|
---|
| 293 |
|
---|
[331] | 294 | and $15,%bx
|
---|
| 295 | and $-20,%edx
|
---|
[279] | 296 |
|
---|
| 297 | shl %edx
|
---|
| 298 | shl $10, %edx
|
---|
| 299 | shl %cl, %edx
|
---|
| 300 |
|
---|
| 301 | shld $1, %eax, %edx
|
---|
| 302 | shld %cl, %eax, %edx
|
---|
| 303 | shld %eax, %edx
|
---|
| 304 |
|
---|
| 305 | shrd $1, %eax, %edx
|
---|
| 306 | shrd %cl, %eax, %edx
|
---|
| 307 | shrd %eax, %edx
|
---|
| 308 |
|
---|
| 309 | L4:
|
---|
| 310 | call 0x1000
|
---|
| 311 | call L4
|
---|
[331] | 312 | #ifdef __i386__
|
---|
[279] | 313 | call *%eax
|
---|
[331] | 314 | #else
|
---|
| 315 | call *%rax
|
---|
| 316 | #endif
|
---|
[279] | 317 | call *0x1000
|
---|
| 318 | call func1
|
---|
| 319 |
|
---|
| 320 | .global L5,L6
|
---|
| 321 |
|
---|
| 322 | L5:
|
---|
| 323 | L6:
|
---|
| 324 |
|
---|
[331] | 325 | #ifdef __i386__
|
---|
[279] | 326 | lcall $0x100, $0x1000
|
---|
[331] | 327 | #else
|
---|
| 328 | lcall *0x100
|
---|
| 329 | lcall *(%rax)
|
---|
| 330 | #endif
|
---|
[279] | 331 |
|
---|
| 332 | jmp 0x1000
|
---|
[331] | 333 | jmp *(%edi)
|
---|
| 334 | #ifdef __i386__
|
---|
[279] | 335 | jmp *%eax
|
---|
[331] | 336 | #else
|
---|
| 337 | jmp *%rax
|
---|
| 338 | #endif
|
---|
[279] | 339 | jmp *0x1000
|
---|
| 340 |
|
---|
[331] | 341 | #ifdef __i386__
|
---|
[279] | 342 | ljmp $0x100, $0x1000
|
---|
[331] | 343 | #else
|
---|
| 344 | ljmp *0x100
|
---|
| 345 | ljmp *(%rdi)
|
---|
| 346 | ljmpl *(%esi)
|
---|
| 347 | ljmpw *(%esi)
|
---|
| 348 | #endif
|
---|
[279] | 349 |
|
---|
| 350 | ret
|
---|
[331] | 351 | ret $10
|
---|
| 352 | #ifdef __i386__
|
---|
[279] | 353 | retl
|
---|
| 354 | retl $10
|
---|
[331] | 355 | #else
|
---|
| 356 | retq
|
---|
| 357 | retq $10
|
---|
| 358 | #endif
|
---|
[279] | 359 |
|
---|
| 360 | lret
|
---|
| 361 |
|
---|
| 362 | lret $10
|
---|
| 363 |
|
---|
| 364 | enter $1234, $10
|
---|
| 365 |
|
---|
| 366 | L3:
|
---|
| 367 | jo 0x1000
|
---|
| 368 | jnp 0x1001
|
---|
| 369 | jne 0x1002
|
---|
| 370 | jg 0x1003
|
---|
| 371 |
|
---|
| 372 | jo L3
|
---|
| 373 | jnp L3
|
---|
| 374 | jne L3
|
---|
| 375 | jg L3
|
---|
| 376 |
|
---|
| 377 | loopne L3
|
---|
| 378 | loopnz L3
|
---|
| 379 | loope L3
|
---|
| 380 | loopz L3
|
---|
| 381 | loop L3
|
---|
| 382 | jecxz L3
|
---|
| 383 |
|
---|
| 384 |
|
---|
| 385 | seto %al
|
---|
[331] | 386 | setc %al
|
---|
| 387 | setcb %al
|
---|
[279] | 388 | setnp 0x1000
|
---|
| 389 | setl 0xaaaa
|
---|
| 390 | setg %dl
|
---|
| 391 |
|
---|
| 392 | fadd
|
---|
| 393 | fadd %st(1), %st
|
---|
| 394 | fadd %st(0), %st(1)
|
---|
| 395 | fadd %st(3)
|
---|
| 396 |
|
---|
| 397 | fmul %st(0),%st(0)
|
---|
| 398 | fmul %st(0),%st(1)
|
---|
| 399 |
|
---|
| 400 | faddp %st(5)
|
---|
| 401 | faddp
|
---|
| 402 | faddp %st(1), %st
|
---|
| 403 |
|
---|
| 404 | fadds 0x1000
|
---|
| 405 | fiadds 0x1002
|
---|
| 406 | faddl 0x1004
|
---|
| 407 | fiaddl 0x1006
|
---|
| 408 |
|
---|
| 409 | fmul
|
---|
| 410 | fmul %st(1), %st
|
---|
| 411 | fmul %st(3)
|
---|
| 412 |
|
---|
| 413 | fmulp %st(5)
|
---|
| 414 | fmulp
|
---|
| 415 | fmulp %st(1), %st
|
---|
| 416 |
|
---|
| 417 | fmuls 0x1000
|
---|
| 418 | fimuls 0x1002
|
---|
| 419 | fmull 0x1004
|
---|
| 420 | fimull 0x1006
|
---|
| 421 |
|
---|
| 422 | fsub
|
---|
| 423 | fsub %st(1), %st
|
---|
| 424 | fsub %st(3)
|
---|
| 425 |
|
---|
| 426 | fsubp %st(5)
|
---|
| 427 | fsubp
|
---|
| 428 | fsubp %st(1), %st
|
---|
| 429 |
|
---|
| 430 | fsubs 0x1000
|
---|
| 431 | fisubs 0x1002
|
---|
| 432 | fsubl 0x1004
|
---|
| 433 | fisubl 0x1006
|
---|
| 434 |
|
---|
| 435 | fsubr
|
---|
| 436 | fsubr %st(1), %st
|
---|
| 437 | fsubr %st(3)
|
---|
| 438 |
|
---|
| 439 | fsubrp %st(5)
|
---|
| 440 | fsubrp
|
---|
| 441 | fsubrp %st(1), %st
|
---|
| 442 |
|
---|
| 443 | fsubrs 0x1000
|
---|
| 444 | fisubrs 0x1002
|
---|
| 445 | fsubrl 0x1004
|
---|
| 446 | fisubrl 0x1006
|
---|
| 447 |
|
---|
| 448 | fdiv
|
---|
| 449 | fdiv %st(1), %st
|
---|
| 450 | fdiv %st(3)
|
---|
| 451 |
|
---|
| 452 | fdivp %st(5)
|
---|
| 453 | fdivp
|
---|
| 454 | fdivp %st(1), %st
|
---|
| 455 |
|
---|
| 456 | fdivs 0x1000
|
---|
| 457 | fidivs 0x1002
|
---|
| 458 | fdivl 0x1004
|
---|
| 459 | fidivl 0x1006
|
---|
| 460 |
|
---|
| 461 | fcom %st(3)
|
---|
| 462 |
|
---|
| 463 | fcoms 0x1000
|
---|
| 464 | ficoms 0x1002
|
---|
| 465 | fcoml 0x1004
|
---|
| 466 | ficoml 0x1006
|
---|
| 467 |
|
---|
| 468 | fcomp %st(5)
|
---|
| 469 | fcomp
|
---|
| 470 | fcompp
|
---|
| 471 |
|
---|
| 472 | fcomps 0x1000
|
---|
| 473 | ficomps 0x1002
|
---|
| 474 | fcompl 0x1004
|
---|
| 475 | ficompl 0x1006
|
---|
| 476 |
|
---|
| 477 | fld %st(5)
|
---|
| 478 | fldl 0x1000
|
---|
| 479 | flds 0x1002
|
---|
| 480 | fildl 0x1004
|
---|
| 481 | fst %st(4)
|
---|
| 482 | fstp %st(6)
|
---|
| 483 | fstpt 0x1006
|
---|
| 484 | fbstp 0x1008
|
---|
| 485 |
|
---|
| 486 | fxch
|
---|
| 487 | fxch %st(4)
|
---|
| 488 |
|
---|
| 489 | fucom %st(6)
|
---|
| 490 | fucomp %st(3)
|
---|
| 491 | fucompp
|
---|
| 492 |
|
---|
| 493 | finit
|
---|
| 494 | fninit
|
---|
| 495 | fldcw 0x1000
|
---|
| 496 | fnstcw 0x1002
|
---|
| 497 | fstcw 0x1002
|
---|
| 498 | fnstsw 0x1004
|
---|
| 499 | fnstsw (%eax)
|
---|
| 500 | fstsw 0x1004
|
---|
| 501 | fstsw (%eax)
|
---|
| 502 | fnclex
|
---|
| 503 | fclex
|
---|
| 504 | fnstenv 0x1000
|
---|
| 505 | fstenv 0x1000
|
---|
| 506 | fldenv 0x1000
|
---|
| 507 | fnsave 0x1002
|
---|
| 508 | fsave 0x1000
|
---|
| 509 | frstor 0x1000
|
---|
| 510 | ffree %st(7)
|
---|
| 511 | ffreep %st(6)
|
---|
| 512 |
|
---|
| 513 | ftst
|
---|
| 514 | fxam
|
---|
| 515 | fld1
|
---|
| 516 | fldl2t
|
---|
| 517 | fldl2e
|
---|
| 518 | fldpi
|
---|
| 519 | fldlg2
|
---|
| 520 | fldln2
|
---|
| 521 | fldz
|
---|
| 522 |
|
---|
| 523 | f2xm1
|
---|
| 524 | fyl2x
|
---|
| 525 | fptan
|
---|
| 526 | fpatan
|
---|
| 527 | fxtract
|
---|
| 528 | fprem1
|
---|
| 529 | fdecstp
|
---|
| 530 | fincstp
|
---|
| 531 | fprem
|
---|
| 532 | fyl2xp1
|
---|
| 533 | fsqrt
|
---|
| 534 | fsincos
|
---|
| 535 | frndint
|
---|
| 536 | fscale
|
---|
| 537 | fsin
|
---|
| 538 | fcos
|
---|
| 539 | fchs
|
---|
| 540 | fabs
|
---|
| 541 | fnop
|
---|
| 542 | fwait
|
---|
| 543 |
|
---|
| 544 | bswap %edx
|
---|
[331] | 545 | bswapl %ecx
|
---|
[279] | 546 | xadd %ecx, %edx
|
---|
| 547 | xaddb %dl, 0x1000
|
---|
| 548 | xaddw %ax, 0x1000
|
---|
| 549 | xaddl %eax, 0x1000
|
---|
| 550 | cmpxchg %ecx, %edx
|
---|
| 551 | cmpxchgb %dl, 0x1000
|
---|
| 552 | cmpxchgw %ax, 0x1000
|
---|
| 553 | cmpxchgl %eax, 0x1000
|
---|
| 554 | invlpg 0x1000
|
---|
| 555 | cmpxchg8b 0x1002
|
---|
[331] | 556 | #ifdef __x86_64__
|
---|
| 557 | cmpxchg16b (%rax)
|
---|
| 558 | cmpxchg16b (%r10,%r11)
|
---|
| 559 | #endif
|
---|
[279] | 560 |
|
---|
| 561 | fcmovb %st(5), %st
|
---|
| 562 | fcmove %st(5), %st
|
---|
| 563 | fcmovbe %st(5), %st
|
---|
| 564 | fcmovu %st(5), %st
|
---|
| 565 | fcmovnb %st(5), %st
|
---|
| 566 | fcmovne %st(5), %st
|
---|
| 567 | fcmovnbe %st(5), %st
|
---|
| 568 | fcmovnu %st(5), %st
|
---|
| 569 | fcomi %st(5), %st
|
---|
| 570 | fucomi %st(5), %st
|
---|
| 571 | fcomip %st(5), %st
|
---|
| 572 | fucomip %st(5), %st
|
---|
| 573 |
|
---|
| 574 |
|
---|
| 575 |
|
---|
| 576 | cmovo 0x1000, %eax
|
---|
| 577 | cmovs 0x1000, %eax
|
---|
| 578 | cmovns %edx, %edi
|
---|
[331] | 579 | cmovne %ax, %si
|
---|
| 580 | cmovbw %ax, %di
|
---|
| 581 | cmovnbel %edx, %ecx
|
---|
| 582 | #ifdef __x86_64__
|
---|
| 583 | bswapq %rsi
|
---|
| 584 | bswapq %r10
|
---|
| 585 | cmovz %rdi,%rbx
|
---|
| 586 | cmovpeq %rsi, %rdx
|
---|
| 587 | #endif
|
---|
[279] | 588 |
|
---|
| 589 | int $3
|
---|
| 590 | int $0x10
|
---|
| 591 |
|
---|
[331] | 592 | #ifdef __i386__
|
---|
[279] | 593 | pusha
|
---|
| 594 | popa
|
---|
[331] | 595 | #endif
|
---|
| 596 | clc # another comment
|
---|
| 597 | cld # a comment with embedded ' tick
|
---|
[279] | 598 | cli
|
---|
| 599 | clts
|
---|
| 600 | cmc
|
---|
| 601 | lahf
|
---|
| 602 | sahf
|
---|
[331] | 603 | #ifdef __i386__
|
---|
[279] | 604 | pushfl
|
---|
| 605 | popfl
|
---|
[331] | 606 | #else
|
---|
| 607 | pushfq
|
---|
| 608 | popfq
|
---|
| 609 | #endif
|
---|
[279] | 610 | pushf
|
---|
| 611 | popf
|
---|
| 612 | stc
|
---|
| 613 | std
|
---|
| 614 | sti
|
---|
[331] | 615 | #ifdef __i386__
|
---|
[279] | 616 | aaa
|
---|
| 617 | aas
|
---|
| 618 | daa
|
---|
| 619 | das
|
---|
| 620 | aad
|
---|
| 621 | aam
|
---|
[331] | 622 | into
|
---|
| 623 | #endif
|
---|
[279] | 624 | cbw
|
---|
| 625 | cwd
|
---|
| 626 | cwde
|
---|
| 627 | cdq
|
---|
| 628 | cbtw
|
---|
| 629 | cwtd
|
---|
| 630 | cwtl
|
---|
| 631 | cltd
|
---|
| 632 | leave
|
---|
| 633 | int3
|
---|
| 634 | iret
|
---|
| 635 | rsm
|
---|
| 636 | hlt
|
---|
| 637 | wait
|
---|
| 638 | nop
|
---|
| 639 |
|
---|
| 640 | /* XXX: handle prefixes */
|
---|
| 641 | #if 0
|
---|
| 642 | aword
|
---|
| 643 | addr16
|
---|
| 644 | #endif
|
---|
| 645 | lock
|
---|
| 646 | rep
|
---|
| 647 | repe
|
---|
| 648 | repz
|
---|
| 649 | repne
|
---|
| 650 | repnz
|
---|
| 651 | nop
|
---|
| 652 |
|
---|
| 653 | lock ;negl (%eax)
|
---|
| 654 | wait ;pushf
|
---|
| 655 | rep ;stosb
|
---|
| 656 | repe ;lodsb
|
---|
| 657 | repz ;cmpsb
|
---|
| 658 | repne;movsb
|
---|
| 659 | repnz;outsb
|
---|
| 660 |
|
---|
| 661 | /* handle one-line prefix + ops */
|
---|
| 662 | lock negl (%eax)
|
---|
| 663 | wait pushf
|
---|
| 664 | rep stosb
|
---|
| 665 | repe lodsb
|
---|
| 666 | repz cmpsb
|
---|
| 667 | repne movsb
|
---|
| 668 | repnz outsb
|
---|
| 669 |
|
---|
| 670 | invd
|
---|
| 671 | wbinvd
|
---|
| 672 | cpuid
|
---|
| 673 | wrmsr
|
---|
| 674 | rdtsc
|
---|
| 675 | rdmsr
|
---|
| 676 | rdpmc
|
---|
| 677 | ud2
|
---|
[331] | 678 | #ifdef __x86_64__
|
---|
| 679 | syscall
|
---|
| 680 | sysret
|
---|
| 681 | sysretq
|
---|
| 682 | lfence
|
---|
| 683 | mfence
|
---|
| 684 | sfence
|
---|
| 685 | prefetchnta 0x18(%rdx)
|
---|
| 686 | prefetcht0 (%rcx)
|
---|
| 687 | prefetcht1 (%rsi)
|
---|
| 688 | prefetcht2 (%rdi)
|
---|
| 689 | prefetchw (%rdi)
|
---|
| 690 | clflush 0x1000(%rax,%rcx)
|
---|
| 691 | fxsaveq (%rdx)
|
---|
| 692 | fxsaveq (%r11)
|
---|
| 693 | fxrstorq (%rcx)
|
---|
| 694 | fxrstorq (%r10)
|
---|
[279] | 695 |
|
---|
[331] | 696 | #endif
|
---|
| 697 |
|
---|
| 698 | lar %ax,%dx
|
---|
| 699 | lar %eax,%dx
|
---|
| 700 | lar %ax,%edx
|
---|
| 701 | lar %eax,%edx
|
---|
| 702 | #ifdef __x86_64__
|
---|
| 703 | lar %ax,%rdx
|
---|
| 704 | lar %eax,%rdx
|
---|
| 705 | #endif
|
---|
[279] | 706 | emms
|
---|
| 707 | movd %edx, %mm3
|
---|
| 708 | movd 0x1000, %mm2
|
---|
| 709 | movd %mm4, %ecx
|
---|
| 710 | movd %mm5, 0x1000
|
---|
| 711 |
|
---|
| 712 | movq 0x1000, %mm2
|
---|
| 713 | movq %mm4, 0x1000
|
---|
| 714 |
|
---|
| 715 | pand 0x1000, %mm3
|
---|
| 716 | pand %mm4, %mm5
|
---|
| 717 |
|
---|
| 718 | psllw $1, %mm6
|
---|
| 719 | psllw 0x1000, %mm7
|
---|
| 720 | psllw %mm2, %mm7
|
---|
| 721 |
|
---|
| 722 | xlat
|
---|
| 723 | cmpsb
|
---|
| 724 | scmpw
|
---|
| 725 | insl
|
---|
| 726 | outsw
|
---|
| 727 | lodsb
|
---|
| 728 | slodl
|
---|
| 729 | movsb
|
---|
| 730 | movsl
|
---|
| 731 | smovb
|
---|
| 732 | scasb
|
---|
| 733 | sscaw
|
---|
| 734 | stosw
|
---|
| 735 | sstol
|
---|
| 736 |
|
---|
| 737 | bsf 0x1000, %ebx
|
---|
| 738 | bsr 0x1000, %ebx
|
---|
| 739 | bt %edx, 0x1000
|
---|
| 740 | btl $2, 0x1000
|
---|
| 741 | btc %edx, 0x1000
|
---|
| 742 | btcl $2, 0x1000
|
---|
| 743 | btr %edx, 0x1000
|
---|
| 744 | btrl $2, 0x1000
|
---|
| 745 | bts %edx, 0x1000
|
---|
| 746 | btsl $2, 0x1000
|
---|
| 747 |
|
---|
| 748 |
|
---|
| 749 |
|
---|
[331] | 750 | #ifdef __i386__
|
---|
[279] | 751 | boundl %edx, 0x10000
|
---|
| 752 | boundw %bx, 0x1000
|
---|
[331] | 753 |
|
---|
[279] | 754 | arpl %bx, 0x1000
|
---|
[331] | 755 | #endif
|
---|
[279] | 756 | lar 0x1000, %eax
|
---|
| 757 | lgdt 0x1000
|
---|
| 758 | lidt 0x1000
|
---|
| 759 | lldt 0x1000
|
---|
[331] | 760 | sgdt 0x1000
|
---|
| 761 | sidt 0x1000
|
---|
| 762 | sldt 0x1000
|
---|
| 763 | #ifdef __x86_64__
|
---|
| 764 | lgdtq 0x1000
|
---|
| 765 | lidtq 0x1000
|
---|
| 766 | sgdtq 0x1000
|
---|
| 767 | sidtq 0x1000
|
---|
| 768 |
|
---|
| 769 | swapgs
|
---|
| 770 |
|
---|
| 771 | str %rdx
|
---|
| 772 | str %r9
|
---|
| 773 | #endif
|
---|
| 774 |
|
---|
[279] | 775 | lmsw 0x1000
|
---|
| 776 | lsl 0x1000, %ecx
|
---|
| 777 | ltr 0x1000
|
---|
[331] | 778 | ltr %si
|
---|
[279] | 779 | smsw 0x1000
|
---|
| 780 | str 0x1000
|
---|
[331] | 781 | str %ecx
|
---|
| 782 | str %dx
|
---|
[279] | 783 |
|
---|
| 784 | verr 0x1000
|
---|
| 785 | verw 0x1000
|
---|
| 786 |
|
---|
[331] | 787 | #ifdef __i386__
|
---|
[279] | 788 | push %ds
|
---|
| 789 | pushw %ds
|
---|
| 790 | pushl %ds
|
---|
| 791 | pop %ds
|
---|
| 792 | popw %ds
|
---|
| 793 | popl %ds
|
---|
[331] | 794 | #endif
|
---|
[279] | 795 | fxsave 1(%ebx)
|
---|
| 796 | fxrstor 1(%ecx)
|
---|
[331] | 797 | #ifdef __i386__
|
---|
[279] | 798 | pushl $1
|
---|
[331] | 799 | #else
|
---|
| 800 | pushq $1
|
---|
| 801 | #endif
|
---|
[279] | 802 | pushw $1
|
---|
| 803 | push $1
|
---|
| 804 |
|
---|
| 805 | #ifdef __ASSEMBLER__ // should be defined, for S files
|
---|
| 806 | inc %eax
|
---|
| 807 | #endif
|
---|
| 808 |
|
---|
[331] | 809 | #ifndef _WIN32
|
---|
[279] | 810 | ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
|
---|
| 811 | xor %eax, %eax
|
---|
| 812 | ret
|
---|
| 813 |
|
---|
| 814 | .type ft1,STT_FUNC
|
---|
| 815 | .type ft2,@STT_FUNC
|
---|
| 816 | .type ft3,%STT_FUNC
|
---|
| 817 | .type ft4,"STT_FUNC"
|
---|
| 818 | .type ft5,function
|
---|
| 819 | .type ft6,@function
|
---|
| 820 | .type ft7,%function
|
---|
| 821 | .type ft8,"function"
|
---|
[331] | 822 | #endif
|
---|
[279] | 823 |
|
---|
| 824 | pause
|
---|
[331] | 825 | .rept 6
|
---|
| 826 | nop
|
---|
| 827 | .endr
|
---|
| 828 | .fill 4,1,0x90
|
---|
| 829 |
|
---|
| 830 | .section .text.one,"ax"
|
---|
| 831 | nop
|
---|
| 832 | .previous
|
---|
| 833 | .pushsection .text.one,"ax"
|
---|
| 834 | nop
|
---|
| 835 | .pushsection .text.two,"ax"
|
---|
| 836 | nop
|
---|
| 837 | .popsection
|
---|
| 838 | .popsection
|
---|
| 839 |
|
---|
| 840 | 1: ud2
|
---|
| 841 | .pushsection __bug_table,"a"
|
---|
| 842 | .align 8
|
---|
| 843 | 2: .long 1b - 2b
|
---|
| 844 | .long 0x600000 - 2b
|
---|
| 845 | .long 1b + 42
|
---|
| 846 | .long 43 + 1b
|
---|
| 847 | .long 2b + 144
|
---|
| 848 | .long 145 + 2b
|
---|
| 849 | .word 164, 0
|
---|
| 850 | .org 2b+32
|
---|
| 851 | #ifdef __x86_64__
|
---|
| 852 | .quad 1b
|
---|
| 853 | #else
|
---|
| 854 | .long 1b
|
---|
| 855 | #endif
|
---|
| 856 | .popsection
|
---|
| 857 | 3: mov %eax,%ecx
|
---|
| 858 | 4:
|
---|
| 859 | .pushsection .text.three, "ax"
|
---|
| 860 | nop
|
---|
| 861 | .skip (-((4b-3b) > 0) * 2) , 0x90
|
---|
| 862 | .popsection
|
---|
| 863 |
|
---|
| 864 | .globl overrideme
|
---|
| 865 | .weak overrideme
|
---|
| 866 | nop
|
---|
| 867 | .globl notimplemented
|
---|
| 868 | notimplemented:
|
---|
| 869 | ret
|
---|
| 870 | .set overrideme, notimplemented
|
---|
| 871 | overrideme = notimplemented
|
---|
| 872 | overrideme:
|
---|
| 873 | ret
|
---|
| 874 |
|
---|
| 875 | movd %esi, %mm1
|
---|
| 876 | movd %edi, %xmm2
|
---|
| 877 | movd (%ebx), %mm3
|
---|
| 878 | movd (%ebx), %xmm3
|
---|
| 879 | movd %mm1, %esi
|
---|
| 880 | movd %xmm2, %edi
|
---|
| 881 | movd %mm3, (%edx)
|
---|
| 882 | movd %xmm3, (%edx)
|
---|
| 883 | #ifdef __x86_64__
|
---|
| 884 | movd %rsi, %mm1
|
---|
| 885 | movd %rdi, %xmm2
|
---|
| 886 | movd (%rbx), %mm3
|
---|
| 887 | movd (%rbx), %xmm3
|
---|
| 888 | movd %mm1, %r12
|
---|
| 889 | movd %xmm2, %rdi
|
---|
| 890 | movd %mm3, (%r8)
|
---|
| 891 | movd %xmm3, (%r13)
|
---|
| 892 | #endif
|
---|
| 893 |
|
---|
| 894 | movq (%ebp), %mm1
|
---|
| 895 | movq %mm2, (%edi)
|
---|
| 896 | movq (%edi), %xmm3
|
---|
| 897 | movq %mm4, %mm5
|
---|
| 898 | #ifdef __x86_64__
|
---|
| 899 | movq %rcx, %mm1
|
---|
| 900 | movq %rdx, %xmm2
|
---|
| 901 | movq %r13, %xmm3
|
---|
| 902 | /* movq mem64->xmm is encoded as f30f7e by GAS, but as
|
---|
| 903 | 660f6e by tcc (which really is a movd and would need
|
---|
| 904 | a REX.W prefix to be movq). */
|
---|
| 905 | movq (%rsi), %xmm3
|
---|
| 906 | movq %mm1, %rdx
|
---|
| 907 | movq %xmm3, %rcx
|
---|
| 908 | movq %xmm4, (%rsi)
|
---|
| 909 | #endif
|
---|
| 910 |
|
---|
| 911 | #define TEST_MMX_SSE(insn) \
|
---|
| 912 | insn %mm1, %mm2; \
|
---|
| 913 | insn %xmm2, %xmm3; \
|
---|
| 914 | insn (%ebx), %xmm3;
|
---|
| 915 | #define TEST_MMX_SSE_I8(insn) \
|
---|
| 916 | TEST_MMX_SSE(insn) \
|
---|
| 917 | insn $0x42, %mm4; \
|
---|
| 918 | insn $0x42, %xmm4;
|
---|
| 919 |
|
---|
| 920 | TEST_MMX_SSE(packssdw)
|
---|
| 921 | TEST_MMX_SSE(packsswb)
|
---|
| 922 | TEST_MMX_SSE(packuswb)
|
---|
| 923 | TEST_MMX_SSE(paddb)
|
---|
| 924 | TEST_MMX_SSE(paddw)
|
---|
| 925 | TEST_MMX_SSE(paddd)
|
---|
| 926 | TEST_MMX_SSE(paddsb)
|
---|
| 927 | TEST_MMX_SSE(paddsw)
|
---|
| 928 | TEST_MMX_SSE(paddusb)
|
---|
| 929 | TEST_MMX_SSE(paddusw)
|
---|
| 930 | TEST_MMX_SSE(pand)
|
---|
| 931 | TEST_MMX_SSE(pandn)
|
---|
| 932 | TEST_MMX_SSE(pcmpeqb)
|
---|
| 933 | TEST_MMX_SSE(pcmpeqw)
|
---|
| 934 | TEST_MMX_SSE(pcmpeqd)
|
---|
| 935 | TEST_MMX_SSE(pcmpgtb)
|
---|
| 936 | TEST_MMX_SSE(pcmpgtw)
|
---|
| 937 | TEST_MMX_SSE(pcmpgtd)
|
---|
| 938 | TEST_MMX_SSE(pmaddwd)
|
---|
| 939 | TEST_MMX_SSE(pmulhw)
|
---|
| 940 | TEST_MMX_SSE(pmullw)
|
---|
| 941 | TEST_MMX_SSE(por)
|
---|
| 942 | TEST_MMX_SSE(psllw)
|
---|
| 943 | TEST_MMX_SSE_I8(psllw)
|
---|
| 944 | TEST_MMX_SSE(pslld)
|
---|
| 945 | TEST_MMX_SSE_I8(pslld)
|
---|
| 946 | TEST_MMX_SSE(psllq)
|
---|
| 947 | TEST_MMX_SSE_I8(psllq)
|
---|
| 948 | TEST_MMX_SSE(psraw)
|
---|
| 949 | TEST_MMX_SSE_I8(psraw)
|
---|
| 950 | TEST_MMX_SSE(psrad)
|
---|
| 951 | TEST_MMX_SSE_I8(psrad)
|
---|
| 952 | TEST_MMX_SSE(psrlw)
|
---|
| 953 | TEST_MMX_SSE_I8(psrlw)
|
---|
| 954 | TEST_MMX_SSE(psrld)
|
---|
| 955 | TEST_MMX_SSE_I8(psrld)
|
---|
| 956 | TEST_MMX_SSE(psrlq)
|
---|
| 957 | TEST_MMX_SSE_I8(psrlq)
|
---|
| 958 | TEST_MMX_SSE(psubb)
|
---|
| 959 | TEST_MMX_SSE(psubw)
|
---|
| 960 | TEST_MMX_SSE(psubd)
|
---|
| 961 | TEST_MMX_SSE(psubsb)
|
---|
| 962 | TEST_MMX_SSE(psubsw)
|
---|
| 963 | TEST_MMX_SSE(psubusb)
|
---|
| 964 | TEST_MMX_SSE(psubusw)
|
---|
| 965 | TEST_MMX_SSE(punpckhbw)
|
---|
| 966 | TEST_MMX_SSE(punpckhwd)
|
---|
| 967 | TEST_MMX_SSE(punpckhdq)
|
---|
| 968 | TEST_MMX_SSE(punpcklbw)
|
---|
| 969 | TEST_MMX_SSE(punpcklwd)
|
---|
| 970 | TEST_MMX_SSE(punpckldq)
|
---|
| 971 | TEST_MMX_SSE(pxor)
|
---|
| 972 |
|
---|
| 973 | cvtpi2ps %mm1, %xmm2
|
---|
| 974 | cvtpi2ps (%ebx), %xmm2
|
---|
| 975 | TEST_MMX_SSE(pmaxsw)
|
---|
| 976 | TEST_MMX_SSE(pmaxub)
|
---|
| 977 | TEST_MMX_SSE(pminsw)
|
---|
| 978 | TEST_MMX_SSE(pminub)
|
---|