This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix gcc.dg/i386-sse-2.c
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Feb 2002 13:59:33 -0800
- Subject: fix gcc.dg/i386-sse-2.c
Lots of little buglets with failing to validate operands
during initial code generation.
r~
* config/i386/i386.c (ix86_expand_vector_move): Use the mode
of the operand, rather than assuming TImode.
(ix86_expand_binop_builtin): Cope with commutative patterns
using nonimmediate_operand for both operands.
(ix86_expand_timode_binop_builtin): Likewise.
(ix86_expand_store_builtin): Validate operand 1.
(ix86_expand_unop1_builtin): Likewise.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.365
diff -c -p -d -r1.365 i386.c
*** i386.c 2002/02/19 20:05:28 1.365
--- i386.c 2002/02/20 21:54:41
*************** ix86_expand_vector_move (mode, operands)
*** 6732,6738 ****
&& !register_operand (operands[1], mode)
&& operands[1] != CONST0_RTX (mode))
{
! rtx temp = force_reg (TImode, operands[1]);
emit_move_insn (operands[0], temp);
return;
}
--- 6732,6738 ----
&& !register_operand (operands[1], mode)
&& operands[1] != CONST0_RTX (mode))
{
! rtx temp = force_reg (GET_MODE (operands[1]), operands[1]);
emit_move_insn (operands[0], temp);
return;
}
*************** ix86_expand_binop_builtin (icode, arglis
*** 11363,11368 ****
--- 11363,11374 ----
if (! (*insn_data[icode].operand[2].predicate) (op1, mode1))
op1 = copy_to_mode_reg (mode1, op1);
+ /* In the commutative cases, both op0 and op1 are nonimmediate_operand,
+ yet one of the two must not be a memory. This is normally enforced
+ by expanders, but we didn't bother to create one here. */
+ if (GET_CODE (op0) == MEM && GET_CODE (op1) == MEM)
+ op0 = copy_to_mode_reg (mode0, op0);
+
pat = GEN_FCN (icode) (target, op0, op1);
if (! pat)
return 0;
*************** ix86_expand_timode_binop_builtin (icode,
*** 11395,11400 ****
--- 11401,11412 ----
if (! (*insn_data[icode].operand[2].predicate) (op1, TImode))
op1 = copy_to_mode_reg (TImode, op1);
+ /* In the commutative cases, both op0 and op1 are nonimmediate_operand,
+ yet one of the two must not be a memory. This is normally enforced
+ by expanders, but we didn't bother to create one here. */
+ if (GET_CODE (op0) == MEM && GET_CODE (op1) == MEM)
+ op0 = copy_to_mode_reg (TImode, op0);
+
pat = GEN_FCN (icode) (target, op0, op1);
if (! pat)
return 0;
*************** ix86_expand_store_builtin (icode, arglis
*** 11422,11427 ****
--- 11434,11443 ----
op1 = safe_vector_operand (op1, mode1);
op0 = gen_rtx_MEM (mode0, copy_to_mode_reg (Pmode, op0));
+
+ if (! (*insn_data[icode].operand[1].predicate) (op1, mode1))
+ op1 = copy_to_mode_reg (mode1, op1);
+
pat = GEN_FCN (icode) (op0, op1);
if (pat)
emit_insn (pat);
*************** ix86_expand_unop1_builtin (icode, arglis
*** 11476,11482 ****
{
rtx pat;
tree arg0 = TREE_VALUE (arglist);
! rtx op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
--- 11492,11498 ----
{
rtx pat;
tree arg0 = TREE_VALUE (arglist);
! rtx op1, op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
enum machine_mode tmode = insn_data[icode].operand[0].mode;
enum machine_mode mode0 = insn_data[icode].operand[1].mode;
*************** ix86_expand_unop1_builtin (icode, arglis
*** 11490,11497 ****
if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
op0 = copy_to_mode_reg (mode0, op0);
!
! pat = GEN_FCN (icode) (target, op0, op0);
if (! pat)
return 0;
emit_insn (pat);
--- 11506,11517 ----
if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
op0 = copy_to_mode_reg (mode0, op0);
!
! op1 = op0;
! if (! (*insn_data[icode].operand[2].predicate) (op1, mode0))
! op1 = copy_to_mode_reg (mode0, op1);
!
! pat = GEN_FCN (icode) (target, op0, op1);
if (! pat)
return 0;
emit_insn (pat);