More opcodes.

This commit is contained in:
David Given 2016-10-24 20:15:22 +02:00
parent a4644dee4d
commit 111c13e253
2 changed files with 50 additions and 6 deletions

View file

@ -177,6 +177,11 @@ PATTERNS
emit "addi sp, sp, 4" emit "addi sp, sp, 4"
cost 8; cost 8;
out:(long)reg = POP.D
emit "lfd %out, 0(sp)"
emit "addi sp, sp, 8"
cost 8;
SETRET.I(in:(ret)reg) SETRET.I(in:(ret)reg)
emit "! setret4" emit "! setret4"
cost 1; cost 1;
@ -231,6 +236,13 @@ PATTERNS
emit "addi sp, sp, 8" emit "addi sp, sp, 8"
cost 16; 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 */ /* Memory operations */
@ -362,6 +374,11 @@ PATTERNS
emit "bl .fromd2i" emit "bl .fromd2i"
cost 4; cost 4;
out:(long)reg = FROMF.L(in:(double)reg)
with corrupted(volatile)
emit "bl .fromf2l"
cost 4;
#if 0 #if 0
/* byte conversions */ /* byte conversions */
@ -534,6 +551,19 @@ PATTERNS
emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */ emit "rlwinm %out, %out, [32-5], 5, 31" /* if 32, return 1, otherwise 0 */
cost 8; 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 */ /* Conversions */

View file

@ -361,6 +361,7 @@ static void insn_simple(int opcode)
case op_cii: simple_convert(IR_FROMSI); break; case op_cii: simple_convert(IR_FROMSI); break;
case op_ciu: simple_convert(IR_FROMSI); break; case op_ciu: simple_convert(IR_FROMSI); break;
case op_cui: simple_convert(IR_FROMUI); 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_cfi: simple_convert(IR_FROMF); break;
case op_cif: simple_convert(IR_FROMSI); break; case op_cif: simple_convert(IR_FROMSI); break;
case op_cff: simple_convert(IR_FROMF); break; case op_cff: simple_convert(IR_FROMF); break;
@ -1058,12 +1059,12 @@ static void insn_ivalue(int opcode, arith value)
} }
materialise_stack(); materialise_stack();
push( /* No push here, because the helper function leaves the result on
appendir( * the physical stack (which is very dubious). */
new_ir1( appendir(
IR_CALL, EM_wordsize, new_ir1(
new_labelir(helper) IR_CALL, EM_wordsize,
) new_labelir(helper)
) )
); );
break; break;
@ -1304,6 +1305,19 @@ static void insn_ivalue(int opcode, arith value)
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: case op_lin:
{ {
/* Set line number --- ignore. */ /* Set line number --- ignore. */