This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] ifcombine: Fix problem when optimizing 64 bit checks


Hi,

the ifcombine pass produces wrong code when optimizing 64 bit checks.

It emits 1 << x trees and uses the integer_one_node as first operand which
might be too small for 64bit operations.

Converting the integer_one_mode operand to the mode of the original operand
fixes the problem for s390x.

Bootstraps on s390 and i686 still running.
Bootstrap fixed on s390x.

OK for mainline given no testsuite regressions occur?

Bye,

-Andreas-

2007-07-23  Andreas Krebbel  <krebbel1@de.ibm.com>

	* tree-ssa-ifcombine.c (ifcombine_ifandif): Convert the integer_one_mode
	operand to the mode of the original operand.


Index: gcc/tree-ssa-ifcombine.c
===================================================================
*** gcc/tree-ssa-ifcombine.c.orig	2007-07-19 13:56:23.000000000 +0200
--- gcc/tree-ssa-ifcombine.c	2007-07-23 16:41:00.000000000 +0200
*************** ifcombine_ifandif (basic_block inner_con
*** 313,321 ****
        /* Do it.  */
        bsi = bsi_for_stmt (inner_cond);
        t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
! 		       integer_one_node, bit1);
        t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
! 		        integer_one_node, bit2);
        t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
        t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
  				    true, BSI_SAME_STMT);
--- 313,323 ----
        /* Do it.  */
        bsi = bsi_for_stmt (inner_cond);
        t = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
! 		       fold_convert (TREE_TYPE (name1), integer_one_node),
! 		       bit1);
        t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
! 		        fold_convert (TREE_TYPE (name1), integer_one_node),
! 			bit2);
        t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
        t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
  				    true, BSI_SAME_STMT);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]