[wide-int] Fix mask inversions in expand_copysign_bit

Submitted by Richard Sandiford on Nov. 2, 2013, 10:24 a.m.

Details

Message ID 878ux7ksod.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Nov. 2, 2013, 10:24 a.m.
At some point the original "~"s got straightened to "-"s.

Tested on powerpc64-linux-gnu and x86_64-linux-gnu.  This fixed
a testsuite difference in bfin-elf.  Applied as obvious.

Thanks,
Richard

Patch hide | download patch | download mbox

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c	(revision 204311)
+++ gcc/optabs.c	(working copy)
@@ -3678,7 +3678,7 @@ 
 	      if (!op0_is_abs)
 		op0_piece
 		  = expand_binop (imode, and_optab, op0_piece,
-				  immed_wide_int_const (-mask, imode),
+				  immed_wide_int_const (~mask, imode),
 				  NULL_RTX, 1, OPTAB_LIB_WIDEN);
 	      op1 = expand_binop (imode, and_optab,
 				  operand_subword_force (op1, i, mode),
@@ -3708,7 +3708,7 @@ 
       op0 = gen_lowpart (imode, op0);
       if (!op0_is_abs)
 	op0 = expand_binop (imode, and_optab, op0,
-			    immed_wide_int_const (-mask, imode),
+			    immed_wide_int_const (~mask, imode),
 			    NULL_RTX, 1, OPTAB_LIB_WIDEN);
       temp = expand_binop (imode, ior_optab, op0, op1,
 			   gen_lowpart (imode, target), 1, OPTAB_LIB_WIDEN);