--- qemu/tcg/x86_64/tcg-target.c 2018/04/24 16:51:10 1.1 +++ qemu/tcg/x86_64/tcg-target.c 2018/04/24 17:21:45 1.1.1.2 @@ -44,22 +44,21 @@ static const char * const tcg_target_reg #endif static const int tcg_target_reg_alloc_order[] = { - TCG_REG_RDI, - TCG_REG_RSI, - TCG_REG_RDX, - TCG_REG_RCX, - TCG_REG_R8, - TCG_REG_R9, - TCG_REG_RAX, - TCG_REG_R10, - TCG_REG_R11, - TCG_REG_RBP, TCG_REG_RBX, TCG_REG_R12, TCG_REG_R13, TCG_REG_R14, TCG_REG_R15, + TCG_REG_R10, + TCG_REG_R11, + TCG_REG_R9, + TCG_REG_R8, + TCG_REG_RCX, + TCG_REG_RDX, + TCG_REG_RSI, + TCG_REG_RDI, + TCG_REG_RAX, }; static const int tcg_target_call_iarg_regs[6] = { @@ -194,6 +193,8 @@ static inline int tcg_target_const_match #define ARITH_XOR 6 #define ARITH_CMP 7 +#define SHIFT_ROL 0 +#define SHIFT_ROR 1 #define SHIFT_SHL 4 #define SHIFT_SHR 5 #define SHIFT_SAR 7 @@ -243,7 +244,7 @@ static inline void tcg_out_opc(TCGContex } if (opc & P_EXT) tcg_out8(s, 0x0f); - tcg_out8(s, opc); + tcg_out8(s, opc & 0xff); } static inline void tcg_out_modrm(TCGContext *s, int opc, int r, int rm) @@ -1049,7 +1050,13 @@ static inline void tcg_out_op(TCGContext case INDEX_op_sar_i32: c = SHIFT_SAR; goto gen_shift32; - + case INDEX_op_rotl_i32: + c = SHIFT_ROL; + goto gen_shift32; + case INDEX_op_rotr_i32: + c = SHIFT_ROR; + goto gen_shift32; + case INDEX_op_shl_i64: c = SHIFT_SHL; gen_shift64: @@ -1070,7 +1077,13 @@ static inline void tcg_out_op(TCGContext case INDEX_op_sar_i64: c = SHIFT_SAR; goto gen_shift64; - + case INDEX_op_rotl_i64: + c = SHIFT_ROL; + goto gen_shift64; + case INDEX_op_rotr_i64: + c = SHIFT_ROR; + goto gen_shift64; + case INDEX_op_brcond_i32: tcg_out_brcond(s, args[2], args[0], args[1], const_args[1], args[3], 0); @@ -1080,10 +1093,17 @@ static inline void tcg_out_op(TCGContext args[3], P_REXW); break; - case INDEX_op_bswap_i32: + case INDEX_op_bswap16_i32: + case INDEX_op_bswap16_i64: + tcg_out8(s, 0x66); + tcg_out_modrm(s, 0xc1, SHIFT_ROL, args[0]); + tcg_out8(s, 8); + break; + case INDEX_op_bswap32_i32: + case INDEX_op_bswap32_i64: tcg_out_opc(s, (0xc8 + (args[0] & 7)) | P_EXT, 0, args[0], 0); break; - case INDEX_op_bswap_i64: + case INDEX_op_bswap64_i64: tcg_out_opc(s, (0xc8 + (args[0] & 7)) | P_EXT | P_REXW, 0, args[0], 0); break; @@ -1094,6 +1114,13 @@ static inline void tcg_out_op(TCGContext tcg_out_modrm(s, 0xf7 | P_REXW, 3, args[0]); break; + case INDEX_op_not_i32: + tcg_out_modrm(s, 0xf7, 2, args[0]); + break; + case INDEX_op_not_i64: + tcg_out_modrm(s, 0xf7 | P_REXW, 2, args[0]); + break; + case INDEX_op_ext8s_i32: tcg_out_modrm(s, 0xbe | P_EXT | P_REXB, args[0], args[1]); break; @@ -1230,6 +1257,8 @@ static const TCGTargetOpDef x86_64_op_de { INDEX_op_shl_i32, { "r", "0", "ci" } }, { INDEX_op_shr_i32, { "r", "0", "ci" } }, { INDEX_op_sar_i32, { "r", "0", "ci" } }, + { INDEX_op_rotl_i32, { "r", "0", "ci" } }, + { INDEX_op_rotr_i32, { "r", "0", "ci" } }, { INDEX_op_brcond_i32, { "r", "ri" } }, @@ -1259,15 +1288,23 @@ static const TCGTargetOpDef x86_64_op_de { INDEX_op_shl_i64, { "r", "0", "ci" } }, { INDEX_op_shr_i64, { "r", "0", "ci" } }, { INDEX_op_sar_i64, { "r", "0", "ci" } }, + { INDEX_op_rotl_i64, { "r", "0", "ci" } }, + { INDEX_op_rotr_i64, { "r", "0", "ci" } }, { INDEX_op_brcond_i64, { "r", "re" } }, - { INDEX_op_bswap_i32, { "r", "0" } }, - { INDEX_op_bswap_i64, { "r", "0" } }, + { INDEX_op_bswap16_i32, { "r", "0" } }, + { INDEX_op_bswap16_i64, { "r", "0" } }, + { INDEX_op_bswap32_i32, { "r", "0" } }, + { INDEX_op_bswap32_i64, { "r", "0" } }, + { INDEX_op_bswap64_i64, { "r", "0" } }, { INDEX_op_neg_i32, { "r", "0" } }, { INDEX_op_neg_i64, { "r", "0" } }, + { INDEX_op_not_i32, { "r", "0" } }, + { INDEX_op_not_i64, { "r", "0" } }, + { INDEX_op_ext8s_i32, { "r", "r"} }, { INDEX_op_ext16s_i32, { "r", "r"} }, { INDEX_op_ext8s_i64, { "r", "r"} },