ix86_expand_copysign (rtx operands[])
{
machine_mode mode, vmode;
- rtx dest, op0, op1, mask, op2, op3;
+ rtx dest, vdest, op0, op1, mask, op2, op3;
mode = GET_MODE (operands[0]);
return;
}
- dest = lowpart_subreg (vmode, operands[0], mode);
- op1 = lowpart_subreg (vmode, operands[2], mode);
+ dest = operands[0];
+ vdest = lowpart_subreg (vmode, dest, mode);
+ if (vdest == NULL_RTX)
+ vdest = gen_reg_rtx (vmode);
+ else
+ dest = NULL_RTX;
+ op1 = lowpart_subreg (vmode, force_reg (mode, operands[2]), mode);
mask = ix86_build_signbit_mask (vmode, 0, 0);
if (CONST_DOUBLE_P (operands[1]))
/* Optimize for 0, simplify b = copy_signf (0.0f, a) to b = mask & a. */
if (op0 == CONST0_RTX (mode))
{
- emit_move_insn (dest, gen_rtx_AND (vmode, mask, op1));
+ emit_move_insn (vdest, gen_rtx_AND (vmode, mask, op1));
+ if (dest)
+ emit_move_insn (dest, lowpart_subreg (mode, vdest, vmode));
return;
}
op0 = force_reg (vmode, op0);
}
else
- op0 = lowpart_subreg (vmode, operands[1], mode);
+ op0 = lowpart_subreg (vmode, force_reg (mode, operands[1]), mode);
op2 = gen_reg_rtx (vmode);
op3 = gen_reg_rtx (vmode);
gen_rtx_NOT (vmode, mask),
op0));
emit_move_insn (op3, gen_rtx_AND (vmode, mask, op1));
- emit_move_insn (dest, gen_rtx_IOR (vmode, op2, op3));
+ emit_move_insn (vdest, gen_rtx_IOR (vmode, op2, op3));
+ if (dest)
+ emit_move_insn (dest, lowpart_subreg (mode, vdest, vmode));
}
/* Expand an xorsign operation. */
ix86_expand_xorsign (rtx operands[])
{
machine_mode mode, vmode;
- rtx dest, op0, op1, mask, x, temp;
+ rtx dest, vdest, op0, op1, mask, x, temp;
dest = operands[0];
op0 = operands[1];
temp = gen_reg_rtx (vmode);
mask = ix86_build_signbit_mask (vmode, 0, 0);
- op1 = lowpart_subreg (vmode, op1, mode);
+ op1 = lowpart_subreg (vmode, force_reg (mode, op1), mode);
x = gen_rtx_AND (vmode, op1, mask);
emit_insn (gen_rtx_SET (temp, x));
- op0 = lowpart_subreg (vmode, op0, mode);
+ op0 = lowpart_subreg (vmode, force_reg (mode, op0), mode);
x = gen_rtx_XOR (vmode, temp, op0);
- dest = lowpart_subreg (vmode, dest, mode);
- emit_insn (gen_rtx_SET (dest, x));
+ vdest = lowpart_subreg (vmode, dest, mode);
+ if (vdest == NULL_RTX)
+ vdest = gen_reg_rtx (vmode);
+ else
+ dest = NULL_RTX;
+ emit_insn (gen_rtx_SET (vdest, x));
+
+ if (dest)
+ emit_move_insn (dest, lowpart_subreg (mode, vdest, vmode));
}
static rtx ix86_expand_compare (enum rtx_code code, rtx op0, rtx op1);