4 * Copyright (c) 2008 Fabrice Bellard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #define DATA_BITS (1 << (3 + SHIFT))
21 #define SHIFT_MASK (DATA_BITS - 1)
23 #define SHIFT1_MASK 0x1f
25 #define SHIFT1_MASK 0x3f
30 #define DATA_MASK 0xff
33 #define DATA_MASK 0xffff
36 #define DATA_MASK 0xffffffff
39 #define DATA_MASK 0xffffffffffffffffULL
41 #error unhandled operand size
44 target_ulong
glue(helper_rcl
, SUFFIX
)(CPUX86State
*env
, target_ulong t0
,
51 count
= t1
& SHIFT1_MASK
;
53 count
= rclw_table
[count
];
55 count
= rclb_table
[count
];
61 res
= (t0
<< count
) | ((target_ulong
)(eflags
& CC_C
) << (count
- 1));
63 res
|= t0
>> (DATA_BITS
+ 1 - count
);
66 env
->cc_src
= (eflags
& ~(CC_C
| CC_O
)) |
67 (lshift(src
^ t0
, 11 - (DATA_BITS
- 1)) & CC_O
) |
68 ((src
>> (DATA_BITS
- count
)) & CC_C
);
73 target_ulong
glue(helper_rcr
, SUFFIX
)(CPUX86State
*env
, target_ulong t0
,
80 count
= t1
& SHIFT1_MASK
;
82 count
= rclw_table
[count
];
84 count
= rclb_table
[count
];
91 ((target_ulong
)(eflags
& CC_C
) << (DATA_BITS
- count
));
93 res
|= t0
<< (DATA_BITS
+ 1 - count
);
96 env
->cc_src
= (eflags
& ~(CC_C
| CC_O
)) |
97 (lshift(src
^ t0
, 11 - (DATA_BITS
- 1)) & CC_O
) |
98 ((src
>> (count
- 1)) & CC_C
);