diff mbox

[4.4] Fix another signed 1 bit comparison issue (PR middle-end/48973)

Message ID 20110721073945.GL2687@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek July 21, 2011, 7:39 a.m. UTC
Hi!

The 4.4 expr.c is significantly different from 4.5 that the PR48973
backport wasn't trivial, and apparently I've missed another place
- on the 4.4 branch the new pr48973-{1,2}.c tests fail on s390{,x}-linux.

The following patch fixes it, ok for 4.4 branch?

2011-07-21  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/48973
	* expr.c (expand_expr_real_1) <case TRUTH_ANDIF_EXPR:>: If
	the comparison has a single bit signed type, use
	constm1_rtx instead of const1_rtx for true value.


	Jakub

Comments

Richard Biener July 21, 2011, 9:18 a.m. UTC | #1
On Thu, Jul 21, 2011 at 9:39 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The 4.4 expr.c is significantly different from 4.5 that the PR48973
> backport wasn't trivial, and apparently I've missed another place
> - on the 4.4 branch the new pr48973-{1,2}.c tests fail on s390{,x}-linux.
>
> The following patch fixes it, ok for 4.4 branch?

Ok.

THanks,
Richard.

> 2011-07-21  Jakub Jelinek  <jakub@redhat.com>
>
>        PR middle-end/48973
>        * expr.c (expand_expr_real_1) <case TRUTH_ANDIF_EXPR:>: If
>        the comparison has a single bit signed type, use
>        constm1_rtx instead of const1_rtx for true value.
>
> --- gcc/expr.c  (revision 176517)
> +++ gcc/expr.c  (working copy)
> @@ -9171,7 +9171,9 @@ expand_expr_real_1 (tree exp, rtx target
>       jumpifnot (exp, op1, -1);
>
>       if (target)
> -       emit_move_insn (target, const1_rtx);
> +       emit_move_insn (target,
> +                       TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type)
> +                       ? constm1_rtx : const1_rtx);
>
>       emit_label (op1);
>       return ignore ? const0_rtx : target;
>
>        Jakub
>
diff mbox

Patch

--- gcc/expr.c	(revision 176517)
+++ gcc/expr.c	(working copy)
@@ -9171,7 +9171,9 @@  expand_expr_real_1 (tree exp, rtx target
       jumpifnot (exp, op1, -1);
 
       if (target)
-	emit_move_insn (target, const1_rtx);
+	emit_move_insn (target,
+			TYPE_PRECISION (type) == 1 && !TYPE_UNSIGNED (type)
+			? constm1_rtx : const1_rtx);
 
       emit_label (op1);
       return ignore ? const0_rtx : target;