static void emit_load_convert(Ctype *to, Ctype *from) { SAVE; if (is_inttype(from) && to->type == CTYPE_FLOAT) emit("cvtsi2ss %%eax, %%xmm0"); else if (is_inttype(from) && to->type == CTYPE_DOUBLE) emit("cvtsi2sd %%eax, %%xmm0"); else if (from->type == CTYPE_FLOAT && to->type == CTYPE_DOUBLE) emit("cvtps2pd %%xmm0, %%xmm0"); else if (from->type == CTYPE_DOUBLE && to->type == CTYPE_FLOAT) emit("cvtpd2ps %%xmm0, %%xmm0"); else if (to->type == CTYPE_BOOL) emit_to_bool(from); else if (is_inttype(to)) emit_toint(from); }
static void emit_load_convert(Type *to, Type *from) { SAVE; if (is_inttype(from) && to->kind == KIND_FLOAT) emit("cvtsi2ss #eax, #xmm0"); else if (is_inttype(from) && to->kind == KIND_DOUBLE) emit("cvtsi2sd #eax, #xmm0"); else if (from->kind == KIND_FLOAT && to->kind == KIND_DOUBLE) emit("cvtps2pd #xmm0, #xmm0"); else if ((from->kind == KIND_DOUBLE || from->kind == KIND_LDOUBLE) && to->kind == KIND_FLOAT) emit("cvtpd2ps #xmm0, #xmm0"); else if (to->kind == KIND_BOOL) emit_to_bool(from); else if (is_inttype(from) && is_inttype(to)) emit_intcast(from); else if (is_inttype(to)) emit_toint(from); }