1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#ifndef ASM_X86_INTERNAL_H
#warning Do not include this file directly
#else
static inline void asm_fmulp(struct assembler_state_t *state)
{
if (read_fpu_sub_tag(state->FPUTagWord, 0) == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fmulp: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
} else if (read_fpu_sub_tag(state->FPUTagWord, 1) == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fmulp: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
} else {
FPU_TYPE temp;
write_fpu_st(state, 1, temp = read_fpu_st(state, 0) * read_fpu_st(state, 1));
if (fpclassify(temp) == FP_ZERO)
write_fpu_sub_tag(&state->FPUTagWord, 1, FPU_TAG_ZERO);
pop_fpu_sub_tag(&state->FPUTagWord);
write_fpu_status_top(state->FPUStatusWord, (read_fpu_status_top(state->FPUStatusWord)+1));
}
}
#define asm_fmulp_st(state,index) asm_fmulp_stst(state, 0, index)
static inline void asm_fmulp_stst(struct assembler_state_t *state, int index1, int index2)
{
if ((index1 != 0) || (index2 == 0))
{
fprintf(stderr, "asm_fmulp_st: invalid opcode\n");
return;
}
if (read_fpu_sub_tag(state->FPUTagWord, index1) == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fmulp_st: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
} else if (read_fpu_sub_tag(state->FPUTagWord, index2) == FPU_TAG_EMPTY)
{
fprintf(stderr, "asm_fmulp_st: #Stack underflow occurred\n");
write_fpu_status_exception_underflow(state->FPUStatusWord, 1);
write_fpu_status_conditioncode1(state->FPUStatusWord, 1);
} else {
FPU_TYPE temp;
write_fpu_st(state, index2, temp = read_fpu_st(state, index1) * read_fpu_st(state, index2));
if (fpclassify(temp) == FP_ZERO)
write_fpu_sub_tag(&state->FPUTagWord, index2, FPU_TAG_ZERO);
pop_fpu_sub_tag(&state->FPUTagWord);
write_fpu_status_top(state->FPUStatusWord, (read_fpu_status_top(state->FPUStatusWord)+1));
}
}
#endif
|