*(double *)dest->inst_p0 = (*((double *) arg1->inst_p0)) op (*((double *) arg2->inst_p0)); \
break;
+#define FOLD_RBINOP(name, op) \
+ case name: \
+ dest->inst_p0 = (float *)mono_domain_alloc (cfg->domain, sizeof (float)); \
+ *(float *)dest->inst_p0 = (*((float *) arg1->inst_p0)) op (*((float *) arg2->inst_p0)); \
+ break;
+
#define FOLD_BINOPC(name,op,cast) \
case name: \
dest->inst_c0 = (cast)arg1->inst_c0 op (cast)arg2->inst_c0; \
switch (ins->opcode) {
case OP_FADD:
case OP_FMUL:
- if (arg2->opcode == OP_R8CONST && arg2->opcode == OP_R8CONST){
+ if (arg1->opcode == OP_R8CONST && arg2->opcode == OP_R8CONST) {
ALLOC_DEST (cfg, dest, ins);
switch (ins->opcode) {
FOLD_FBINOP (OP_FADD, +);
MONO_INST_NULLIFY_SREGS (dest);
}
break;
+ case OP_RADD:
+ case OP_RMUL:
+ if (arg1->opcode == OP_R4CONST && arg2->opcode == OP_R4CONST) {
+ ALLOC_DEST (cfg, dest, ins);
+ switch (ins->opcode) {
+ FOLD_RBINOP (OP_RADD, +);
+ FOLD_RBINOP (OP_RMUL, *);
+ }
+ dest->opcode = OP_R4CONST;
+ MONO_INST_NULLIFY_SREGS (dest);
+ }
+ break;
case OP_IMUL:
case OP_IADD:
case OP_IAND:
dest->inst_c0 = arg1->inst_c0;
}
break;
+ case OP_FMOVE:
+ if (arg1->opcode == OP_R8CONST) {
+ ALLOC_DEST (cfg, dest, ins);
+ dest->opcode = arg1->opcode;
+ dest->sreg1 = -1;
+ dest->inst_p0 = arg1->inst_p0;
+ }
+ break;
+ case OP_RMOVE:
+ if (arg1->opcode == OP_R4CONST) {
+ ALLOC_DEST (cfg, dest, ins);
+ dest->opcode = arg1->opcode;
+ dest->sreg1 = -1;
+ dest->inst_p0 = arg1->inst_p0;
+ }
+ break;
case OP_VMOVE:
if (arg1->opcode == OP_VZERO) {
ALLOC_DEST (cfg, dest, ins);
}
break;
}
- case OP_FMOVE:
- if (arg1->opcode == OP_R8CONST) {
- ALLOC_DEST (cfg, dest, ins);
- dest->opcode = OP_R8CONST;
- dest->sreg1 = -1;
- dest->inst_p0 = arg1->inst_p0;
- }
- break;
/*
* TODO: