public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mrs at apple dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/23200] [4.0/4.1/4.2 regression] rejects "i"(&var + 1) Date: Sat, 04 Feb 2006 00:16:00 -0000 [thread overview] Message-ID: <20060204001621.31877.qmail@sourceware.org> (raw) In-Reply-To: <bug-23200-11104@http.gcc.gnu.org/bugzilla/> ------- Comment #17 from mrs at apple dot com 2006-02-04 00:16 ------- I've found a way to fix this at -O0 for my code with something like: /* APPLE LOCAL begin CW asm blocks */ { tree array = ptrop; STRIP_NOPS (array); /* We want to canonicalize PLUS_EXPR into ARRAY_REF for data pointers as ARRAY_REFs can be converted into RTL code without introducing additional temporaries when not optimizing, which is useful as otherwise when all registers are in use by the assembly code, we can run reload out of registers. */ if (inside_cw_asm_block && flag_ms_asms && resultcode == PLUS_EXPR && TREE_CODE (array) == ADDR_EXPR && !(TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == FUNCTION_TYPE || TREE_CODE (TREE_TYPE (TREE_TYPE (array))) == METHOD_TYPE)) { tree type; tree r; tree new_i; size_exp = convert (TREE_TYPE (intop), size_exp); /* We have to ensure that when ARRAY_REF is used, it will calculate the offset correctly as it is element based, and we are byte based. */ new_i = fold (build_binary_op (CEIL_DIV_EXPR, intop, size_exp, 1)); if (build_binary_op (MULT_EXPR, new_i, size_exp, 1) == intop) { array = TREE_OPERAND (array, 0); type = TREE_TYPE (TREE_TYPE (array)); if (TREE_CODE (type) != ARRAY_TYPE) type = TYPE_MAIN_VARIANT (type); r = build4 (ARRAY_REF, type, array, new_i, NULL_TREE, NULL_TREE); TREE_READONLY (r) |= (TYPE_READONLY (TREE_TYPE (TREE_TYPE (array))) | TREE_READONLY (array)); TREE_SIDE_EFFECTS (r) |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) | TREE_SIDE_EFFECTS (array)); TREE_THIS_VOLATILE (r) |= (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (array))) /* This was added by rms on 16 Nov 91. It fixes vol struct foo *a; a->elts[1] in an inline function. Hope it doesn't break something else. */ | TREE_THIS_VOLATILE (array)); r = fold (r); r = build1 (ADDR_EXPR, result_type, r); r = fold (r); return r; } } } inside pointer_int_sum just before: /* Replace the integer argument with a suitable product by the object size. Do this multiplication as signed, then convert to the appropriate pointer type (actually unsigned integral). */ intop = convert (result_type, build_binary_op (MULT_EXPR, intop, convert (TREE_TYPE (intop), size_exp), 1)); This makes it though gimple without creating any decls and makes it through rtl expansion without creating any new pseduo registers when using an "m" constraint and putting an INDIRECT_REF on it. You can see this working on the apple-local-200502-branch, Radar 4399388. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23200
next prev parent reply other threads:[~2006-02-04 0:16 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-23200-11104@http.gcc.gnu.org/bugzilla/> 2005-10-29 15:11 ` [Bug inline-asm/23200] [4.0/4.1 " steven at gcc dot gnu dot org 2005-10-31 4:37 ` mmitchel at gcc dot gnu dot org 2005-11-11 8:59 ` bonzini at gcc dot gnu dot org 2005-11-11 9:00 ` bonzini at gcc dot gnu dot org 2006-01-14 5:50 ` [Bug inline-asm/23200] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org 2006-01-15 23:15 ` mmitchel at gcc dot gnu dot org 2006-01-15 23:23 ` steven at gcc dot gnu dot org 2006-01-19 19:50 ` amacleod at redhat dot com 2006-02-04 0:16 ` mrs at apple dot com [this message] 2006-02-24 0:26 ` mmitchel at gcc dot gnu dot org 2006-02-24 2:17 ` mrs at apple dot com 2006-02-24 2:24 ` mark at codesourcery dot com 2006-05-13 8:27 ` stsp at users dot sourceforge dot net 2006-05-25 2:33 ` mmitchel at gcc dot gnu dot org 2006-10-04 22:20 ` jakub at gcc dot gnu dot org 2006-10-04 22:33 ` amacleod at redhat dot com 2006-10-05 19:29 ` stsp at users dot sourceforge dot net 2006-12-08 14:32 ` [Bug inline-asm/23200] [4.0/4.1/4.2/4.3 " amacleod at redhat dot com 2007-02-14 9:06 ` mmitchel at gcc dot gnu dot org 2007-03-10 1:36 ` [Bug inline-asm/23200] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org 2007-03-10 1:40 ` mmitchel at gcc dot gnu dot org 2007-03-10 1:41 ` [Bug inline-asm/23200] [4.0/4.1/4.2/4.3 " pinskia at gcc dot gnu dot org 2007-03-12 13:11 ` amacleod at redhat dot com 2007-11-22 15:41 ` jakub at gcc dot gnu dot org 2007-11-22 15:53 ` jakub at gcc dot gnu dot org 2007-11-22 17:27 ` stsp at users dot sourceforge dot net 2008-01-16 22:34 ` [Bug inline-asm/23200] [4.1/4.2/4.3 Regression] " rguenth at gcc dot gnu dot org 2008-01-17 19:09 ` stsp at users dot sourceforge dot net 2008-07-04 20:01 ` [Bug inline-asm/23200] [4.1/4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org 2008-07-05 5:29 ` stsp at users dot sourceforge dot net 2008-07-05 9:41 ` [Bug inline-asm/23200] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org 2009-01-25 18:40 ` rguenth at gcc dot gnu dot org 2009-01-26 16:17 ` amacleod at redhat dot com 2009-03-31 18:54 ` [Bug inline-asm/23200] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org 2009-08-04 12:30 ` rguenth at gcc dot gnu dot org 2010-05-22 19:00 ` [Bug inline-asm/23200] [4.3/4.4/4.5/4.6 " rguenth at gcc dot gnu dot org 2010-08-18 22:43 ` pinskia 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=20060204001621.31877.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).