From: Jakub Jelinek Date: Sat, 19 Feb 2011 11:23:02 +0000 (+0100) Subject: re PR target/47800 (i?86 peephole related ICE) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9215ddc3e28e28f79a4b667652e21efd548dfa1e;p=gcc.git re PR target/47800 (i?86 peephole related ICE) PR target/47800 * config/i386/i386.md (peephole2 for shift and plus): Use operands[1] original mode in the first insn. * gcc.target/i386/pr47800.c: New test. From-SVN: r170311 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30c524a3887..c5bd191386f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-02-19 Jakub Jelinek + + PR target/47800 + * config/i386/i386.md (peephole2 for shift and plus): Use + operands[1] original mode in the first insn. + 2011-02-18 Mike Stump * config/t-darwin (TM_H): Add dependency on darwin-sections.def. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 1f14f5ce4d7..a17ab7aceee 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -1,6 +1,6 @@ ;; GCC machine description for IA-32 and x86-64. ;; Copyright (C) 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; Free Software Foundation, Inc. ;; Mostly by William Schelter. ;; x86_64 support added by Jan Hubicka @@ -17461,7 +17461,7 @@ (plus (match_dup 0) (match_operand 4 "x86_64_general_operand" ""))) (clobber (reg:CC FLAGS_REG))])] - "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 3 + "IN_RANGE (INTVAL (operands[2]), 1, 3) /* Validate MODE for lea. */ && ((!TARGET_PARTIAL_REG_STALL && (GET_MODE (operands[0]) == QImode @@ -17475,7 +17475,8 @@ [(set (match_dup 5) (match_dup 4)) (set (match_dup 0) (match_dup 1))] { - enum machine_mode mode = GET_MODE (operands[1]) == DImode ? DImode : SImode; + enum machine_mode op1mode = GET_MODE (operands[1]); + enum machine_mode mode = op1mode == DImode ? DImode : SImode; int scale = 1 << INTVAL (operands[2]); rtx index = gen_lowpart (Pmode, operands[1]); rtx base = gen_lowpart (Pmode, operands[5]); @@ -17485,10 +17486,9 @@ gen_rtx_MULT (Pmode, index, GEN_INT (scale))); operands[5] = base; if (mode != Pmode) - { - operands[1] = gen_rtx_SUBREG (mode, operands[1], 0); - operands[5] = gen_rtx_SUBREG (mode, operands[5], 0); - } + operands[1] = gen_rtx_SUBREG (mode, operands[1], 0); + if (op1mode != Pmode) + operands[5] = gen_rtx_SUBREG (op1mode, operands[5], 0); operands[0] = dest; }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8dc3c71ec88..be5a00686ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-19 Jakub Jelinek + + PR target/47800 + * gcc.target/i386/pr47800.c: New test. + 2011-02-18 Iain Sandoe * objc/execute/exceptions/foward-1.x: New. diff --git a/gcc/testsuite/gcc.target/i386/pr47800.c b/gcc/testsuite/gcc.target/i386/pr47800.c new file mode 100644 index 00000000000..45c817bc640 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr47800.c @@ -0,0 +1,15 @@ +/* PR target/47800 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=nocona" } */ + +int +foo (unsigned char *x, unsigned char *y) +{ + unsigned char a; + for (a = 0; x < y; x++) + if (a & 0x80) + a = (unsigned char) (a << 1) + 1 + *x; + else + a = (unsigned char) (a << 1) + *x; + return a; +}