notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpu-gles: fix wrong long usage
[pcsx_rearmed.git]
/
deps
/
lightrec
/
lightrec-private.h
diff --git
a/deps/lightrec/lightrec-private.h
b/deps/lightrec/lightrec-private.h
index
6b6f721
..
e67d406
100644
(file)
--- a/
deps/lightrec/lightrec-private.h
+++ b/
deps/lightrec/lightrec-private.h
@@
-16,8
+16,15
@@
#include <stdatomic.h>
#endif
#include <stdatomic.h>
#endif
+#ifdef _MSC_BUILD
+#include <immintrin.h>
+#endif
+
#define ARRAY_SIZE(x) (sizeof(x) ? sizeof(x) / sizeof((x)[0]) : 0)
#define ARRAY_SIZE(x) (sizeof(x) ? sizeof(x) / sizeof((x)[0]) : 0)
+#define GENMASK(h, l) \
+ (((uintptr_t)-1 << (l)) & ((uintptr_t)-1 >> (__WORDSIZE - 1 - (h))))
+
#ifdef __GNUC__
# define likely(x) __builtin_expect(!!(x),1)
# define unlikely(x) __builtin_expect(!!(x),0)
#ifdef __GNUC__
# define likely(x) __builtin_expect(!!(x),1)
# define unlikely(x) __builtin_expect(!!(x),0)
@@
-51,10
+58,12
@@
#ifdef _MSC_BUILD
# define popcount32(x) __popcnt(x)
#ifdef _MSC_BUILD
# define popcount32(x) __popcnt(x)
-# define ffs32(x) (31 - __lzcnt(x))
+# define clz32(x) _lzcnt_u32(x)
+# define ctz32(x) _tzcnt_u32(x)
#else
# define popcount32(x) __builtin_popcount(x)
#else
# define popcount32(x) __builtin_popcount(x)
-# define ffs32(x) (__builtin_ffs(x) - 1)
+# define clz32(x) __builtin_clz(x)
+# define ctz32(x) __builtin_ctz(x)
#endif
/* Flags for (struct block *)->flags */
#endif
/* Flags for (struct block *)->flags */
@@
-72,6
+81,7
@@
#define REG_LO 32
#define REG_HI 33
#define REG_LO 32
#define REG_HI 33
+#define REG_CP2_TEMP (offsetof(struct lightrec_state, cp2_temp_reg) / sizeof(u32))
/* Definition of jit_state_t (avoids inclusion of <lightning.h>) */
struct jit_node;
/* Definition of jit_state_t (avoids inclusion of <lightning.h>) */
struct jit_node;
@@
-143,8
+153,9
@@
struct lightrec_cstate {
struct lightrec_state {
struct lightrec_registers regs;
struct lightrec_state {
struct lightrec_registers regs;
- u
intptr_t wrapper_regs[NUM_TEMPS]
;
+ u
32 cp2_temp_reg
;
u32 next_pc;
u32 next_pc;
+ uintptr_t wrapper_regs[NUM_TEMPS];
u32 current_cycle;
u32 target_cycle;
u32 exit_flags;
u32 current_cycle;
u32 target_cycle;
u32 exit_flags;
@@
-179,9
+190,6
@@
void lightrec_free_block(struct lightrec_state *state, struct block *block);
void remove_from_code_lut(struct blockcache *cache, struct block *block);
void remove_from_code_lut(struct blockcache *cache, struct block *block);
-enum psx_map
-lightrec_get_map_idx(struct lightrec_state *state, u32 kaddr);
-
const struct lightrec_mem_map *
lightrec_get_map(struct lightrec_state *state, void **host, u32 kaddr);
const struct lightrec_mem_map *
lightrec_get_map(struct lightrec_state *state, void **host, u32 kaddr);
@@
-263,7
+271,7
@@
static inline u32 get_branch_pc(const struct block *block, u16 offset, s16 imm)
return block->pc + (offset + imm << 2);
}
return block->pc + (offset + imm << 2);
}
-void lightrec_mtc(struct lightrec_state *state, union code op, u32 data);
+void lightrec_mtc(struct lightrec_state *state, union code op, u
8 reg, u
32 data);
u32 lightrec_mfc(struct lightrec_state *state, union code op);
void lightrec_rfe(struct lightrec_state *state);
void lightrec_cp(struct lightrec_state *state, union code op);
u32 lightrec_mfc(struct lightrec_state *state, union code op);
void lightrec_rfe(struct lightrec_state *state);
void lightrec_cp(struct lightrec_state *state, union code op);
@@
-331,4
+339,14
@@
static inline u8 block_clear_flags(struct block *block, u8 mask)
#endif
}
#endif
}
+static inline _Bool can_sign_extend(s32 value, u8 order)
+{
+ return (u32)(value >> order - 1) + 1 < 2;
+}
+
+static inline _Bool can_zero_extend(u32 value, u8 order)
+{
+ return (value >> order) == 0;
+}
+
#endif /* __LIGHTREC_PRIVATE_H__ */
#endif /* __LIGHTREC_PRIVATE_H__ */