This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Kill BIT_ANDTC_EXPR
- From: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Aug 2003 12:23:11 +0200
- Subject: Kill BIT_ANDTC_EXPR
Hi,
this patch kills BIT_ANDTC_EXPR which is used (in a meaningful way)
only in fold-const.c. BIT_ANDTC_EXPR's simplifier already converts
BIT_ANDTC_EXPR(x,y) to BIT_AND_EXTR (x, BIT_NOT_EXPR (y))
so I'm changing the only use of BIT_ANDTC_EXPR
to use BIT_AND_EXTR and BIT_NOT_EXPR too.
Bootstrapped/regtested i686.
Josef
2003-08-30 Josef Zlomek <zlomekj@suse.cz>
* c-typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
* convert.c (convert_to_integer): Kill BIT_ANDTC_EXPR.
* fold-const.c (int_const_binop): Kill BIT_ANDTC_EXPR.
(fold): Kill BIT_ANDTC_EXPR and label bit_and.
* tree.def (BIT_ANDTC_EXPR): Kill.
* cp/error.c (dump_expr): Kill BIT_ANDTC_EXPR.
* cp/lex.c (init_operators): Kill BIT_ANDTC_EXPR.
* cp/pt.c (tsubst_copy): Kill BIT_ANDTC_EXPR.
* cp/typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
(tsubst_copy_and_build): Kill BIT_ANDTC_EXPR.
* f/com.c (ffecom_overlap_): Kill BIT_ANDTC_EXPR.
(ffecom_tree_canonize_ref_): Kill BIT_ANDTC_EXPR.
Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/c-typeck.c,v
retrieving revision 1.254
diff -c -3 -p -r1.254 c-typeck.c
*** gcc/c-typeck.c 29 Aug 2003 21:57:05 -0000 1.254
--- gcc/c-typeck.c 30 Aug 2003 05:02:01 -0000
*************** build_binary_op (enum tree_code code, tr
*** 6594,6600 ****
break;
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
--- 6594,6599 ----
Index: gcc/convert.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/convert.c,v
retrieving revision 1.34
diff -c -3 -p -r1.34 convert.c
*** gcc/convert.c 22 Aug 2003 06:45:13 -0000 1.34
--- gcc/convert.c 30 Aug 2003 05:02:08 -0000
*************** convert_to_integer (tree type, tree expr
*** 473,479 ****
case BIT_AND_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
- case BIT_ANDTC_EXPR:
trunc1:
{
tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type);
--- 473,478 ----
Index: gcc/fold-const.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/fold-const.c,v
retrieving revision 1.299
diff -c -3 -p -r1.299 fold-const.c
*** gcc/fold-const.c 26 Aug 2003 21:44:43 -0000 1.299
--- gcc/fold-const.c 30 Aug 2003 07:27:23 -0000
*************** int_const_binop (enum tree_code code, tr
*** 1108,1117 ****
low = int1l & int2l, hi = int1h & int2h;
break;
- case BIT_ANDTC_EXPR:
- low = int1l & ~int2l, hi = int1h & ~int2h;
- break;
-
case RSHIFT_EXPR:
int2l = -int2l;
case LSHIFT_EXPR:
--- 1108,1113 ----
*************** fold (tree expr)
*** 6316,6322 ****
goto bit_rotate;
case BIT_AND_EXPR:
- bit_and:
if (integer_all_onesp (arg1))
return non_lvalue (convert (type, arg0));
if (integer_zerop (arg1))
--- 6312,6317 ----
*************** fold (tree expr)
*** 6354,6372 ****
goto associate;
- case BIT_ANDTC_EXPR:
- if (integer_all_onesp (arg0))
- return non_lvalue (convert (type, arg1));
- if (integer_zerop (arg0))
- return omit_one_operand (type, arg0, arg1);
- if (TREE_CODE (arg1) == INTEGER_CST)
- {
- arg1 = fold (build1 (BIT_NOT_EXPR, type, arg1));
- code = BIT_AND_EXPR;
- goto bit_and;
- }
- goto binary;
-
case RDIV_EXPR:
/* Don't touch a floating-point divide by zero unless the mode
of the constant can represent infinity. */
--- 6349,6354 ----
*************** fold (tree expr)
*** 6649,6655 ****
permute the two operations. */
if (code == RROTATE_EXPR && TREE_CODE (arg1) == INTEGER_CST
&& (TREE_CODE (arg0) == BIT_AND_EXPR
- || TREE_CODE (arg0) == BIT_ANDTC_EXPR
|| TREE_CODE (arg0) == BIT_IOR_EXPR
|| TREE_CODE (arg0) == BIT_XOR_EXPR)
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
--- 6631,6636 ----
*************** fold (tree expr)
*** 7418,7425 ****
&& TREE_CODE (arg1) == INTEGER_CST
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
! tree dandnotc = fold (build (BIT_ANDTC_EXPR, TREE_TYPE (arg0),
! arg1, TREE_OPERAND (arg0, 1)));
tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
if (integer_nonzerop (dandnotc))
return omit_one_operand (type, rslt, arg0);
--- 7399,7409 ----
&& TREE_CODE (arg1) == INTEGER_CST
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
! tree dandnotc
! = fold (build (BIT_AND_EXPR, TREE_TYPE (arg0),
! arg1, build1 (BIT_NOT_EXPR,
! TREE_TYPE (TREE_OPERAND (arg0, 1)),
! TREE_OPERAND (arg0, 1))));
tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
if (integer_nonzerop (dandnotc))
return omit_one_operand (type, rslt, arg0);
*************** fold (tree expr)
*** 7432,7439 ****
&& TREE_CODE (arg1) == INTEGER_CST
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
! tree candnotd = fold (build (BIT_ANDTC_EXPR, TREE_TYPE (arg0),
! TREE_OPERAND (arg0, 1), arg1));
tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
if (integer_nonzerop (candnotd))
return omit_one_operand (type, rslt, arg0);
--- 7416,7425 ----
&& TREE_CODE (arg1) == INTEGER_CST
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
! tree candnotd
! = fold (build (BIT_AND_EXPR, TREE_TYPE (arg0),
! TREE_OPERAND (arg0, 1),
! build1 (BIT_NOT_EXPR, TREE_TYPE (arg1), arg1)));
tree rslt = code == EQ_EXPR ? integer_zero_node : integer_one_node;
if (integer_nonzerop (candnotd))
return omit_one_operand (type, rslt, arg0);
Index: gcc/tree.def
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/tree.def,v
retrieving revision 1.63
diff -c -3 -p -r1.63 tree.def
*** gcc/tree.def 22 Aug 2003 06:25:09 -0000 1.63
--- gcc/tree.def 30 Aug 2003 05:10:00 -0000
*************** DEFTREECODE (RROTATE_EXPR, "rrotate_expr
*** 638,644 ****
DEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", '2', 2)
DEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", '2', 2)
DEFTREECODE (BIT_AND_EXPR, "bit_and_expr", '2', 2)
- DEFTREECODE (BIT_ANDTC_EXPR, "bit_andtc_expr", '2', 2)
DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", '1', 1)
/* ANDIF and ORIF allow the second operand not to be computed if the
--- 638,643 ----
Index: gcc/cp/error.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cp/error.c,v
retrieving revision 1.233
diff -c -3 -p -r1.233 error.c
*** gcc/cp/error.c 29 Aug 2003 07:00:32 -0000 1.233
--- gcc/cp/error.c 30 Aug 2003 05:10:05 -0000
*************** dump_expr (tree t, int flags)
*** 1486,1492 ****
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
case LT_EXPR:
--- 1486,1491 ----
Index: gcc/cp/lex.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cp/lex.c,v
retrieving revision 1.315
diff -c -3 -p -r1.315 lex.c
*** gcc/cp/lex.c 12 Aug 2003 22:26:21 -0000 1.315
--- gcc/cp/lex.c 30 Aug 2003 05:10:17 -0000
*************** init_operators (void)
*** 206,212 ****
operator_name_info [(int) ROUND_MOD_EXPR].name = "(round %)";
operator_name_info [(int) ABS_EXPR].name = "abs";
operator_name_info [(int) FFS_EXPR].name = "ffs";
- operator_name_info [(int) BIT_ANDTC_EXPR].name = "&~";
operator_name_info [(int) TRUTH_AND_EXPR].name = "strict &&";
operator_name_info [(int) TRUTH_OR_EXPR].name = "strict ||";
operator_name_info [(int) IN_EXPR].name = "in";
--- 206,211 ----
Index: gcc/cp/pt.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cp/pt.c,v
retrieving revision 1.767
diff -c -3 -p -r1.767 pt.c
*** gcc/cp/pt.c 30 Aug 2003 01:42:46 -0000 1.767
--- gcc/cp/pt.c 30 Aug 2003 05:10:55 -0000
*************** tsubst_copy (tree t, tree args, tsubst_f
*** 7302,7308 ****
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case TRUNC_MOD_EXPR:
--- 7302,7307 ----
*************** tsubst_copy_and_build (tree t,
*** 7985,7991 ****
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case TRUNC_MOD_EXPR:
--- 7984,7989 ----
Index: gcc/cp/typeck.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cp/typeck.c,v
retrieving revision 1.495
diff -c -3 -p -r1.495 typeck.c
*** gcc/cp/typeck.c 25 Aug 2003 15:47:43 -0000 1.495
--- gcc/cp/typeck.c 30 Aug 2003 05:10:25 -0000
*************** build_binary_op (enum tree_code code, tr
*** 2808,2814 ****
break;
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
--- 2808,2813 ----
Index: gcc/f/com.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/f/com.c,v
retrieving revision 1.214
diff -c -3 -p -r1.214 com.c
*** gcc/f/com.c 31 Jul 2003 05:49:14 -0000 1.214
--- gcc/f/com.c 30 Aug 2003 05:10:37 -0000
*************** ffecom_overlap_ (tree dest_decl, tree de
*** 1581,1587 ****
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_NOT_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
--- 1581,1586 ----
*************** ffecom_tree_canonize_ref_ (tree *decl, t
*** 8891,8897 ****
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case BIT_AND_EXPR:
- case BIT_ANDTC_EXPR:
case BIT_NOT_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
--- 8890,8895 ----