2 /* Note, this is only a basic smoke test of LD{A}XP and ST{L}XP. Their
3 atomicity properties are tested by memcheck/tests/atomic_incs.c. */
10 typedef unsigned int UInt
;
11 typedef unsigned long long int ULong
;
14 void initBlock ( ULong
* block
)
16 block
[0] = 0x0001020304050607ULL
;
17 block
[1] = 0x1011121314151617ULL
;
18 block
[2] = 0x2021222324252627ULL
;
19 block
[3] = 0x3031323334353637ULL
;
20 block
[4] = 0x4041424344454647ULL
;
21 block
[5] = 0x5051525354555657ULL
;
24 void printBlock ( const char* who
,
25 ULong
* block
, ULong rt1contents
, ULong rt2contents
,
28 printf("Block %s (%s)\n", who
, zeroIfSuccess
== 0 ? "success" : "FAILURE" );
29 for (int i
= 0; i
< 6; i
++) {
30 printf("0x%016llx\n", block
[i
]);
32 printf("0x%016llx rt1contents\n", rt1contents
);
33 printf("0x%016llx rt2contents\n", rt2contents
);
39 ULong
* block
= memalign(16, 6 * sizeof(ULong
));
42 ULong rt1in
, rt2in
, rt1out
, rt2out
;
45 // Do ldxp then stxp with x-registers
47 rt1in
= 0x5555666677778888ULL
;
48 rt2in
= 0xAAAA9999BBBB0000ULL
;
49 rt1out
= 0x1111222233334444ULL
;
50 rt2out
= 0xFFFFEEEEDDDDCCCCULL
;
53 "ldxp %1, %2, [%5]" "\n\t"
54 "stxp %w0, %3, %4, [%5]" "\n\t"
66 printBlock("after ldxp/stxp 2x64-bit", block
, rt1out
, rt2out
, scRes
);
68 // Do ldxp then stxp with w-registers
70 rt1in
= 0x5555666677778888ULL
;
71 rt2in
= 0xAAAA9999BBBB0000ULL
;
72 rt1out
= 0x1111222233334444ULL
;
73 rt2out
= 0xFFFFEEEEDDDDCCCCULL
;
76 "ldxp %w1, %w2, [%5]" "\n\t"
77 "stxp %w0, %w3, %w4, [%5]" "\n\t"
89 printBlock("after ldxp/stxp 2x32-bit", block
, rt1out
, rt2out
, scRes
);