## root / target-i386 / helper_template.h @ 551a2dec

History | View | Annotate | Download (8.6 kB)

1 | b6abf97d | bellard | ```
/*
``` |
---|---|---|---|

2 | b6abf97d | bellard | ```
* i386 helpers
``` |

3 | b6abf97d | bellard | ```
*
``` |

4 | b6abf97d | bellard | ```
* Copyright (c) 2008 Fabrice Bellard
``` |

5 | b6abf97d | bellard | ```
*
``` |

6 | b6abf97d | bellard | ```
* This library is free software; you can redistribute it and/or
``` |

7 | b6abf97d | bellard | ```
* modify it under the terms of the GNU Lesser General Public
``` |

8 | b6abf97d | bellard | ```
* License as published by the Free Software Foundation; either
``` |

9 | b6abf97d | bellard | ```
* version 2 of the License, or (at your option) any later version.
``` |

10 | b6abf97d | bellard | ```
*
``` |

11 | b6abf97d | bellard | ```
* This library is distributed in the hope that it will be useful,
``` |

12 | b6abf97d | bellard | ```
* but WITHOUT ANY WARRANTY; without even the implied warranty of
``` |

13 | b6abf97d | bellard | ```
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
``` |

14 | b6abf97d | bellard | ```
* Lesser General Public License for more details.
``` |

15 | b6abf97d | bellard | ```
*
``` |

16 | b6abf97d | bellard | ```
* You should have received a copy of the GNU Lesser General Public
``` |

17 | 8167ee88 | Blue Swirl | ```
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
``` |

18 | b6abf97d | bellard | ```
*/
``` |

19 | b6abf97d | bellard | #define DATA_BITS (1 << (3 + SHIFT)) |

20 | b6abf97d | bellard | #define SHIFT_MASK (DATA_BITS - 1) |

21 | b6abf97d | bellard | #define SIGN_MASK (((target_ulong)1) << (DATA_BITS - 1)) |

22 | b6abf97d | bellard | #if DATA_BITS <= 32 |

23 | b6abf97d | bellard | #define SHIFT1_MASK 0x1f |

24 | b6abf97d | bellard | ```
#else
``` |

25 | b6abf97d | bellard | #define SHIFT1_MASK 0x3f |

26 | b6abf97d | bellard | ```
#endif
``` |

27 | b6abf97d | bellard | |

28 | b6abf97d | bellard | #if DATA_BITS == 8 |

29 | b6abf97d | bellard | ```
#define SUFFIX b
``` |

30 | b6abf97d | bellard | ```
#define DATA_TYPE uint8_t
``` |

31 | b6abf97d | bellard | ```
#define DATA_STYPE int8_t
``` |

32 | b6abf97d | bellard | #define DATA_MASK 0xff |

33 | b6abf97d | bellard | #elif DATA_BITS == 16 |

34 | b6abf97d | bellard | ```
#define SUFFIX w
``` |

35 | b6abf97d | bellard | ```
#define DATA_TYPE uint16_t
``` |

36 | b6abf97d | bellard | ```
#define DATA_STYPE int16_t
``` |

37 | b6abf97d | bellard | #define DATA_MASK 0xffff |

38 | b6abf97d | bellard | #elif DATA_BITS == 32 |

39 | b6abf97d | bellard | ```
#define SUFFIX l
``` |

40 | b6abf97d | bellard | ```
#define DATA_TYPE uint32_t
``` |

41 | b6abf97d | bellard | ```
#define DATA_STYPE int32_t
``` |

42 | b6abf97d | bellard | #define DATA_MASK 0xffffffff |

43 | b6abf97d | bellard | #elif DATA_BITS == 64 |

44 | b6abf97d | bellard | ```
#define SUFFIX q
``` |

45 | b6abf97d | bellard | ```
#define DATA_TYPE uint64_t
``` |

46 | b6abf97d | bellard | ```
#define DATA_STYPE int64_t
``` |

47 | b6abf97d | bellard | #define DATA_MASK 0xffffffffffffffffULL |

48 | b6abf97d | bellard | ```
#else
``` |

49 | b6abf97d | bellard | ```
#error unhandled operand size
``` |

50 | b6abf97d | bellard | ```
#endif
``` |

51 | b6abf97d | bellard | |

52 | 07d2c595 | bellard | ```
/* dynamic flags computation */
``` |

53 | 07d2c595 | bellard | |

54 | 07d2c595 | bellard | static int glue(compute_all_add, SUFFIX)(void) |

55 | 07d2c595 | bellard | { |

56 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

57 | 07d2c595 | bellard | target_long src1, src2; |

58 | 07d2c595 | bellard | src1 = CC_SRC; |

59 | 07d2c595 | bellard | src2 = CC_DST - CC_SRC; |

60 | 07d2c595 | bellard | cf = (DATA_TYPE)CC_DST < (DATA_TYPE)src1; |

61 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

62 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

63 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

64 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

65 | 07d2c595 | bellard | of = lshift((src1 ^ src2 ^ -1) & (src1 ^ CC_DST), 12 - DATA_BITS) & CC_O; |

66 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

67 | 07d2c595 | bellard | } |

68 | 07d2c595 | bellard | |

69 | 07d2c595 | bellard | static int glue(compute_c_add, SUFFIX)(void) |

70 | 07d2c595 | bellard | { |

71 | 07d2c595 | bellard | ```
int cf;
``` |

72 | 07d2c595 | bellard | target_long src1; |

73 | 07d2c595 | bellard | src1 = CC_SRC; |

74 | 07d2c595 | bellard | cf = (DATA_TYPE)CC_DST < (DATA_TYPE)src1; |

75 | 07d2c595 | bellard | ```
return cf;
``` |

76 | 07d2c595 | bellard | } |

77 | 07d2c595 | bellard | |

78 | 07d2c595 | bellard | static int glue(compute_all_adc, SUFFIX)(void) |

79 | 07d2c595 | bellard | { |

80 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

81 | 07d2c595 | bellard | target_long src1, src2; |

82 | 07d2c595 | bellard | src1 = CC_SRC; |

83 | 07d2c595 | bellard | ```
src2 = CC_DST - CC_SRC - 1;
``` |

84 | 07d2c595 | bellard | cf = (DATA_TYPE)CC_DST <= (DATA_TYPE)src1; |

85 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

86 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

87 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

88 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

89 | 07d2c595 | bellard | of = lshift((src1 ^ src2 ^ -1) & (src1 ^ CC_DST), 12 - DATA_BITS) & CC_O; |

90 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

91 | 07d2c595 | bellard | } |

92 | 07d2c595 | bellard | |

93 | 07d2c595 | bellard | static int glue(compute_c_adc, SUFFIX)(void) |

94 | 07d2c595 | bellard | { |

95 | 07d2c595 | bellard | ```
int cf;
``` |

96 | 07d2c595 | bellard | target_long src1; |

97 | 07d2c595 | bellard | src1 = CC_SRC; |

98 | 07d2c595 | bellard | cf = (DATA_TYPE)CC_DST <= (DATA_TYPE)src1; |

99 | 07d2c595 | bellard | ```
return cf;
``` |

100 | 07d2c595 | bellard | } |

101 | 07d2c595 | bellard | |

102 | 07d2c595 | bellard | static int glue(compute_all_sub, SUFFIX)(void) |

103 | 07d2c595 | bellard | { |

104 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

105 | 07d2c595 | bellard | target_long src1, src2; |

106 | 07d2c595 | bellard | src1 = CC_DST + CC_SRC; |

107 | 07d2c595 | bellard | src2 = CC_SRC; |

108 | 07d2c595 | bellard | cf = (DATA_TYPE)src1 < (DATA_TYPE)src2; |

109 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

110 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

111 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

112 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

113 | 07d2c595 | bellard | ```
of = lshift((src1 ^ src2) & (src1 ^ CC_DST), 12 - DATA_BITS) & CC_O;
``` |

114 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

115 | 07d2c595 | bellard | } |

116 | 07d2c595 | bellard | |

117 | 07d2c595 | bellard | static int glue(compute_c_sub, SUFFIX)(void) |

118 | 07d2c595 | bellard | { |

119 | 07d2c595 | bellard | ```
int cf;
``` |

120 | 07d2c595 | bellard | target_long src1, src2; |

121 | 07d2c595 | bellard | src1 = CC_DST + CC_SRC; |

122 | 07d2c595 | bellard | src2 = CC_SRC; |

123 | 07d2c595 | bellard | cf = (DATA_TYPE)src1 < (DATA_TYPE)src2; |

124 | 07d2c595 | bellard | ```
return cf;
``` |

125 | 07d2c595 | bellard | } |

126 | 07d2c595 | bellard | |

127 | 07d2c595 | bellard | static int glue(compute_all_sbb, SUFFIX)(void) |

128 | 07d2c595 | bellard | { |

129 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

130 | 07d2c595 | bellard | target_long src1, src2; |

131 | 07d2c595 | bellard | ```
src1 = CC_DST + CC_SRC + 1;
``` |

132 | 07d2c595 | bellard | src2 = CC_SRC; |

133 | 07d2c595 | bellard | cf = (DATA_TYPE)src1 <= (DATA_TYPE)src2; |

134 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

135 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

136 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

137 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

138 | 07d2c595 | bellard | ```
of = lshift((src1 ^ src2) & (src1 ^ CC_DST), 12 - DATA_BITS) & CC_O;
``` |

139 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

140 | 07d2c595 | bellard | } |

141 | 07d2c595 | bellard | |

142 | 07d2c595 | bellard | static int glue(compute_c_sbb, SUFFIX)(void) |

143 | 07d2c595 | bellard | { |

144 | 07d2c595 | bellard | ```
int cf;
``` |

145 | 07d2c595 | bellard | target_long src1, src2; |

146 | 07d2c595 | bellard | ```
src1 = CC_DST + CC_SRC + 1;
``` |

147 | 07d2c595 | bellard | src2 = CC_SRC; |

148 | 07d2c595 | bellard | cf = (DATA_TYPE)src1 <= (DATA_TYPE)src2; |

149 | 07d2c595 | bellard | ```
return cf;
``` |

150 | 07d2c595 | bellard | } |

151 | 07d2c595 | bellard | |

152 | 07d2c595 | bellard | static int glue(compute_all_logic, SUFFIX)(void) |

153 | 07d2c595 | bellard | { |

154 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

155 | 07d2c595 | bellard | ```
cf = 0;
``` |

156 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

157 | 07d2c595 | bellard | ```
af = 0;
``` |

158 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

159 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

160 | 07d2c595 | bellard | ```
of = 0;
``` |

161 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

162 | 07d2c595 | bellard | } |

163 | 07d2c595 | bellard | |

164 | 07d2c595 | bellard | static int glue(compute_c_logic, SUFFIX)(void) |

165 | 07d2c595 | bellard | { |

166 | 07d2c595 | bellard | return 0; |

167 | 07d2c595 | bellard | } |

168 | 07d2c595 | bellard | |

169 | 07d2c595 | bellard | static int glue(compute_all_inc, SUFFIX)(void) |

170 | 07d2c595 | bellard | { |

171 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

172 | 07d2c595 | bellard | target_long src1, src2; |

173 | 07d2c595 | bellard | ```
src1 = CC_DST - 1;
``` |

174 | 07d2c595 | bellard | ```
src2 = 1;
``` |

175 | 07d2c595 | bellard | cf = CC_SRC; |

176 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

177 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

178 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

179 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

180 | 07d2c595 | bellard | ```
of = ((CC_DST & DATA_MASK) == SIGN_MASK) << 11;
``` |

181 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

182 | 07d2c595 | bellard | } |

183 | 07d2c595 | bellard | |

184 | 07d2c595 | bellard | #if DATA_BITS == 32 |

185 | 07d2c595 | bellard | static int glue(compute_c_inc, SUFFIX)(void) |

186 | 07d2c595 | bellard | { |

187 | 07d2c595 | bellard | ```
return CC_SRC;
``` |

188 | 07d2c595 | bellard | } |

189 | 07d2c595 | bellard | ```
#endif
``` |

190 | 07d2c595 | bellard | |

191 | 07d2c595 | bellard | static int glue(compute_all_dec, SUFFIX)(void) |

192 | 07d2c595 | bellard | { |

193 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

194 | 07d2c595 | bellard | target_long src1, src2; |

195 | 07d2c595 | bellard | ```
src1 = CC_DST + 1;
``` |

196 | 07d2c595 | bellard | ```
src2 = 1;
``` |

197 | 07d2c595 | bellard | cf = CC_SRC; |

198 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

199 | 07d2c595 | bellard | ```
af = (CC_DST ^ src1 ^ src2) & 0x10;
``` |

200 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

201 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

202 | 07d2c595 | bellard | of = ((CC_DST & DATA_MASK) == ((target_ulong)SIGN_MASK - 1)) << 11; |

203 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

204 | 07d2c595 | bellard | } |

205 | 07d2c595 | bellard | |

206 | 07d2c595 | bellard | static int glue(compute_all_shl, SUFFIX)(void) |

207 | 07d2c595 | bellard | { |

208 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

209 | 07d2c595 | bellard | ```
cf = (CC_SRC >> (DATA_BITS - 1)) & CC_C;
``` |

210 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

211 | 07d2c595 | bellard | af = 0; /* undefined */ |

212 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

213 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

214 | 07d2c595 | bellard | ```
/* of is defined if shift count == 1 */
``` |

215 | 07d2c595 | bellard | ```
of = lshift(CC_SRC ^ CC_DST, 12 - DATA_BITS) & CC_O;
``` |

216 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

217 | 07d2c595 | bellard | } |

218 | 07d2c595 | bellard | |

219 | 07d2c595 | bellard | static int glue(compute_c_shl, SUFFIX)(void) |

220 | 07d2c595 | bellard | { |

221 | 07d2c595 | bellard | return (CC_SRC >> (DATA_BITS - 1)) & CC_C; |

222 | 07d2c595 | bellard | } |

223 | 07d2c595 | bellard | |

224 | 07d2c595 | bellard | #if DATA_BITS == 32 |

225 | 07d2c595 | bellard | static int glue(compute_c_sar, SUFFIX)(void) |

226 | 07d2c595 | bellard | { |

227 | 07d2c595 | bellard | return CC_SRC & 1; |

228 | 07d2c595 | bellard | } |

229 | 07d2c595 | bellard | ```
#endif
``` |

230 | 07d2c595 | bellard | |

231 | 07d2c595 | bellard | static int glue(compute_all_sar, SUFFIX)(void) |

232 | 07d2c595 | bellard | { |

233 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

234 | 07d2c595 | bellard | ```
cf = CC_SRC & 1;
``` |

235 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

236 | 07d2c595 | bellard | af = 0; /* undefined */ |

237 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

238 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

239 | 07d2c595 | bellard | ```
/* of is defined if shift count == 1 */
``` |

240 | 07d2c595 | bellard | ```
of = lshift(CC_SRC ^ CC_DST, 12 - DATA_BITS) & CC_O;
``` |

241 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

242 | 07d2c595 | bellard | } |

243 | 07d2c595 | bellard | |

244 | 07d2c595 | bellard | #if DATA_BITS == 32 |

245 | 07d2c595 | bellard | static int glue(compute_c_mul, SUFFIX)(void) |

246 | 07d2c595 | bellard | { |

247 | 07d2c595 | bellard | ```
int cf;
``` |

248 | 07d2c595 | bellard | ```
cf = (CC_SRC != 0);
``` |

249 | 07d2c595 | bellard | ```
return cf;
``` |

250 | 07d2c595 | bellard | } |

251 | 07d2c595 | bellard | ```
#endif
``` |

252 | 07d2c595 | bellard | |

253 | 07d2c595 | bellard | ```
/* NOTE: we compute the flags like the P4. On olders CPUs, only OF and
``` |

254 | 07d2c595 | bellard | ```
CF are modified and it is slower to do that. */
``` |

255 | 07d2c595 | bellard | static int glue(compute_all_mul, SUFFIX)(void) |

256 | 07d2c595 | bellard | { |

257 | 07d2c595 | bellard | ```
int cf, pf, af, zf, sf, of;
``` |

258 | 07d2c595 | bellard | ```
cf = (CC_SRC != 0);
``` |

259 | 07d2c595 | bellard | pf = parity_table[(uint8_t)CC_DST]; |

260 | 07d2c595 | bellard | af = 0; /* undefined */ |

261 | 07d2c595 | bellard | zf = ((DATA_TYPE)CC_DST == 0) << 6; |

262 | 07d2c595 | bellard | sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80; |

263 | 07d2c595 | bellard | ```
of = cf << 11;
``` |

264 | 07d2c595 | bellard | ```
return cf | pf | af | zf | sf | of;
``` |

265 | 07d2c595 | bellard | } |

266 | 07d2c595 | bellard | |

267 | 07d2c595 | bellard | ```
/* shifts */
``` |

268 | 07d2c595 | bellard | |

269 | b6abf97d | bellard | target_ulong glue(helper_rcl, SUFFIX)(target_ulong t0, target_ulong t1) |

270 | b6abf97d | bellard | { |

271 | b6abf97d | bellard | ```
int count, eflags;
``` |

272 | b6abf97d | bellard | target_ulong src; |

273 | b6abf97d | bellard | target_long res; |

274 | b6abf97d | bellard | |

275 | b6abf97d | bellard | count = t1 & SHIFT1_MASK; |

276 | b6abf97d | bellard | #if DATA_BITS == 16 |

277 | b6abf97d | bellard | count = rclw_table[count]; |

278 | b6abf97d | bellard | #elif DATA_BITS == 8 |

279 | b6abf97d | bellard | count = rclb_table[count]; |

280 | b6abf97d | bellard | ```
#endif
``` |

281 | b6abf97d | bellard | ```
if (count) {
``` |

282 | a7812ae4 | pbrook | eflags = helper_cc_compute_all(CC_OP); |

283 | b6abf97d | bellard | t0 &= DATA_MASK; |

284 | b6abf97d | bellard | src = t0; |

285 | b6abf97d | bellard | ```
res = (t0 << count) | ((target_ulong)(eflags & CC_C) << (count - 1));
``` |

286 | b6abf97d | bellard | if (count > 1) |

287 | b6abf97d | bellard | ```
res |= t0 >> (DATA_BITS + 1 - count);
``` |

288 | b6abf97d | bellard | t0 = res; |

289 | 1e4840bf | bellard | env->cc_tmp = (eflags & ~(CC_C | CC_O)) | |

290 | b6abf97d | bellard | (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) | |

291 | b6abf97d | bellard | ((src >> (DATA_BITS - count)) & CC_C); |

292 | b6abf97d | bellard | ```
} else {
``` |

293 | 1e4840bf | bellard | ```
env->cc_tmp = -1;
``` |

294 | b6abf97d | bellard | } |

295 | b6abf97d | bellard | ```
return t0;
``` |

296 | b6abf97d | bellard | } |

297 | b6abf97d | bellard | |

298 | b6abf97d | bellard | target_ulong glue(helper_rcr, SUFFIX)(target_ulong t0, target_ulong t1) |

299 | b6abf97d | bellard | { |

300 | b6abf97d | bellard | ```
int count, eflags;
``` |

301 | b6abf97d | bellard | target_ulong src; |

302 | b6abf97d | bellard | target_long res; |

303 | b6abf97d | bellard | |

304 | b6abf97d | bellard | count = t1 & SHIFT1_MASK; |

305 | b6abf97d | bellard | #if DATA_BITS == 16 |

306 | b6abf97d | bellard | count = rclw_table[count]; |

307 | b6abf97d | bellard | #elif DATA_BITS == 8 |

308 | b6abf97d | bellard | count = rclb_table[count]; |

309 | b6abf97d | bellard | ```
#endif
``` |

310 | b6abf97d | bellard | ```
if (count) {
``` |

311 | a7812ae4 | pbrook | eflags = helper_cc_compute_all(CC_OP); |

312 | b6abf97d | bellard | t0 &= DATA_MASK; |

313 | b6abf97d | bellard | src = t0; |

314 | b6abf97d | bellard | res = (t0 >> count) | ((target_ulong)(eflags & CC_C) << (DATA_BITS - count)); |

315 | b6abf97d | bellard | if (count > 1) |

316 | b6abf97d | bellard | ```
res |= t0 << (DATA_BITS + 1 - count);
``` |

317 | b6abf97d | bellard | t0 = res; |

318 | 1e4840bf | bellard | env->cc_tmp = (eflags & ~(CC_C | CC_O)) | |

319 | b6abf97d | bellard | (lshift(src ^ t0, 11 - (DATA_BITS - 1)) & CC_O) | |

320 | b6abf97d | bellard | ```
((src >> (count - 1)) & CC_C);
``` |

321 | b6abf97d | bellard | ```
} else {
``` |

322 | 1e4840bf | bellard | ```
env->cc_tmp = -1;
``` |

323 | b6abf97d | bellard | } |

324 | b6abf97d | bellard | ```
return t0;
``` |

325 | b6abf97d | bellard | } |

326 | b6abf97d | bellard | |

327 | b6abf97d | bellard | ```
#undef DATA_BITS
``` |

328 | b6abf97d | bellard | ```
#undef SHIFT_MASK
``` |

329 | b6abf97d | bellard | ```
#undef SHIFT1_MASK
``` |

330 | b6abf97d | bellard | ```
#undef SIGN_MASK
``` |

331 | b6abf97d | bellard | ```
#undef DATA_TYPE
``` |

332 | b6abf97d | bellard | ```
#undef DATA_STYPE
``` |

333 | b6abf97d | bellard | ```
#undef DATA_MASK
``` |

334 | b6abf97d | bellard | `#undef SUFFIX` |