]>
git.proxmox.com Git - qemu.git/blob - tests/test-i386.c
86aa94915a393b50831e4fcb4cb8f49eeb184eaa
8 #define xglue(x, y) x ## y
9 #define glue(x, y) xglue(x, y)
10 #define stringify(s) tostring(s)
11 #define tostring(s) #s
20 #define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
22 static void *call_start __init_call
= NULL
;
24 #define CC_MASK (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A)
27 #include "test-i386.h"
30 #include "test-i386.h"
33 #include "test-i386.h"
36 #include "test-i386.h"
39 #include "test-i386.h"
42 #include "test-i386.h"
46 #include "test-i386.h"
50 #include "test-i386.h"
55 #include "test-i386.h"
60 #include "test-i386.h"
65 #include "test-i386.h"
70 #include "test-i386.h"
73 #define CC_MASK (CC_C | CC_P | CC_Z | CC_S | CC_O)
76 #include "test-i386-shift.h"
79 #include "test-i386-shift.h"
82 #include "test-i386-shift.h"
85 #include "test-i386-shift.h"
88 #include "test-i386-shift.h"
92 #include "test-i386-shift.h"
96 #include "test-i386-shift.h"
101 #include "test-i386-shift.h"
106 #include "test-i386-shift.h"
108 /* XXX: should be more precise ? */
110 #define CC_MASK (CC_C)
114 #include "test-i386-shift.h"
118 #include "test-i386-shift.h"
122 #include "test-i386-shift.h"
126 #include "test-i386-shift.h"
128 /* lea test (modrm support) */
129 #define TEST_LEA(STR)\
131 asm("leal " STR ", %0"\
133 : "a" (eax), "b" (ebx), "c" (ecx), "d" (edx), "S" (esi), "D" (edi));\
134 printf("lea %s = %08x\n", STR, res);\
137 #define TEST_LEA16(STR)\
139 asm(".code16 ; .byte 0x67 ; leal " STR ", %0 ; .code32"\
141 : "a" (eax), "b" (ebx), "c" (ecx), "d" (edx), "S" (esi), "D" (edi));\
142 printf("lea %s = %08x\n", STR, res);\
148 int eax
, ebx
, ecx
, edx
, esi
, edi
, res
;
165 TEST_LEA("0x40(%%eax)");
166 TEST_LEA("0x40(%%ebx)");
167 TEST_LEA("0x40(%%ecx)");
168 TEST_LEA("0x40(%%edx)");
169 TEST_LEA("0x40(%%esi)");
170 TEST_LEA("0x40(%%edi)");
172 TEST_LEA("0x4000(%%eax)");
173 TEST_LEA("0x4000(%%ebx)");
174 TEST_LEA("0x4000(%%ecx)");
175 TEST_LEA("0x4000(%%edx)");
176 TEST_LEA("0x4000(%%esi)");
177 TEST_LEA("0x4000(%%edi)");
179 TEST_LEA("(%%eax, %%ecx)");
180 TEST_LEA("(%%ebx, %%edx)");
181 TEST_LEA("(%%ecx, %%ecx)");
182 TEST_LEA("(%%edx, %%ecx)");
183 TEST_LEA("(%%esi, %%ecx)");
184 TEST_LEA("(%%edi, %%ecx)");
186 TEST_LEA("0x40(%%eax, %%ecx)");
187 TEST_LEA("0x4000(%%ebx, %%edx)");
189 TEST_LEA("(%%ecx, %%ecx, 2)");
190 TEST_LEA("(%%edx, %%ecx, 4)");
191 TEST_LEA("(%%esi, %%ecx, 8)");
193 TEST_LEA("(,%%eax, 2)");
194 TEST_LEA("(,%%ebx, 4)");
195 TEST_LEA("(,%%ecx, 8)");
197 TEST_LEA("0x40(,%%eax, 2)");
198 TEST_LEA("0x40(,%%ebx, 4)");
199 TEST_LEA("0x40(,%%ecx, 8)");
202 TEST_LEA("-10(%%ecx, %%ecx, 2)");
203 TEST_LEA("-10(%%edx, %%ecx, 4)");
204 TEST_LEA("-10(%%esi, %%ecx, 8)");
206 TEST_LEA("0x4000(%%ecx, %%ecx, 2)");
207 TEST_LEA("0x4000(%%edx, %%ecx, 4)");
208 TEST_LEA("0x4000(%%esi, %%ecx, 8)");
210 /* limited 16 bit addressing test */
211 TEST_LEA16("0x4000");
212 TEST_LEA16("(%%bx)");
213 TEST_LEA16("(%%si)");
214 TEST_LEA16("(%%di)");
215 TEST_LEA16("0x40(%%bx)");
216 TEST_LEA16("0x40(%%si)");
217 TEST_LEA16("0x40(%%di)");
218 TEST_LEA16("0x4000(%%bx)");
219 TEST_LEA16("0x4000(%%si)");
220 TEST_LEA16("(%%bx,%%si)");
221 TEST_LEA16("(%%bx,%%di)");
222 TEST_LEA16("0x40(%%bx,%%si)");
223 TEST_LEA16("0x40(%%bx,%%di)");
224 TEST_LEA16("0x4000(%%bx,%%si)");
225 TEST_LEA16("0x4000(%%bx,%%di)");
228 #define TEST_JCC(JCC, v1, v2)\
231 asm("movl $1, %0\n\t"\
237 : "r" (v1), "r" (v2));\
238 printf("%-10s %d\n", "j" JCC, res);\
240 asm("movl $0, %0\n\t"\
242 "set" JCC " %b0\n\t"\
244 : "r" (v1), "r" (v2));\
245 printf("%-10s %d\n", "set" JCC, res);\
247 asm("movl $0x12345678, %0\n\t"\
249 "cmov" JCC "l %3, %0\n\t"\
251 : "r" (v1), "r" (v2), "m" (1));\
252 printf("%-10s R=0x%08x\n", "cmov" JCC "l", res);\
253 asm("movl $0x12345678, %0\n\t"\
255 "cmov" JCC "w %w3, %w0\n\t"\
257 : "r" (v1), "r" (v2), "r" (1));\
258 printf("%-10s R=0x%08x\n", "cmov" JCC "w", res);\
262 /* various jump tests */
265 TEST_JCC("ne", 1, 1);
266 TEST_JCC("ne", 1, 0);
273 TEST_JCC("l", 1, -1);
275 TEST_JCC("le", 1, 1);
276 TEST_JCC("le", 1, 0);
277 TEST_JCC("le", 1, -1);
279 TEST_JCC("ge", 1, 1);
280 TEST_JCC("ge", 1, 0);
281 TEST_JCC("ge", -1, 1);
285 TEST_JCC("g", 1, -1);
289 TEST_JCC("b", 1, -1);
291 TEST_JCC("be", 1, 1);
292 TEST_JCC("be", 1, 0);
293 TEST_JCC("be", 1, -1);
295 TEST_JCC("ae", 1, 1);
296 TEST_JCC("ae", 1, 0);
297 TEST_JCC("ae", 1, -1);
301 TEST_JCC("a", 1, -1);
307 TEST_JCC("np", 1, 1);
308 TEST_JCC("np", 1, 0);
310 TEST_JCC("o", 0x7fffffff, 0);
311 TEST_JCC("o", 0x7fffffff, -1);
313 TEST_JCC("no", 0x7fffffff, 0);
314 TEST_JCC("no", 0x7fffffff, -1);
317 TEST_JCC("s", 0, -1);
320 TEST_JCC("ns", 0, 1);
321 TEST_JCC("ns", 0, -1);
322 TEST_JCC("ns", 0, 0);
326 #define CC_MASK (CC_O | CC_C)
329 #include "test-i386-muldiv.h"
332 #include "test-i386-muldiv.h"
338 #include "test-i386-muldiv.h"
341 #include "test-i386-muldiv.h"
343 void test_imulw2(int op0
, int op1
)
345 int res
, s1
, s0
, flags
;
355 : "=q" (res
), "=g" (flags
)
356 : "q" (s1
), "0" (res
), "1" (flags
));
357 printf("%-10s A=%08x B=%08x R=%08x CC=%04x\n",
358 "imulw", s0
, s1
, res
, flags
& CC_MASK
);
361 void test_imull2(int op0
, int op1
)
363 int res
, s1
, s0
, flags
;
373 : "=q" (res
), "=g" (flags
)
374 : "q" (s1
), "0" (res
), "1" (flags
));
375 printf("%-10s A=%08x B=%08x R=%08x CC=%04x\n",
376 "imull", s0
, s1
, res
, flags
& CC_MASK
);
381 test_imulb(0x1234561d, 4);
383 test_imulb(0x80, 0x80);
384 test_imulb(0x10, 0x10);
386 test_imulw(0, 0x1234001d, 45);
387 test_imulw(0, 23, -45);
388 test_imulw(0, 0x8000, 0x8000);
389 test_imulw(0, 0x100, 0x100);
391 test_imull(0, 0x1234001d, 45);
392 test_imull(0, 23, -45);
393 test_imull(0, 0x80000000, 0x80000000);
394 test_imull(0, 0x10000, 0x10000);
396 test_mulb(0x1234561d, 4);
398 test_mulb(0x80, 0x80);
399 test_mulb(0x10, 0x10);
401 test_mulw(0, 0x1234001d, 45);
402 test_mulw(0, 23, -45);
403 test_mulw(0, 0x8000, 0x8000);
404 test_mulw(0, 0x100, 0x100);
406 test_mull(0, 0x1234001d, 45);
407 test_mull(0, 23, -45);
408 test_mull(0, 0x80000000, 0x80000000);
409 test_mull(0, 0x10000, 0x10000);
411 test_imulw2(0x1234001d, 45);
412 test_imulw2(23, -45);
413 test_imulw2(0x8000, 0x8000);
414 test_imulw2(0x100, 0x100);
416 test_imull2(0x1234001d, 45);
417 test_imull2(23, -45);
418 test_imull2(0x80000000, 0x80000000);
419 test_imull2(0x10000, 0x10000);
421 test_idivb(0x12341678, 0x127e);
422 test_idivb(0x43210123, -5);
423 test_idivb(0x12340004, -1);
425 test_idivw(0, 0x12345678, 12347);
426 test_idivw(0, -23223, -45);
427 test_idivw(0, 0x12348000, -1);
428 test_idivw(0x12343, 0x12345678, 0x81238567);
430 test_idivl(0, 0x12345678, 12347);
431 test_idivl(0, -233223, -45);
432 test_idivl(0, 0x80000000, -1);
433 test_idivl(0x12343, 0x12345678, 0x81234567);
435 test_divb(0x12341678, 0x127e);
436 test_divb(0x43210123, -5);
437 test_divb(0x12340004, -1);
439 test_divw(0, 0x12345678, 12347);
440 test_divw(0, -23223, -45);
441 test_divw(0, 0x12348000, -1);
442 test_divw(0x12343, 0x12345678, 0x81238567);
444 test_divl(0, 0x12345678, 12347);
445 test_divl(0, -233223, -45);
446 test_divl(0, 0x80000000, -1);
447 test_divl(0x12343, 0x12345678, 0x81234567);
450 #define TEST_BSX(op, size, op0)\
454 asm("xorl %1, %1 ; " #op " %" size "2, %" size "0 ; setz %b1" \
455 : "=r" (res), "=q" (resz)\
457 printf("%-10s A=%08x R=%08x %d\n", #op, val, resz ? 0 : res, resz);\
462 TEST_BSX(bsrw
, "w", 0);
463 TEST_BSX(bsrw
, "w", 0x12340128);
464 TEST_BSX(bsrl
, "", 0);
465 TEST_BSX(bsrl
, "", 0x00340128);
466 TEST_BSX(bsfw
, "w", 0);
467 TEST_BSX(bsfw
, "w", 0x12340128);
468 TEST_BSX(bsfl
, "", 0);
469 TEST_BSX(bsfl
, "", 0x00340128);
472 /**********************************************/
474 void test_fops(double a
, double b
)
476 printf("a=%f b=%f a+b=%f\n", a
, b
, a
+ b
);
477 printf("a=%f b=%f a-b=%f\n", a
, b
, a
- b
);
478 printf("a=%f b=%f a*b=%f\n", a
, b
, a
* b
);
479 printf("a=%f b=%f a/b=%f\n", a
, b
, a
/ b
);
480 printf("a=%f b=%f fmod(a, b)=%f\n", a
, b
, fmod(a
, b
));
481 printf("a=%f sqrt(a)=%f\n", a
, sqrt(a
));
482 printf("a=%f sin(a)=%f\n", a
, sin(a
));
483 printf("a=%f cos(a)=%f\n", a
, cos(a
));
484 printf("a=%f tan(a)=%f\n", a
, tan(a
));
485 printf("a=%f log(a)=%f\n", a
, log(a
));
486 printf("a=%f exp(a)=%f\n", a
, exp(a
));
487 printf("a=%f b=%f atan2(a, b)=%f\n", a
, b
, atan2(a
, b
));
488 /* just to test some op combining */
489 printf("a=%f asin(sin(a))=%f\n", a
, asin(sin(a
)));
490 printf("a=%f acos(cos(a))=%f\n", a
, acos(cos(a
)));
491 printf("a=%f atan(tan(a))=%f\n", a
, atan(tan(a
)));
495 void test_fcmp(double a
, double b
)
497 printf("(%f<%f)=%d\n",
499 printf("(%f<=%f)=%d\n",
501 printf("(%f==%f)=%d\n",
503 printf("(%f>%f)=%d\n",
505 printf("(%f<=%f)=%d\n",
509 void test_fcvt(double a
)
516 printf("(float)%f = %f\n", a
, fa
);
517 printf("(long double)%f = %Lf\n", a
, la
);
518 printf("a=%016Lx\n", *(long long *)&a
);
519 printf("la=%016Lx %04x\n", *(long long *)&la
,
520 *(unsigned short *)((char *)(&la
) + 8));
521 printf("a=%f floor(a)=%f\n", a
, floor(a
));
522 printf("a=%f ceil(a)=%f\n", a
, ceil(a
));
523 printf("a=%f rint(a)=%f\n", a
, rint(a
));
527 asm("fld" #N : "=t" (a)); \
528 printf("fld" #N "= %f\n", a);
530 void test_fconst(void)
542 void test_fbcd(double a
)
544 unsigned short bcd
[5];
547 asm("fbstp %0" : "=m" (bcd
[0]) : "t" (a
) : "st");
548 asm("fbld %1" : "=t" (b
) : "m" (bcd
[0]));
549 printf("a=%f bcd=%04x%04x%04x%04x%04x b=%f\n",
550 a
, bcd
[4], bcd
[3], bcd
[2], bcd
[1], bcd
[0], b
);
553 void test_floats(void)
564 test_fbcd(1234567890123456);
565 test_fbcd(-123451234567890);
568 /**********************************************/
570 #define TEST_BCD(op, op0, cc_in, cc_mask)\
580 : "=a" (res), "=g" (flags)\
581 : "0" (res), "1" (flags));\
582 printf("%-10s A=%08x R=%08x CCIN=%04x CC=%04x\n",\
583 #op, op0, res, cc_in, flags & cc_mask);\
588 TEST_BCD(daa
, 0x12340503, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
589 TEST_BCD(daa
, 0x12340506, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
590 TEST_BCD(daa
, 0x12340507, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
591 TEST_BCD(daa
, 0x12340559, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
592 TEST_BCD(daa
, 0x12340560, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
593 TEST_BCD(daa
, 0x1234059f, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
594 TEST_BCD(daa
, 0x123405a0, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
595 TEST_BCD(daa
, 0x12340503, 0, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
596 TEST_BCD(daa
, 0x12340506, 0, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
597 TEST_BCD(daa
, 0x12340503, CC_C
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
598 TEST_BCD(daa
, 0x12340506, CC_C
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
599 TEST_BCD(daa
, 0x12340503, CC_C
| CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
600 TEST_BCD(daa
, 0x12340506, CC_C
| CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
602 TEST_BCD(das
, 0x12340503, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
603 TEST_BCD(das
, 0x12340506, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
604 TEST_BCD(das
, 0x12340507, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
605 TEST_BCD(das
, 0x12340559, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
606 TEST_BCD(das
, 0x12340560, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
607 TEST_BCD(das
, 0x1234059f, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
608 TEST_BCD(das
, 0x123405a0, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
609 TEST_BCD(das
, 0x12340503, 0, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
610 TEST_BCD(das
, 0x12340506, 0, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
611 TEST_BCD(das
, 0x12340503, CC_C
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
612 TEST_BCD(das
, 0x12340506, CC_C
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
613 TEST_BCD(das
, 0x12340503, CC_C
| CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
614 TEST_BCD(das
, 0x12340506, CC_C
| CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_A
));
616 TEST_BCD(aaa
, 0x12340205, CC_A
, (CC_C
| CC_A
));
617 TEST_BCD(aaa
, 0x12340306, CC_A
, (CC_C
| CC_A
));
618 TEST_BCD(aaa
, 0x1234040a, CC_A
, (CC_C
| CC_A
));
619 TEST_BCD(aaa
, 0x123405fa, CC_A
, (CC_C
| CC_A
));
620 TEST_BCD(aaa
, 0x12340205, 0, (CC_C
| CC_A
));
621 TEST_BCD(aaa
, 0x12340306, 0, (CC_C
| CC_A
));
622 TEST_BCD(aaa
, 0x1234040a, 0, (CC_C
| CC_A
));
623 TEST_BCD(aaa
, 0x123405fa, 0, (CC_C
| CC_A
));
625 TEST_BCD(aas
, 0x12340205, CC_A
, (CC_C
| CC_A
));
626 TEST_BCD(aas
, 0x12340306, CC_A
, (CC_C
| CC_A
));
627 TEST_BCD(aas
, 0x1234040a, CC_A
, (CC_C
| CC_A
));
628 TEST_BCD(aas
, 0x123405fa, CC_A
, (CC_C
| CC_A
));
629 TEST_BCD(aas
, 0x12340205, 0, (CC_C
| CC_A
));
630 TEST_BCD(aas
, 0x12340306, 0, (CC_C
| CC_A
));
631 TEST_BCD(aas
, 0x1234040a, 0, (CC_C
| CC_A
));
632 TEST_BCD(aas
, 0x123405fa, 0, (CC_C
| CC_A
));
634 TEST_BCD(aam
, 0x12340547, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_O
| CC_A
));
635 TEST_BCD(aad
, 0x12340407, CC_A
, (CC_C
| CC_P
| CC_Z
| CC_S
| CC_O
| CC_A
));
638 /**********************************************/
639 /* segmentation tests */
642 #include <linux/unistd.h>
644 _syscall3(int, modify_ldt
, int, func
, void *, ptr
, unsigned long, bytecount
)
646 uint8_t seg_data1
[4096];
647 uint8_t seg_data2
[4096];
649 #define MK_SEL(n) (((n) << 3) | 4)
651 /* NOTE: we use Linux modify_ldt syscall */
654 struct modify_ldt_ldt_s ldt
;
655 long long ldt_table
[3];
659 ldt
.entry_number
= 1;
660 ldt
.base_addr
= (unsigned long)&seg_data1
;
661 ldt
.limit
= (sizeof(seg_data1
) + 0xfff) >> 12;
663 ldt
.contents
= MODIFY_LDT_CONTENTS_DATA
;
664 ldt
.read_exec_only
= 0;
665 ldt
.limit_in_pages
= 1;
666 ldt
.seg_not_present
= 0;
668 modify_ldt(1, &ldt
, sizeof(ldt
)); /* write ldt entry */
670 ldt
.entry_number
= 2;
671 ldt
.base_addr
= (unsigned long)&seg_data2
;
672 ldt
.limit
= (sizeof(seg_data2
) + 0xfff) >> 12;
674 ldt
.contents
= MODIFY_LDT_CONTENTS_DATA
;
675 ldt
.read_exec_only
= 0;
676 ldt
.limit_in_pages
= 1;
677 ldt
.seg_not_present
= 0;
679 modify_ldt(1, &ldt
, sizeof(ldt
)); /* write ldt entry */
681 modify_ldt(0, &ldt_table
, sizeof(ldt_table
)); /* read ldt entries */
683 printf("%d: %016Lx\n", i
, ldt_table
[i
]);
685 /* do some tests with fs or gs */
686 asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1)));
687 asm volatile ("movl %0, %%gs" : : "r" (MK_SEL(2)));
692 asm volatile ("fs movzbl 0x1, %0" : "=r" (res
));
693 printf("FS[1] = %02x\n", res
);
695 asm volatile ("gs movzbl 0x1, %0" : "=r" (res
));
696 printf("GS[1] = %02x\n", res
);
698 /* tests with ds/ss (implicit segment case) */
700 asm volatile ("pushl %%ebp\n\t"
705 "movzbl (%%ebp), %1\n\t"
708 : "=r" (res
), "=r" (res2
)
709 : "r" (MK_SEL(1)), "r" (&tmp
));
710 printf("DS[1] = %02x\n", res
);
711 printf("SS[tmp] = %02x\n", res2
);
714 #define TEST_XCHG(op, size, opconst)\
719 asm(#op " %" size "0, %" size "1" \
720 : "=q" (op0), opconst (op1) \
721 : "0" (op0), "1" (op1));\
722 printf("%-10s A=%08x B=%08x\n",\
726 #define TEST_CMPXCHG(op, size, opconst, eax)\
731 asm(#op " %" size "0, %" size "1" \
732 : "=q" (op0), opconst (op1) \
733 : "0" (op0), "1" (op1), "a" (eax));\
734 printf("%-10s EAX=%08x A=%08x C=%08x\n",\
735 #op, eax, op0, op1);\
740 TEST_XCHG(xchgl
, "", "=q");
741 TEST_XCHG(xchgw
, "w", "=q");
742 TEST_XCHG(xchgb
, "b", "=q");
744 TEST_XCHG(xchgl
, "", "=m");
745 TEST_XCHG(xchgw
, "w", "=m");
746 TEST_XCHG(xchgb
, "b", "=m");
748 TEST_XCHG(xaddl
, "", "=q");
749 TEST_XCHG(xaddw
, "w", "=q");
750 TEST_XCHG(xaddb
, "b", "=q");
752 TEST_XCHG(xaddl
, "", "=m");
753 TEST_XCHG(xaddw
, "w", "=m");
754 TEST_XCHG(xaddb
, "b", "=m");
756 TEST_CMPXCHG(cmpxchgl
, "", "=q", 0xfbca7654);
757 TEST_CMPXCHG(cmpxchgw
, "w", "=q", 0xfbca7654);
758 TEST_CMPXCHG(cmpxchgb
, "b", "=q", 0xfbca7654);
760 TEST_CMPXCHG(cmpxchgl
, "", "=q", 0xfffefdfc);
761 TEST_CMPXCHG(cmpxchgw
, "w", "=q", 0xfffefdfc);
762 TEST_CMPXCHG(cmpxchgb
, "b", "=q", 0xfffefdfc);
764 TEST_CMPXCHG(cmpxchgl
, "", "=m", 0xfbca7654);
765 TEST_CMPXCHG(cmpxchgw
, "w", "=m", 0xfbca7654);
766 TEST_CMPXCHG(cmpxchgb
, "b", "=m", 0xfbca7654);
768 TEST_CMPXCHG(cmpxchgl
, "", "=m", 0xfffefdfc);
769 TEST_CMPXCHG(cmpxchgw
, "w", "=m", 0xfffefdfc);
770 TEST_CMPXCHG(cmpxchgb
, "b", "=m", 0xfffefdfc);
773 static void *call_end __init_call
= NULL
;
775 int main(int argc
, char **argv
)
780 ptr
= &call_start
+ 1;
781 while (*ptr
!= NULL
) {