Commit some MSVC-specific workarounds.

This commit is contained in:
Tyler Stachecki 2014-12-31 16:20:53 -05:00
parent eba6ce1420
commit 1a7611b6dc
4 changed files with 23 additions and 6 deletions

View file

@ -42,7 +42,15 @@ __m128i rsp_vrcp(struct rsp *rsp, int dp,
// Main case: compute the reciprocal.
else {
// TODO: Clean this up.
#ifdef _MSC_VER
unsigned long bsf_index;
_BitScanReverse(&bsf_index, data);
shift = 31 - bsf_index;
#else
shift = __builtin_clz(data);
#endif
idx = ((data << shift) & 0x7FC00000U) >> 22;
result = rsp_reciprocal_rom[idx];

View file

@ -54,7 +54,16 @@ __m128i rsp_vrsq(struct rsp *rsp, int dp,
// Main case: compute the reciprocal.
else {
//TODO: Clean this up.
#ifdef _MSC_VER
unsigned long bsf_index;
_BitScanReverse(&bsf_index, data);
shift = 31 - bsf_index;
#else
shift = __builtin_clz(data);
#endif
idx = ((data << shift) & 0x7FC00000U) >> 22;
idx = (idx | 0x200) & 0x3FE | (shift % 2);
result = rsp_reciprocal_rom[idx];

View file

@ -74,8 +74,8 @@ void vr4300_print_summary(struct vr4300_stats *stats) {
cpi = (float) stats->executed_instructions / stats->total_cycles;
printf(" * Performance statistics:\n\n"
" %16s: %llu\n"
" %16s: %llu\n"
" %16s: %lu\n"
" %16s: %lu\n"
" %16s: %1.2f\n"
"\n\n",
@ -89,7 +89,7 @@ void vr4300_print_summary(struct vr4300_stats *stats) {
for (i = 1; i < NUM_VR4300_OPCODES; i += 2) {
for (j = 0; i + j < NUM_VR4300_OPCODES && j < 2; j++) {
printf(" %16s: %16llu", vr4300_opcode_mnemonics[i + j],
printf(" %16s: %16lu", vr4300_opcode_mnemonics[i + j],
stats->opcode_counts[i + j]);
if (j == 0)

View file

@ -110,10 +110,10 @@ struct vr4300 {
};
struct vr4300_stats {
unsigned long long executed_instructions;
unsigned long long total_cycles;
unsigned long executed_instructions;
unsigned long total_cycles;
unsigned long long opcode_counts[NUM_VR4300_OPCODES];
unsigned long opcode_counts[NUM_VR4300_OPCODES];
};
cen64_cold int vr4300_init(struct vr4300 *vr4300, struct bus_controller *bus);