mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
tcg: add div/rem 32-bit helpers
Some targets like ARM would benefit to use 32-bit helpers for div/rem/divu/remu. Create a #define for div2 so that targets can select between div, div2 and helper implementation. Use the helper version if none of the #define are present. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
7296abaccc
commit
31d6655100
7 changed files with 89 additions and 2 deletions
|
|
@ -25,6 +25,30 @@
|
|||
|
||||
#include "tcg/tcg-runtime.h"
|
||||
|
||||
/* 32-bit helpers */
|
||||
|
||||
int32_t tcg_helper_div_i32(int32_t arg1, int32_t arg2)
|
||||
{
|
||||
return arg1 / arg2;
|
||||
}
|
||||
|
||||
int32_t tcg_helper_rem_i32(int32_t arg1, int32_t arg2)
|
||||
{
|
||||
return arg1 % arg2;
|
||||
}
|
||||
|
||||
uint32_t tcg_helper_divu_i32(uint32_t arg1, uint32_t arg2)
|
||||
{
|
||||
return arg1 / arg2;
|
||||
}
|
||||
|
||||
uint32_t tcg_helper_remu_i32(uint32_t arg1, uint32_t arg2)
|
||||
{
|
||||
return arg1 % arg2;
|
||||
}
|
||||
|
||||
/* 64-bit helpers */
|
||||
|
||||
int64_t tcg_helper_shl_i64(int64_t arg1, int64_t arg2)
|
||||
{
|
||||
return arg1 << arg2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue