summaryrefslogtreecommitdiff
path: root/tcg/x86_64/tcg-target.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-07 18:07:39 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-07 18:07:39 +0000
commit733fef0e402abc99a1f914a5180b0b36deee0b90 (patch)
treeabc386edf62ac36ea357e67e4ece6dfc91a75085 /tcg/x86_64/tcg-target.c
parentb6d17150af9930f28aec1debc41f6c5f9ddcc3ba (diff)
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
Diffstat (limited to 'tcg/x86_64/tcg-target.c')
-rw-r--r--tcg/x86_64/tcg-target.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c
index 38e164ec46..304a0c346b 100644
--- a/tcg/x86_64/tcg-target.c
+++ b/tcg/x86_64/tcg-target.c
@@ -382,6 +382,12 @@ static inline void tgen_arithi32(TCGContext *s, int c, int r0, int32_t val)
if (val == (int8_t)val) {
tcg_out_modrm(s, 0x83, c, r0);
tcg_out8(s, val);
+ } else if (c == ARITH_AND && val == 0xffu) {
+ /* movzbl */
+ tcg_out_modrm(s, 0xb6 | P_EXT | P_REXB, r0, r0);
+ } else if (c == ARITH_AND && val == 0xffffu) {
+ /* movzwl */
+ tcg_out_modrm(s, 0xb7 | P_EXT, r0, r0);
} else {
tcg_out_modrm(s, 0x81, c, r0);
tcg_out32(s, val);
@@ -393,6 +399,15 @@ static inline void tgen_arithi64(TCGContext *s, int c, int r0, int64_t val)
if (val == (int8_t)val) {
tcg_out_modrm(s, 0x83 | P_REXW, c, r0);
tcg_out8(s, val);
+ } else if (c == ARITH_AND && val == 0xffu) {
+ /* movzbl */
+ tcg_out_modrm(s, 0xb6 | P_EXT | P_REXW, r0, r0);
+ } else if (c == ARITH_AND && val == 0xffffu) {
+ /* movzwl */
+ tcg_out_modrm(s, 0xb7 | P_EXT | P_REXW, r0, r0);
+ } else if (c == ARITH_AND && val == 0xffffffffu) {
+ /* 32-bit mov zero extends */
+ tcg_out_modrm(s, 0x8b, r0, r0);
} else if (val == (int32_t)val) {
tcg_out_modrm(s, 0x81 | P_REXW, c, r0);
tcg_out32(s, val);