Revisión | 39f099ec9d6d420b6fe6f7f4f8ed80ae29c65ff2 (tree) |
---|---|
Tiempo | 2017-01-18 05:02:08 |
Autor | Richard Henderson <rth@twid...> |
Commiter | Richard Henderson |
tcg/i386: Always use TZCNT when available
I think this is cleaner than sometimes using BSF.
Signed-off-by: Richard Henderson <rth@twiddle.net>
@@ -1143,10 +1143,14 @@ static void tcg_out_movcond64(TCGContext *s, TCGCond cond, TCGReg dest, | ||
1143 | 1143 | static void tcg_out_ctz(TCGContext *s, int rexw, TCGReg dest, TCGReg arg1, |
1144 | 1144 | TCGArg arg2, bool const_a2) |
1145 | 1145 | { |
1146 | - if (const_a2) { | |
1147 | - tcg_debug_assert(have_bmi1); | |
1148 | - tcg_debug_assert(arg2 == (rexw ? 64 : 32)); | |
1146 | + if (have_bmi1) { | |
1149 | 1147 | tcg_out_modrm(s, OPC_TZCNT + rexw, dest, arg1); |
1148 | + if (const_a2) { | |
1149 | + tcg_debug_assert(arg2 == (rexw ? 64 : 32)); | |
1150 | + } else { | |
1151 | + tcg_debug_assert(dest != arg2); | |
1152 | + tcg_out_cmov(s, TCG_COND_LTU, rexw, dest, arg2); | |
1153 | + } | |
1150 | 1154 | } else { |
1151 | 1155 | tcg_debug_assert(dest != arg2); |
1152 | 1156 | tcg_out_modrm(s, OPC_BSF + rexw, dest, arg1); |