Commit 733fef0e402abc99a1f914a5180b0b36deee0b90
1 parent
b6d17150
TCG: Use x86-64 zero extension instructions.
Signed-off-by: Paul Brook <paul@codesourcery.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5180 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
15 additions
and
0 deletions
tcg/x86_64/tcg-target.c
| ... | ... | @@ -382,6 +382,12 @@ static inline void tgen_arithi32(TCGContext *s, int c, int r0, int32_t val) |
| 382 | 382 | if (val == (int8_t)val) { |
| 383 | 383 | tcg_out_modrm(s, 0x83, c, r0); |
| 384 | 384 | tcg_out8(s, val); |
| 385 | + } else if (c == ARITH_AND && val == 0xffu) { | |
| 386 | + /* movzbl */ | |
| 387 | + tcg_out_modrm(s, 0xb6 | P_EXT | P_REXB, r0, r0); | |
| 388 | + } else if (c == ARITH_AND && val == 0xffffu) { | |
| 389 | + /* movzwl */ | |
| 390 | + tcg_out_modrm(s, 0xb7 | P_EXT, r0, r0); | |
| 385 | 391 | } else { |
| 386 | 392 | tcg_out_modrm(s, 0x81, c, r0); |
| 387 | 393 | tcg_out32(s, val); |
| ... | ... | @@ -393,6 +399,15 @@ static inline void tgen_arithi64(TCGContext *s, int c, int r0, int64_t val) |
| 393 | 399 | if (val == (int8_t)val) { |
| 394 | 400 | tcg_out_modrm(s, 0x83 | P_REXW, c, r0); |
| 395 | 401 | tcg_out8(s, val); |
| 402 | + } else if (c == ARITH_AND && val == 0xffu) { | |
| 403 | + /* movzbl */ | |
| 404 | + tcg_out_modrm(s, 0xb6 | P_EXT | P_REXW, r0, r0); | |
| 405 | + } else if (c == ARITH_AND && val == 0xffffu) { | |
| 406 | + /* movzwl */ | |
| 407 | + tcg_out_modrm(s, 0xb7 | P_EXT | P_REXW, r0, r0); | |
| 408 | + } else if (c == ARITH_AND && val == 0xffffffffu) { | |
| 409 | + /* 32-bit mov zero extends */ | |
| 410 | + tcg_out_modrm(s, 0x8b, r0, r0); | |
| 396 | 411 | } else if (val == (int32_t)val) { |
| 397 | 412 | tcg_out_modrm(s, 0x81 | P_REXW, c, r0); |
| 398 | 413 | tcg_out32(s, val); | ... | ... |