From 297dbd7b024c3f08cd75d0b8d7092e439a7e7825 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 25 Jan 2003 16:02:11 +0000 Subject: [PATCH] re PR rtl-optimization/9279 ([ARM, Sparc] combine bug) PR optimization/9279 Merge from mainline: 2002-07-10 Roger Sayle PR c/2454 * combine.c (nonzero_bits): LOAD_EXTEND_OP should only apply to SUBREGs of MEMs. (num_sign_bit_copies): Likewise. From-SVN: r61778 --- gcc/ChangeLog | 37 ++++++--- gcc/combine.c | 16 ++-- gcc/testsuite/ChangeLog | 5 ++ .../gcc.c-torture/execute/20030125-1.c | 76 ++++--------------- 4 files changed, 55 insertions(+), 79 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a443a1813062..74f127d64685 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,10 +1,23 @@ +2003-01-25 Eric Botcazou + Christian Ehrhardt + + PR optimization/9279 + + Merge from mainline: + + 2002-07-10 Roger Sayle + + PR c/2454 + * combine.c (nonzero_bits): LOAD_EXTEND_OP should only apply + to SUBREGs of MEMs. (num_sign_bit_copies): Likewise. + 2003-01-25 Jan Hubicka PR fortran/9258 - * global.c (struct allocno): Add no_stack_reg. - (global_conflicts): Set no_stack_reg. - (find_reg): Use it. - + * global.c (struct allocno): Add no_stack_reg. + (global_conflicts): Set no_stack_reg. + (find_reg): Use it. + 2003-01-24 Volker Reichelt * doc/passes.texi: Fix typo. @@ -42,13 +55,13 @@ 2003-01-21 Christian Ehrhardt - PR opt/7507 - * calls.c (fix_unsafe_tree): Split out from ... - (expand_call): ... here. Use it on the function address too. + PR opt/7507 + * calls.c (fix_unsafe_tree): Split out from ... + (expand_call): ... here. Use it on the function address too. 2003-01-19 Roger Sayle - * config/pa/pa.md (muldi3): Avoid invalid sharing of SUBREG RTXs. + * config/pa/pa.md (muldi3): Avoid invalid sharing of SUBREG RTXs. 2003-01-19 John David Anglin @@ -115,9 +128,9 @@ 2003-01-07 Benjamin Kosnik Sunil Davasam - PR libstdc++/9076 - * unwind-dw2.c (execute_cfa_program): DW_CFA_undefined, - DW_CFA_same_value, read next and ignore. + PR libstdc++/9076 + * unwind-dw2.c (execute_cfa_program): DW_CFA_undefined, + DW_CFA_same_value, read next and ignore. 2003-01-07 Richard Henderson @@ -232,7 +245,7 @@ 2002-11-26 David Edelsohn - * config/rs6000/rs6000.c (rs6000_flag_pic): New variable. + * config/rs6000/rs6000.c (rs6000_flag_pic): New variable. (rs6000_override_options): Save original flag_pic value. (rs6000_encode_section_info): More accurate test for "local" symbol. diff --git a/gcc/combine.c b/gcc/combine.c index 5e8ad1ac3a28..50c04b1abf57 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8305,12 +8305,13 @@ nonzero_bits (x, mode) #if defined (WORD_REGISTER_OPERATIONS) && defined (LOAD_EXTEND_OP) /* If this is a typical RISC machine, we only have to worry about the way loads are extended. */ - if (LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND - ? (((nonzero - & (((unsigned HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - 1)))) - != 0)) - : LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) != ZERO_EXTEND) + if ((LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND + ? (((nonzero + & (((unsigned HOST_WIDE_INT) 1 + << (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - 1)))) + != 0)) + : LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) != ZERO_EXTEND) + || GET_CODE (SUBREG_REG (x)) != MEM) #endif { /* On many CISC machines, accessing an object in a wider mode @@ -8533,7 +8534,8 @@ num_sign_bit_copies (x, mode) if ((GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND) + && LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND + && GET_CODE (SUBREG_REG (x)) == MEM) return num_sign_bit_copies (SUBREG_REG (x), mode); #endif #endif diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 02dcd76dd57e..e9c1d44285d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-01-25 Eric Botcazou + Christian Ehrhardt + + * gcc.c-torture/execute/20030125-1.c: New test. + 2003-01-25 Paolo Carlini Tweaks for Bison-1.875. From the NEWS file: diff --git a/gcc/testsuite/gcc.c-torture/execute/20030125-1.c b/gcc/testsuite/gcc.c-torture/execute/20030125-1.c index 318974a38b5a..224d4ef32261 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20030125-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/20030125-1.c @@ -1,61 +1,17 @@ -/* Verify wehther math functions are simplified. */ -double sin(double); -double floor(double); -float -t(float a) -{ - return sin(a); -} -float -q(float a) -{ - return floor(a); -} -double -q1(float a) -{ - return floor(a); -} -float -q2(double a) -{ - return floor(a); -} -main() -{ -#ifdef __OPTIMIZE__ - if (t(0)!=0) - abort (); - if (q(0)!=0) - abort (); - if (q1(0)!=0) - abort (); - if (q2(0)!=0) - abort (); -#endif - return 0; -} -__attribute__ ((noinline)) -double -floor(double a) -{ - abort (); -} -__attribute__ ((noinline)) -float -floorf(float a) -{ - return a; -} -__attribute__ ((noinline)) -double -sin(double a) -{ - abort (); -} -__attribute__ ((noinline)) -float -sinf(float a) -{ - return a; +/* PR optimization/9279 */ +/* Verify that the combiner zero-extends + variables correctly. */ + +extern void abort (void); + +int x = 0; +char c, a = -1; +char *p = &c; + +int main (void) +{ + if ((x ? 0 : (unsigned char)(*p = a)) == -1) + abort(); + + return 0; } -- 2.47.2