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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #define DATA_BITS (1 << (3 + SHIFT))
21 #define SHIFT_MASK (DATA_BITS - 1)
22 #define SIGN_MASK (((target_ulong)1) << (DATA_BITS - 1))
24 #define SHIFT1_MASK 0x1f
26 #define SHIFT1_MASK 0x3f
31 #define DATA_TYPE uint8_t
32 #define DATA_STYPE int8_t
33 #define DATA_MASK 0xff
36 #define DATA_TYPE uint16_t
37 #define DATA_STYPE int16_t
38 #define DATA_MASK 0xffff
41 #define DATA_TYPE uint32_t
42 #define DATA_STYPE int32_t
43 #define DATA_MASK 0xffffffff
46 #define DATA_TYPE uint64_t
47 #define DATA_STYPE int64_t
48 #define DATA_MASK 0xffffffffffffffffULL
50 #error unhandled operand size
53 target_ulong glue(helper_rcl, SUFFIX)(target_ulong t0, target_ulong t1)
59 count = t1 & SHIFT1_MASK;
61 count = rclw_table[count];
63 count = rclb_table[count];
66 eflags = cc_table[CC_OP].compute_all();
69 res = (t0 << count) | ((target_ulong)(eflags & CC_C) << (count - 1));
71 res |= t0 >> (DATA_BITS + 1 - count);
73 env->t3 = (eflags & ~(CC_C | CC_O)) |
74 (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) |
75 ((src >> (DATA_BITS - count)) & CC_C);
82 target_ulong glue(helper_rcr, SUFFIX)(target_ulong t0, target_ulong t1)
88 count = t1 & SHIFT1_MASK;
90 count = rclw_table[count];
92 count = rclb_table[count];
95 eflags = cc_table[CC_OP].compute_all();
98 res = (t0 >> count) | ((target_ulong)(eflags & CC_C) << (DATA_BITS - count));
100 res |= t0 << (DATA_BITS + 1 - count);
102 env->t3 = (eflags & ~(CC_C | CC_O)) |
103 (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) |
104 ((src >> (count - 1)) & CC_C);