Commit 8cb66696 by Ulrich Weigand Committed by Ulrich Weigand

s390-protos.h (s390_expand_logical_operator): Add prototype.

	* config/s390/s390-protos.h (s390_expand_logical_operator): Add
	prototype.
	(s390_logical_operator_ok_p): Likewise.
	* config/s390/s390.c (s390_expand_logical_operator): New function.
	(s390_logical_operator_ok_p): Likewise.
	* config/s390/s390.md ("anddi3"): New expander.
	("*anddi3"): Rename from old anddi3 pattern, add Q->Q alternative.
	("*anddi3_ss", "*anddi3_ss_inv"): Remove.
	("andsi3"): Use s390_expand_logical_operator.
	("*andsi3_esa", "*andsi3_zarch"): Add Q->Q alternative.
	("*andsi3_ss", "*andsi3_ss_inv"): Remove.
	("andhi3"): New expander.
	("*andhi3_zarch", "*andhi3_esa"): New patterns.
	("andhi3", "*andhi3_ni", "*andhi3_ss", "*andhi3_ss_inv"): Remove.
	("andqi3"): New expander.
	("*andqi3_zarch", "*andqi3_esa"): New patterns.
	("andqi3", "*andqi3_ni", "*andqi3_ss", "*andqi3_ss_inv"): Remove.
	("iordi3"): New expander.
	("*iordi3"): Rename from old iordi3 pattern, add Q->Q alternative.
	("*iordi3_ss", "*iordi3_ss_inv"): Remove.
	("iorsi3"): Use s390_expand_logical_operator.
	("*iorsi3_esa", "*iorsi3_zarch"): Add Q->Q alternative.
	("*iorsi3_ss", "*iorsi3_ss_inv"): Remove.
	("iorhi3"): New expiorer.
	("*iorhi3_zarch", "*iorhi3_esa"): New patterns.
	("iorhi3", "*iorhi3_ni", "*iorhi3_ss", "*iorhi3_ss_inv"): Remove.
	("iorqi3"): New expiorer.
	("*iorqi3_zarch", "*iorqi3_esa"): New patterns.
	("iorqi3", "*iorqi3_ni", "*iorqi3_ss", "*iorqi3_ss_inv"): Remove.
	("xordi3"): New expander.
	("*xordi3"): Rename from old xordi3 pattern, add Q->Q alternative.
	("*xordi3_ss", "*xordi3_ss_inv"): Remove.
	("xorsi3"): New expander.
	("*xorsi3"): Rename from old xorsi3 pattern, add Q->Q alternative.
	("*xorsi3_ss", "*xorsi3_ss_inv"): Remove.
	("xorhi3"): New expander.
	("*xorqi3"): Rename from old xorhi3 pattern, add Q->Q alternative.
	("*xorhi3_ss", "*xorhi3_ss_inv"): Remove.
	("xorqi3"): New expander.
	("*xorqi3"): Rename from old xorqi3 pattern, add Q->Q alternative.
	("*xorqi3_ss", "*xorqi3_ss_inv"): Remove.

From-SVN: r88370
parent 7d103eb5
2004-09-30 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390-protos.h (s390_expand_logical_operator): Add
prototype.
(s390_logical_operator_ok_p): Likewise.
* config/s390/s390.c (s390_expand_logical_operator): New function.
(s390_logical_operator_ok_p): Likewise.
* config/s390/s390.md ("anddi3"): New expander.
("*anddi3"): Rename from old anddi3 pattern, add Q->Q alternative.
("*anddi3_ss", "*anddi3_ss_inv"): Remove.
("andsi3"): Use s390_expand_logical_operator.
("*andsi3_esa", "*andsi3_zarch"): Add Q->Q alternative.
("*andsi3_ss", "*andsi3_ss_inv"): Remove.
("andhi3"): New expander.
("*andhi3_zarch", "*andhi3_esa"): New patterns.
("andhi3", "*andhi3_ni", "*andhi3_ss", "*andhi3_ss_inv"): Remove.
("andqi3"): New expander.
("*andqi3_zarch", "*andqi3_esa"): New patterns.
("andqi3", "*andqi3_ni", "*andqi3_ss", "*andqi3_ss_inv"): Remove.
("iordi3"): New expander.
("*iordi3"): Rename from old iordi3 pattern, add Q->Q alternative.
("*iordi3_ss", "*iordi3_ss_inv"): Remove.
("iorsi3"): Use s390_expand_logical_operator.
("*iorsi3_esa", "*iorsi3_zarch"): Add Q->Q alternative.
("*iorsi3_ss", "*iorsi3_ss_inv"): Remove.
("iorhi3"): New expiorer.
("*iorhi3_zarch", "*iorhi3_esa"): New patterns.
("iorhi3", "*iorhi3_ni", "*iorhi3_ss", "*iorhi3_ss_inv"): Remove.
("iorqi3"): New expiorer.
("*iorqi3_zarch", "*iorqi3_esa"): New patterns.
("iorqi3", "*iorqi3_ni", "*iorqi3_ss", "*iorqi3_ss_inv"): Remove.
("xordi3"): New expander.
("*xordi3"): Rename from old xordi3 pattern, add Q->Q alternative.
("*xordi3_ss", "*xordi3_ss_inv"): Remove.
("xorsi3"): New expander.
("*xorsi3"): Rename from old xorsi3 pattern, add Q->Q alternative.
("*xorsi3_ss", "*xorsi3_ss_inv"): Remove.
("xorhi3"): New expander.
("*xorqi3"): Rename from old xorhi3 pattern, add Q->Q alternative.
("*xorhi3_ss", "*xorhi3_ss_inv"): Remove.
("xorqi3"): New expander.
("*xorqi3"): Rename from old xorqi3 pattern, add Q->Q alternative.
("*xorqi3_ss", "*xorqi3_ss_inv"): Remove.
2004-09-30 Roger Sayle <roger@eyesopen.com>
* combine.c (force_to_mode) <NE_EXPR>: Only convert the expression
......
......@@ -84,6 +84,9 @@ extern bool s390_expand_addcc (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
extern rtx s390_return_addr_rtx (int, rtx);
extern rtx s390_back_chain_rtx (void);
extern rtx s390_emit_call (rtx, rtx, rtx, rtx);
extern void s390_expand_logical_operator (enum rtx_code,
enum machine_mode, rtx *);
extern bool s390_logical_operator_ok_p (rtx *);
extern bool s390_output_addr_const_extra (FILE*, rtx);
extern void print_operand_address (FILE *, rtx);
......
......@@ -1059,6 +1059,76 @@ s390_split_ok_p (rtx dst, rtx src, enum machine_mode mode, int first_subword)
return true;
}
/* Expand logical operator CODE in mode MODE with operands OPERANDS. */
void
s390_expand_logical_operator (enum rtx_code code, enum machine_mode mode,
rtx *operands)
{
enum machine_mode wmode = mode;
rtx dst = operands[0];
rtx src1 = operands[1];
rtx src2 = operands[2];
rtx op, clob, tem;
/* If we cannot handle the operation directly, use a temp register. */
if (!s390_logical_operator_ok_p (operands))
dst = gen_reg_rtx (mode);
/* QImode and HImode patterns make sense only if we have a destination
in memory. Otherwise perform the operation in SImode. */
if ((mode == QImode || mode == HImode) && GET_CODE (dst) != MEM)
wmode = SImode;
/* Widen operands if required. */
if (mode != wmode)
{
if (GET_CODE (dst) == SUBREG
&& (tem = simplify_subreg (wmode, dst, mode, 0)) != 0)
dst = tem;
else if (REG_P (dst))
dst = gen_rtx_SUBREG (wmode, dst, 0);
else
dst = gen_reg_rtx (wmode);
if (GET_CODE (src1) == SUBREG
&& (tem = simplify_subreg (wmode, src1, mode, 0)) != 0)
src1 = tem;
else if (GET_MODE (src1) != VOIDmode)
src1 = gen_rtx_SUBREG (wmode, force_reg (mode, src1), 0);
if (GET_CODE (src2) == SUBREG
&& (tem = simplify_subreg (wmode, src2, mode, 0)) != 0)
src2 = tem;
else if (GET_MODE (src2) != VOIDmode)
src2 = gen_rtx_SUBREG (wmode, force_reg (mode, src2), 0);
}
/* Emit the instruction. */
op = gen_rtx_SET (VOIDmode, dst, gen_rtx_fmt_ee (code, wmode, src1, src2));
clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, CC_REGNUM));
emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, op, clob)));
/* Fix up the destination if needed. */
if (dst != operands[0])
emit_move_insn (operands[0], gen_lowpart (mode, dst));
}
/* Check whether OPERANDS are OK for a logical operation (AND, IOR, XOR). */
bool
s390_logical_operator_ok_p (rtx *operands)
{
/* If the destination operand is in memory, it needs to coincide
with one of the source operands. After reload, it has to be
the first source operand. */
if (GET_CODE (operands[0]) == MEM)
return rtx_equal_p (operands[0], operands[1])
|| (!reload_completed && rtx_equal_p (operands[0], operands[2]));
return true;
}
/* Change optimizations to be performed, depending on the
optimization level.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment