4 typedef unsigned long long int ULong
;
13 #define AMD64G_CC_SHIFT_O 11
14 #define AMD64G_CC_SHIFT_S 7
15 #define AMD64G_CC_SHIFT_Z 6
16 #define AMD64G_CC_SHIFT_A 4
17 #define AMD64G_CC_SHIFT_C 0
18 #define AMD64G_CC_SHIFT_P 2
20 #define AMD64G_CC_MASK_O (1 << AMD64G_CC_SHIFT_O)
21 #define AMD64G_CC_MASK_S (1 << AMD64G_CC_SHIFT_S)
22 #define AMD64G_CC_MASK_Z (1 << AMD64G_CC_SHIFT_Z)
23 #define AMD64G_CC_MASK_A (1 << AMD64G_CC_SHIFT_A)
24 #define AMD64G_CC_MASK_C (1 << AMD64G_CC_SHIFT_C)
25 #define AMD64G_CC_MASK_P (1 << AMD64G_CC_SHIFT_P)
28 (AMD64G_CC_MASK_O | AMD64G_CC_MASK_S | AMD64G_CC_MASK_Z \
29 | AMD64G_CC_MASK_A | AMD64G_CC_MASK_C | AMD64G_CC_MASK_P)
31 extern void shld64 ( void );
43 "\tshldq %cl, %r11, %rsi\n"
44 "\tmovq %rsi, result\n"
54 extern void shld32 ( void );
66 "\tshldl %cl, %r11d, %esi\n"
67 "\tmovq %rsi, result\n"
77 extern void shld16 ( void );
89 "\tshldw %cl, %r11w, %si\n"
90 "\tmovq %rsi, result\n"
101 extern void shrd64 ( void );
108 "\tmovq data, %rsi\n"
109 "\tmovq xtra, %r11\n"
113 "\tshrdq %cl, %r11, %rsi\n"
114 "\tmovq %rsi, result\n"
124 extern void shrd32 ( void );
131 "\tmovq data, %rsi\n"
132 "\tmovq xtra, %r11\n"
136 "\tshrdl %cl, %r11d, %esi\n"
137 "\tmovq %rsi, result\n"
147 extern void shrd16 ( void );
154 "\tmovq data, %rsi\n"
155 "\tmovq xtra, %r11\n"
159 "\tshrdw %cl, %r11w, %si\n"
160 "\tmovq %rsi, result\n"
176 printf("\nleft 64\n");
177 for (i
= 0; i
< 260; i
++) {
179 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
180 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
181 data
= 0x1122334455667788ULL
;
182 xtra
= 0x3141592727182818ULL
;
186 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);
189 printf("\nleft 32\n");
190 for (i
= 0; i
< 260; i
++) {
192 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
193 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
194 data
= 0x1122334455667788ULL
;
195 xtra
= 0x3141592727182818ULL
;
199 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);
203 printf("\nleft 16\n");
204 for (i
= 0; i
< 260; i
++) {
206 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
207 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
208 data
= 0x1122334455667788ULL
;
209 xtra
= 0x987654321987abcdULL
;
213 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);
217 printf("\nright 64\n");
218 for (i
= 0; i
< 260; i
++) {
220 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
221 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
222 data
= 0x1122334455667788ULL
;
223 xtra
= 0x3141592727182818ULL
;
227 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);
230 printf("\nright 32\n");
231 for (i
= 0; i
< 260; i
++) {
233 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
234 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
235 data
= 0x1122334455667788ULL
;
236 xtra
= 0x3141592727182818ULL
;
240 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);
244 printf("\nright 16\n");
245 for (i
= 0; i
< 260; i
++) {
247 if (i
> 1) mask
&= ~AMD64G_CC_MASK_O
;
248 if (i
> 0) mask
&= ~AMD64G_CC_MASK_A
;
249 data
= 0x1122334455667788ULL
;
250 xtra
= 0x987654321987abcdULL
;
254 printf("%3d 0x%016llx 0x%llx\n", i
, result
, flags_out
& mask
);