public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/36090] [4.3/4.4 Regression] ppc64 cacoshl miscompilation Date: Fri, 09 May 2008 14:33:00 -0000 [thread overview] Message-ID: <20080509143219.32612.qmail@sourceware.org> (raw) In-Reply-To: <bug-36090-87@http.gcc.gnu.org/bugzilla/> ------- Comment #32 from jakub at gcc dot gnu dot org 2008-05-09 14:32 ------- Actually find_constant_pool_expr can be simplified, given that constant_pool_expr_1 had to return 1 each time. --- gcc/config/rs6000/rs6000.c.jj 2008-04-24 18:30:39.000000000 +0200 +++ gcc/config/rs6000/rs6000.c 2008-05-09 16:28:39.000000000 +0200 @@ -723,6 +723,7 @@ static unsigned rs6000_hash_constant (rt static unsigned toc_hash_function (const void *); static int toc_hash_eq (const void *, const void *); static int constant_pool_expr_1 (rtx, int *, int *); +static void find_constant_pool_expr (rtx *, rtx **, rtx **); static bool constant_pool_expr_p (rtx); static bool legitimate_small_data_p (enum machine_mode, rtx); static bool legitimate_lo_sum_address_p (enum machine_mode, rtx, int); @@ -3335,6 +3336,32 @@ constant_pool_expr_1 (rtx op, int *have_ } } +static void +find_constant_pool_expr (rtx *op, rtx **sym, rtx **toc) +{ + switch (GET_CODE (*op)) + { + case SYMBOL_REF: + if (CONSTANT_POOL_ADDRESS_P (*op)) + *sym = op; + else + *toc = op; + break; + case PLUS: + case MINUS: + find_constant_pool_expr (&XEXP (*op, 0), sym, toc); + find_constant_pool_expr (&XEXP (*op, 1), sym, toc); + break; + case CONST: + find_constant_pool_expr (&XEXP (*op, 0), sym, toc); + break; + case CONST_INT: + break; + default: + gcc_unreachable (); + } +} + static bool constant_pool_expr_p (rtx op) { @@ -12268,32 +12295,36 @@ print_operand_address (FILE *file, rtx x { if (TARGET_AIX && (!TARGET_ELF || !TARGET_MINIMAL_TOC)) { - rtx contains_minus = XEXP (x, 1); - rtx minus, symref; + rtx *symref = NULL, *tocref = NULL, toc = NULL, addr; const char *name; - /* Find the (minus (sym) (toc)) buried in X, and temporarily - turn it into (sym) for output_addr_const. */ - while (GET_CODE (XEXP (contains_minus, 0)) != MINUS) - contains_minus = XEXP (contains_minus, 0); - - minus = XEXP (contains_minus, 0); - symref = XEXP (minus, 0); - XEXP (contains_minus, 0) = symref; + find_constant_pool_expr (&XEXP (x, 1), &symref, &tocref); + if (tocref) + { + toc = *tocref; + *tocref = const0_rtx; + } if (TARGET_ELF) { char *newname; - name = XSTR (symref, 0); + name = XSTR (*symref, 0); newname = alloca (strlen (name) + sizeof ("@toc")); strcpy (newname, name); strcat (newname, "@toc"); - XSTR (symref, 0) = newname; + XSTR (*symref, 0) = newname; } - output_addr_const (file, XEXP (x, 1)); + addr = XEXP (x, 1); + if (GET_CODE (addr) == CONST) + addr = XEXP (addr, 0); + addr = simplify_rtx (addr); + if (!addr) + addr = XEXP (x, 1); + output_addr_const (file, addr); if (TARGET_ELF) - XSTR (symref, 0) = name; - XEXP (contains_minus, 0) = minus; + XSTR (*symref, 0) = name; + if (tocref) + *tocref = toc; } else output_addr_const (file, XEXP (x, 1)); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36090
next prev parent reply other threads:[~2008-05-09 14:33 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-30 20:16 [Bug target/36090] New: " jakub at gcc dot gnu dot org 2008-04-30 20:16 ` [Bug target/36090] " jakub at gcc dot gnu dot org 2008-04-30 20:26 ` jakub at gcc dot gnu dot org 2008-04-30 20:39 ` jakub at gcc dot gnu dot org 2008-04-30 21:18 ` dje at gcc dot gnu dot org 2008-05-01 2:33 ` dje at gcc dot gnu dot org 2008-05-01 2:41 ` dje at gcc dot gnu dot org 2008-05-01 7:14 ` jakub at gcc dot gnu dot org 2008-05-01 15:08 ` dje at gcc dot gnu dot org 2008-05-01 15:47 ` dje at gcc dot gnu dot org 2008-05-01 17:16 ` jakub at gcc dot gnu dot org 2008-05-01 17:34 ` dje at gcc dot gnu dot org 2008-05-02 9:35 ` jakub at gcc dot gnu dot org 2008-05-02 9:47 ` jakub at gcc dot gnu dot org 2008-05-02 12:42 ` dje at gcc dot gnu dot org 2008-05-02 15:11 ` dje at gcc dot gnu dot org 2008-05-02 15:44 ` dje at gcc dot gnu dot org 2008-05-02 15:46 ` dje at gcc dot gnu dot org 2008-05-02 16:30 ` bonzini at gnu dot org 2008-05-02 17:37 ` dje at gcc dot gnu dot org 2008-05-02 21:08 ` bonzini at gnu dot org 2008-05-02 21:24 ` dje at gcc dot gnu dot org 2008-05-03 7:13 ` bonzini at gnu dot org 2008-05-03 13:22 ` dje at gcc dot gnu dot org 2008-05-03 13:26 ` bonzini at gnu dot org 2008-05-03 14:21 ` dje at gcc dot gnu dot org 2008-05-03 15:48 ` bonzini at gnu dot org 2008-05-04 19:48 ` jakub at gcc dot gnu dot org 2008-05-04 20:09 ` dje at gcc dot gnu dot org 2008-05-08 16:37 ` dje at gcc dot gnu dot org 2008-05-08 16:41 ` dje at gcc dot gnu dot org 2008-05-09 5:37 ` cnstar9988 at gmail dot com 2008-05-09 14:19 ` jakub at gcc dot gnu dot org 2008-05-09 14:33 ` jakub at gcc dot gnu dot org [this message] 2008-05-09 15:52 ` bonzini at gnu dot org 2008-05-09 17:15 ` dje at gcc dot gnu dot org 2008-05-12 15:51 ` bonzini at gnu dot org 2008-05-12 16:33 ` dje at gcc dot gnu dot org 2008-05-12 16:48 ` bonzini at gnu dot org 2008-05-12 16:52 ` dje at gcc dot gnu dot org 2008-05-12 16:55 ` bonzini at gnu dot org 2008-05-16 19:45 ` rguenth at gcc dot gnu dot org 2008-05-18 18:32 ` jakub at gcc dot gnu dot org 2008-05-18 20:20 ` jakub at gcc dot gnu dot org 2008-05-18 20:21 ` jakub at gcc dot gnu dot org 2008-05-18 20:25 ` jakub at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080509143219.32612.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).