From 51c561e360e9712070fd00eae33fe6e398d2e1fa Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 16 Jan 2002 20:01:31 +0100 Subject: [PATCH] alpha.c (some_small_symbolic_mem_operand): Look into (and:DI () (const_int -8)). * config/alpha/alpha.c (some_small_symbolic_mem_operand): Look into (and:DI () (const_int -8)). (split_small_symbolic_mem_operand): Split (mem (and:DI () (const_int -8)). * gcc.dg/20020116-1.c: New test. From-SVN: r48920 --- gcc/ChangeLog | 7 +++++++ gcc/config/alpha/alpha.c | 24 +++++++++++++++++++++--- gcc/testsuite/ChangeLog | 6 +++--- gcc/testsuite/gcc.dg/20020116-1.c | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/20020116-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17bc3862ae0..9cb28eef774 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-01-16 Jakub Jelinek + + * config/alpha/alpha.c (some_small_symbolic_mem_operand): Look into + (and:DI () (const_int -8)). + (split_small_symbolic_mem_operand): Split + (mem (and:DI () (const_int -8)). + 2002-01-16 Jakub Jelinek PR target/5309: diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index c409fbb868c..8204c782cdf 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -1878,8 +1878,16 @@ some_small_symbolic_mem_operand (x, mode) while (GET_RTX_CLASS (GET_CODE (x)) == '1') x = XEXP (x, 0); - return (GET_CODE (x) == MEM - && small_symbolic_operand (XEXP (x, 0), Pmode)); + if (GET_CODE (x) != MEM) + return 0; + + x = XEXP (x, 0); + /* If this is an ldq_u type address, discard the outer AND. */ + if (GET_CODE (x) == AND && GET_MODE (x) == DImode + && GET_CODE (XEXP (x, 1)) == CONST_INT + && INTVAL (XEXP (x, 1)) == -8) + x = XEXP (x, 0); + return small_symbolic_operand (x, Pmode); } rtx @@ -1890,7 +1898,17 @@ split_small_symbolic_mem_operand (x) if (GET_CODE (x) == MEM) { - rtx tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, XEXP (x, 0)); + rtx tmp = XEXP (x, 0); + + if (GET_CODE (tmp) == AND && GET_MODE (tmp) == DImode + && GET_CODE (XEXP (tmp, 1)) == CONST_INT + && INTVAL (XEXP (tmp, 1)) == -8) + { + tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, XEXP (tmp, 0)); + tmp = gen_rtx_AND (DImode, tmp, GEN_INT (-8)); + } + else + tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, tmp); return replace_equiv_address (x, tmp); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8aa2757fce3..0e049be589d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,10 +1,10 @@ 2002-01-16 Jakub Jelinek - * gcc.dg/ultrasp4.c: New test. + * gcc.dg/20020116-2.c: New test. -2002-01-16 Jakub Jelinek + * gcc.dg/ultrasp4.c: New test. - * gcc.dg/20020116-2.c: New test. + * gcc.dg/20020116-1.c: New test. 2002-01-15 Geoffrey Keating diff --git a/gcc/testsuite/gcc.dg/20020116-1.c b/gcc/testsuite/gcc.dg/20020116-1.c new file mode 100644 index 00000000000..d554675bc69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020116-1.c @@ -0,0 +1,16 @@ +/* This testcase ICEd on Alpha because ldq_u argument was not subject to + small_symbolic_mem_operand splitting. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -fpic -mexplicit-relocs -mcpu=ev4" { target alpha*-*-* } } */ + +static char a; +char *b; + +void foo (void) +{ + register char *c; + + c = b; + *c = a; +} -- 2.30.2