diff options
Diffstat (limited to 'target-xtensa/op_helper.c')
-rw-r--r-- | target-xtensa/op_helper.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 0392fbe6bb..c1cfd2ea7b 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -28,6 +28,7 @@ #include "cpu.h" #include "dyngen-exec.h" #include "helpers.h" +#include "host-utils.h" #define MMUSUFFIX _mmu @@ -57,3 +58,16 @@ void HELPER(exception)(uint32_t excp) env->exception_index = excp; cpu_loop_exit(env); } + +uint32_t HELPER(nsa)(uint32_t v) +{ + if (v & 0x80000000) { + v = ~v; + } + return v ? clz32(v) - 1 : 31; +} + +uint32_t HELPER(nsau)(uint32_t v) +{ + return v ? clz32(v) : 32; +} |