diff options
author | Richard Henderson <rth@twiddle.net> | 2016-11-21 11:13:39 +0100 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2017-01-10 08:48:56 -0800 |
commit | a768e4e99247911f00c5c0267c12d4e207d5f6cc (patch) | |
tree | 050f67bd90c849c64c774361c76020896efaf433 /tcg/optimize.c | |
parent | 3946c6aa3d402614140f2c6a044abcdfb439217a (diff) | |
download | qemu-a768e4e99247911f00c5c0267c12d4e207d5f6cc.zip qemu-a768e4e99247911f00c5c0267c12d4e207d5f6cc.tar.gz qemu-a768e4e99247911f00c5c0267c12d4e207d5f6cc.tar.bz2 |
tcg: Add opcode for ctpop
The number of actual invocations of ctpop itself does not warrent
an opcode, but it is very helpful for POWER7 to use in generating
an expansion for ctz.
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/optimize.c')
-rw-r--r-- | tcg/optimize.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tcg/optimize.c b/tcg/optimize.c index e7ecce4..adfc56c 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -308,6 +308,12 @@ static TCGArg do_constant_folding_2(TCGOpcode op, TCGArg x, TCGArg y) case INDEX_op_ctz_i64: return x ? ctz64(x) : y; + case INDEX_op_ctpop_i32: + return ctpop32(x); + + case INDEX_op_ctpop_i64: + return ctpop64(x); + CASE_OP_32_64(ext8s): return (int8_t)x; @@ -918,6 +924,13 @@ void tcg_optimize(TCGContext *s) mask = temps[args[2]].mask | 63; break; + case INDEX_op_ctpop_i32: + mask = 32 | 31; + break; + case INDEX_op_ctpop_i64: + mask = 64 | 63; + break; + CASE_OP_32_64(setcond): case INDEX_op_setcond2_i32: mask = 1; @@ -1031,6 +1044,7 @@ void tcg_optimize(TCGContext *s) CASE_OP_32_64(ext8u): CASE_OP_32_64(ext16s): CASE_OP_32_64(ext16u): + CASE_OP_32_64(ctpop): case INDEX_op_ext32s_i64: case INDEX_op_ext32u_i64: case INDEX_op_ext_i32_i64: |