emit "addi sp, sp, 4"
cost 8;
+ out:(long)reg = POP.D
+ emit "lfd %out, 0(sp)"
+ emit "addi sp, sp, 8"
+ cost 8;
+
SETRET.I(in:(ret)reg)
emit "! setret4"
cost 1;
emit "addi sp, sp, 8"
cost 16;
+ out:(long)reg = COPYD.L(in:(double)reg)
+ emit "sfdu %in, -8(sp)"
+ emit "lwz %out.0, 4(sp)"
+ emit "lwz %out.1, 0(sp)"
+ emit "addi sp, sp, 8"
+ cost 16;
+
/* Memory operations */
emit "bl .fromd2i"
cost 4;
+ out:(long)reg = FROMF.L(in:(double)reg)
+ with corrupted(volatile)
+ emit "bl .fromf2l"
+ cost 4;
+
#if 0
/* byte conversions */
emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
cost 8;
+ out:(int)reg = IFLT.I(in:(cr)cr)
+ emit "mfcr %out" /* get cr0 */
+ emit "andi. %out, %out, 1" /* leave just LT */
+ cost 8;
+
+ out:(int)reg = IFLE.I(in:(cr)cr)
+ emit "mfcr %out" /* get cr0 */
+ emit "andi. %out, %out, 5" /* leave just LT and EQ */
+ emit "cntlzw %out, %out" /* returns 0..32 */
+ emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
+ emit "xori %out, %out, 1" /* negate */
+ cost 8;
+
/* Conversions */
case op_cii: simple_convert(IR_FROMSI); break;
case op_ciu: simple_convert(IR_FROMSI); break;
case op_cui: simple_convert(IR_FROMUI); break;
+ case op_cfu: simple_convert(IR_FROMF); break; /* FIXME: technically wrong */
case op_cfi: simple_convert(IR_FROMF); break;
case op_cif: simple_convert(IR_FROMSI); break;
case op_cff: simple_convert(IR_FROMF); break;
}
materialise_stack();
- push(
- appendir(
- new_ir1(
- IR_CALL, EM_wordsize,
- new_labelir(helper)
- )
+ /* No push here, because the helper function leaves the result on
+ * the physical stack (which is very dubious). */
+ appendir(
+ new_ir1(
+ IR_CALL, EM_wordsize,
+ new_labelir(helper)
)
);
break;
break;
}
+ /* FIXME: These instructions are really complex and barely used
+ * (Modula-2 bitset support, I believe). Leave them until leter. */
+ case op_inn:
+ {
+ appendir(
+ new_ir1(
+ IR_CALL, 0,
+ new_labelir(".unimplemented")
+ )
+ );
+ break;
+ }
+
case op_lin:
{
/* Set line number --- ignore. */