This commit is contained in:
Dmitry Stogov 2022-06-07 10:17:41 +03:00
parent 1108acf9b8
commit fbedabc5d8
2 changed files with 29 additions and 38 deletions

View File

@ -4366,12 +4366,11 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size)
|.align 8
|=>label:
|.long insn->val.u32, insn->val.u32_hi
} else if (insn->type == IR_FLOAT) {
} else {
IR_ASSERT(insn->type == IR_FLOAT);
|.align 4
|=>label:
|.long insn->val.u32
} else {
IR_ASSERT(0);
}
} else if (insn->op == IR_STR) {
int label = ctx->cfg_blocks_count + i;

View File

@ -305,22 +305,20 @@
|.endmacro
|.macro ASM_SSE2_REG_REG_OP, fop, dop, type, dst, src
|| if (type == IR_FLOAT) {
| fop xmm(dst-IR_REG_FP_FIRST), xmm(src-IR_REG_FP_FIRST)
|| } else if (type == IR_DOUBLE) {
|| if (type == IR_DOUBLE) {
| dop xmm(dst-IR_REG_FP_FIRST), xmm(src-IR_REG_FP_FIRST)
|| } else {
|| IR_ASSERT(0);
|| IR_ASSERT(type == IR_FLOAT);
| fop xmm(dst-IR_REG_FP_FIRST), xmm(src-IR_REG_FP_FIRST)
|| }
|.endmacro
|.macro ASM_SSE2_REG_MEM_OP, fop, dop, type, dst, src
|| if (type == IR_FLOAT) {
| fop xmm(dst-IR_REG_FP_FIRST), dword src
|| } else if (type == IR_DOUBLE) {
|| if (type == IR_DOUBLE) {
| dop xmm(dst-IR_REG_FP_FIRST), qword src
|| } else {
|| IR_ASSERT(0);
|| IR_ASSERT(type == IR_FLOAT);
| fop xmm(dst-IR_REG_FP_FIRST), dword src
|| }
|.endmacro
@ -338,22 +336,20 @@
|.endmacro
|.macro ASM_AVX_REG_REG_REG_OP, fop, dop, type, dst, op1, op2
|| if (type == IR_FLOAT) {
| fop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), xmm(op2-IR_REG_FP_FIRST)
|| } else if (type == IR_DOUBLE) {
|| if (type == IR_DOUBLE) {
| dop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), xmm(op2-IR_REG_FP_FIRST)
|| } else {
|| IR_ASSERT(0);
|| IR_ASSERT(type == IR_FLOAT);
| fop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), xmm(op2-IR_REG_FP_FIRST)
|| }
|.endmacro
|.macro ASM_AVX_REG_REG_MEM_OP, fop, dop, type, dst, op1, op2
|| if (type == IR_FLOAT) {
| fop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), dword op2
|| } else if (type == IR_DOUBLE) {
|| if (type == IR_DOUBLE) {
| dop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), qword op2
|| } else {
|| IR_ASSERT(0);
|| IR_ASSERT(type == IR_FLOAT);
| fop xmm(dst-IR_REG_FP_FIRST), xmm(op1-IR_REG_FP_FIRST), dword op2
|| }
|.endmacro
@ -379,20 +375,19 @@
|.endmacro
|.macro ASM_FP_MEM_REG_OP, fop, dop, avx_fop, avx_dop, type, dst, src
|| if (type == IR_FLOAT) {
|| if (ctx->flags & IR_AVX) {
| avx_fop dword dst, xmm(src-IR_REG_FP_FIRST)
|| } else {
| fop dword dst, xmm(src-IR_REG_FP_FIRST)
|| }
|| } else if (type == IR_DOUBLE) {
|| if (type == IR_DOUBLE) {
|| if (ctx->flags & IR_AVX) {
| avx_dop qword dst, xmm(src-IR_REG_FP_FIRST)
|| } else {
| dop qword dst, xmm(src-IR_REG_FP_FIRST)
|| }
|| } else {
|| IR_ASSERT(0);
|| IR_ASSERT(type == IR_FLOAT);
|| if (ctx->flags & IR_AVX) {
| avx_fop dword dst, xmm(src-IR_REG_FP_FIRST)
|| } else {
| fop dword dst, xmm(src-IR_REG_FP_FIRST)
|| }
|| }
|.endmacro
@ -3456,12 +3451,11 @@ static void ir_emit_return_fp(ir_ctx *ctx, ir_reg ref, ir_insn *insn)
if (op2_reg == IR_REG_NONE || (op2_reg & IR_REG_SPILL_LOAD)) {
int32_t offset = ir_ref_spill_slot(ctx, insn->op2);
ir_reg fp = (ctx->flags & IR_USE_FRAME_POINTER) ? IR_REG_FRAME_POINTER : IR_REG_STACK_POINTER;
if (type == IR_FLOAT) {
| fld dword [Ra(fp)+offset]
} else if (type == IR_DOUBLE) {
if (type == IR_DOUBLE) {
| fld qword [Ra(fp)+offset]
} else {
IR_ASSERT(0);
IR_ASSERT(type == IR_FLOAT);
| fld dword [Ra(fp)+offset]
}
} else {
int32_t offset = (type == IR_FLOAT) ? data->float_ret_slot : data->double_ret_slot;
@ -3471,12 +3465,11 @@ static void ir_emit_return_fp(ir_ctx *ctx, ir_reg ref, ir_insn *insn)
offset = IR_SPILL_POS_TO_OFFSET(offset);
fp = (ctx->flags & IR_USE_FRAME_POINTER) ? IR_REG_FRAME_POINTER : IR_REG_STACK_POINTER;
ir_emit_store_mem_fp(ctx, type, fp, offset, op2_reg);
if (type == IR_FLOAT) {
| fld dword [Ra(fp)+offset]
} else if (type == IR_DOUBLE) {
if (type == IR_DOUBLE) {
| fld qword [Ra(fp)+offset]
} else {
IR_ASSERT(0);
IR_ASSERT(type == IR_FLOAT);
| fld dword [Ra(fp)+offset]
}
}
#endif
@ -6415,12 +6408,11 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size)
|.align 8
|=>label:
|.dword insn->val.u32, insn->val.u32_hi
} else if (insn->type == IR_FLOAT) {
} else {
IR_ASSERT(insn->type == IR_FLOAT);
|.align 4
|=>label:
|.dword insn->val.u32
} else {
IR_ASSERT(0);
}
} else if (insn->op == IR_STR) {
int label = ctx->cfg_blocks_count + i;