summaryrefslogtreecommitdiff
path: root/tcg-runtime.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-11-16 09:23:28 +0100
committerRichard Henderson <rth@twiddle.net>2017-01-10 08:06:11 -0800
commit0e28d0063bbd9e59a981ea2d20f82f30c5d956a8 (patch)
tree6e4a705fef28f5ffc5ab828ca9abcc13f5097927 /tcg-runtime.c
parent17280ff4a5f264e01e55ae514ee6d3586f9577b2 (diff)
downloadqemu-0e28d0063bbd9e59a981ea2d20f82f30c5d956a8.tar.gz
tcg: Add clz and ctz opcodes
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg-runtime.c')
-rw-r--r--tcg-runtime.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tcg-runtime.c b/tcg-runtime.c
index 9327b6f23b..eb3bade7f6 100644
--- a/tcg-runtime.c
+++ b/tcg-runtime.c
@@ -101,6 +101,26 @@ int64_t HELPER(mulsh_i64)(int64_t arg1, int64_t arg2)
return h;
}
+uint32_t HELPER(clz_i32)(uint32_t arg, uint32_t zero_val)
+{
+ return arg ? clz32(arg) : zero_val;
+}
+
+uint32_t HELPER(ctz_i32)(uint32_t arg, uint32_t zero_val)
+{
+ return arg ? ctz32(arg) : zero_val;
+}
+
+uint64_t HELPER(clz_i64)(uint64_t arg, uint64_t zero_val)
+{
+ return arg ? clz64(arg) : zero_val;
+}
+
+uint64_t HELPER(ctz_i64)(uint64_t arg, uint64_t zero_val)
+{
+ return arg ? ctz64(arg) : zero_val;
+}
+
void HELPER(exit_atomic)(CPUArchState *env)
{
cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC());