mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
target/loongarch: Move simply DO_XX marcos togther
Signed-off-by: Song Gao <gaosong@loongson.cn> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230914022645.1151356-57-gaosong@loongson.cn>
This commit is contained in:
parent
4a26512f01
commit
c7aa330903
2 changed files with 42 additions and 48 deletions
|
@ -30,4 +30,46 @@
|
|||
#define Q(x) Q[x]
|
||||
#endif /* HOST_BIG_ENDIAN */
|
||||
|
||||
#define DO_ADD(a, b) (a + b)
|
||||
#define DO_SUB(a, b) (a - b)
|
||||
#define DO_VAVG(a, b) ((a >> 1) + (b >> 1) + (a & b & 1))
|
||||
#define DO_VAVGR(a, b) ((a >> 1) + (b >> 1) + ((a | b) & 1))
|
||||
#define DO_VABSD(a, b) ((a > b) ? (a -b) : (b-a))
|
||||
#define DO_VABS(a) ((a < 0) ? (-a) : (a))
|
||||
#define DO_MIN(a, b) (a < b ? a : b)
|
||||
#define DO_MAX(a, b) (a > b ? a : b)
|
||||
#define DO_MUL(a, b) (a * b)
|
||||
#define DO_MADD(a, b, c) (a + b * c)
|
||||
#define DO_MSUB(a, b, c) (a - b * c)
|
||||
|
||||
#define DO_DIVU(N, M) (unlikely(M == 0) ? 0 : N / M)
|
||||
#define DO_REMU(N, M) (unlikely(M == 0) ? 0 : N % M)
|
||||
#define DO_DIV(N, M) (unlikely(M == 0) ? 0 :\
|
||||
unlikely((N == -N) && (M == (__typeof(N))(-1))) ? N : N / M)
|
||||
#define DO_REM(N, M) (unlikely(M == 0) ? 0 :\
|
||||
unlikely((N == -N) && (M == (__typeof(N))(-1))) ? 0 : N % M)
|
||||
|
||||
#define DO_SIGNCOV(a, b) (a == 0 ? 0 : a < 0 ? -b : b)
|
||||
|
||||
#define R_SHIFT(a, b) (a >> b)
|
||||
|
||||
#define DO_CLO_B(N) (clz32(~N & 0xff) - 24)
|
||||
#define DO_CLO_H(N) (clz32(~N & 0xffff) - 16)
|
||||
#define DO_CLO_W(N) (clz32(~N))
|
||||
#define DO_CLO_D(N) (clz64(~N))
|
||||
#define DO_CLZ_B(N) (clz32(N) - 24)
|
||||
#define DO_CLZ_H(N) (clz32(N) - 16)
|
||||
#define DO_CLZ_W(N) (clz32(N))
|
||||
#define DO_CLZ_D(N) (clz64(N))
|
||||
|
||||
#define DO_BITCLR(a, bit) (a & ~(1ull << bit))
|
||||
#define DO_BITSET(a, bit) (a | 1ull << bit)
|
||||
#define DO_BITREV(a, bit) (a ^ (1ull << bit))
|
||||
|
||||
#define VSEQ(a, b) (a == b ? -1 : 0)
|
||||
#define VSLE(a, b) (a <= b ? -1 : 0)
|
||||
#define VSLT(a, b) (a < b ? -1 : 0)
|
||||
|
||||
#define SHF_POS(i, imm) (((i) & 0xfc) + (((imm) >> (2 * ((i) & 0x03))) & 0x03))
|
||||
|
||||
#endif /* LOONGARCH_VEC_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue