1/* Fold a constant sub-tree into a single node for C-compiler 2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 4 Free Software Foundation, Inc. 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify it under --- 9373 unchanged lines hidden (view full) --- 9382 return omit_one_operand (type, arg1, arg0); 9383 if (integer_zerop (arg1)) 9384 return non_lvalue (fold_convert (type, arg0)); 9385 if (operand_equal_p (arg0, arg1, 0)) 9386 return non_lvalue (fold_convert (type, arg0)); 9387 9388 /* ~X | X is -1. */ 9389 if (TREE_CODE (arg0) == BIT_NOT_EXPR |
9390 && INTEGRAL_TYPE_P (TREE_TYPE (arg1)) |
9391 && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)) 9392 { 9393 t1 = build_int_cst (type, -1); 9394 t1 = force_fit_type (t1, 0, false, false); 9395 return omit_one_operand (type, t1, arg1); 9396 } 9397 9398 /* X | ~X is -1. */ 9399 if (TREE_CODE (arg1) == BIT_NOT_EXPR |
9400 && INTEGRAL_TYPE_P (TREE_TYPE (arg0)) |
9401 && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) 9402 { 9403 t1 = build_int_cst (type, -1); 9404 t1 = force_fit_type (t1, 0, false, false); 9405 return omit_one_operand (type, t1, arg0); 9406 } 9407 9408 /* Canonicalize (X & C1) | C2. */ --- 91 unchanged lines hidden (view full) --- 9500 return non_lvalue (fold_convert (type, arg0)); 9501 if (integer_all_onesp (arg1)) 9502 return fold_build1 (BIT_NOT_EXPR, type, arg0); 9503 if (operand_equal_p (arg0, arg1, 0)) 9504 return omit_one_operand (type, integer_zero_node, arg0); 9505 9506 /* ~X ^ X is -1. */ 9507 if (TREE_CODE (arg0) == BIT_NOT_EXPR |
9508 && INTEGRAL_TYPE_P (TREE_TYPE (arg1)) |
9509 && operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)) 9510 { 9511 t1 = build_int_cst (type, -1); 9512 t1 = force_fit_type (t1, 0, false, false); 9513 return omit_one_operand (type, t1, arg1); 9514 } 9515 9516 /* X ^ ~X is -1. */ 9517 if (TREE_CODE (arg1) == BIT_NOT_EXPR |
9518 && INTEGRAL_TYPE_P (TREE_TYPE (arg0)) |
9519 && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) 9520 { 9521 t1 = build_int_cst (type, -1); 9522 t1 = force_fit_type (t1, 0, false, false); 9523 return omit_one_operand (type, t1, arg0); 9524 } 9525 9526 /* If we are XORing two BIT_AND_EXPR's, both of which are and'ing --- 4099 unchanged lines hidden --- |