public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bonzini at gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/33713] [4.3 Regression] can't find a register in class 'GENERAL_REGS' while reloading 'asm' Date: Tue, 06 Nov 2007 17:06:00 -0000 [thread overview] Message-ID: <20071106170551.19125.qmail@sourceware.org> (raw) In-Reply-To: <bug-33713-10053@http.gcc.gnu.org/bugzilla/> ------- Comment #6 from bonzini at gnu dot org 2007-11-06 17:05 ------- I think P1 is a little too much since this requires -fforce-addr. Anyway, here are my findings and thoughts: 1) reduced testcase: void oc_frag_recon_inter2_mmx(unsigned char *_dst,int _dst_ystride, const unsigned char *_src1,int _src1_ystride,const unsigned char *_src2, int _src2_ystride,const int *_residue) { long a; __asm__ __volatile__( "# %[src2] %[src1_ystride] %[src1] %[a] %[src2_ystride] \n\t" "# %[residue] %[dst_ystride] %[dst]\n\t" :[a]"=&a"(a),[dst]"+r"(_dst),[residue]"+r"(_residue), [src1]"+r"(_src1),[src2]"+r"(_src2) :[dst_ystride]"m"((long)_dst_ystride), [src1_ystride]"m"((long)_src1_ystride), [src2_ystride]"m"((long)_src2_ystride) ); } Note that the testcase is *relying on GCC to undo flag_force_addr!* In fact, the author used a "m" constraint exactly because they knew they would run out of registers: on a less starved machine, one would have used "r"! This makes me wonder if we shouldn't kill -fforce-addr just like we disposed of -fforce-mem. Let's go on anyway and try to fix it. 2) one of the problems is that at -O we do not run fwprop. We probably want to. 3) Here is a hack that I thought would fix it. Index: ../../peak-gcc-src/gcc/stmt.c =================================================================== --- ../../peak-gcc-src/gcc/stmt.c (revision 129768) +++ ../../peak-gcc-src/gcc/stmt.c (working copy) @@ -660,6 +660,7 @@ expand_asm_operands (tree string, tree o const char **constraints = alloca ((noutputs + ninputs) * sizeof (const char *)); int old_generating_concat_p = generating_concat_p; + int save_force_addr = flag_force_addr; /* An ASM with no outputs needs to be treated as volatile, for now. */ if (noutputs == 0) @@ -780,6 +781,7 @@ expand_asm_operands (tree string, tree o /* Second pass evaluates arguments. */ ninout = 0; + flag_force_addr = false; for (i = 0, tail = outputs; tail; tail = TREE_CHAIN (tail), i++) { tree val = TREE_VALUE (tail); @@ -1072,6 +1074,8 @@ expand_asm_operands (tree string, tree o emit_insn (body); } + flag_force_addr = save_force_addr; + /* For any outputs that needed reloading into registers, spill them back to where they belong. */ for (i = 0; i < noutputs; ++i) The idea is that in an asm, the author already has full control of memory modes. If they want to use a simple one, they can (using "r"). Otherwise, they don't want -fforce-addr (assuming somebody wants it...). It doesn't work, actually, because CSE not only does not do the propagation in 4.3; with -fforce-addr, it undoes it!!! So, here are the three possibilities: a) temporarily set flag_force_addr to false during CSE (in addition to the above stmt.c hunks, and enabling fwprop at -O). b) make flag_force_addr effective only during expansion (in addition to the above stmt.c hunks, and enabling fwprop at -O). With tree level optimization, few RTL passes modify mems (CSE, fwprop), and they do so because of addressing mode selection. So none of them should benefit of -fforce-addr, even though only CSE is affected now. c) disable flag_force_addr completely (doesn't require anything else, we might still want to enable fwprop at -O?) My preference is c, b, a. Anybody else? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33713
next prev parent reply other threads:[~2007-11-06 17:06 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-10-09 15:02 [Bug middle-end/33713] New: " rguenth at gcc dot gnu dot org 2007-10-09 16:50 ` [Bug middle-end/33713] " matz at gcc dot gnu dot org 2007-10-09 17:41 ` matz at gcc dot gnu dot org 2007-10-10 6:44 ` bonzini at gnu dot org 2007-10-22 8:36 ` pinskia at gcc dot gnu dot org 2007-10-22 8:49 ` rguenth at gcc dot gnu dot org 2007-11-05 2:47 ` mmitchel at gcc dot gnu dot org 2007-11-06 17:06 ` bonzini at gnu dot org [this message] 2007-11-06 21:38 ` rguenther at suse dot de 2007-11-07 16:46 ` matz at gcc dot gnu dot org 2007-11-07 18:56 ` ubizjak at gmail dot com 2007-11-08 16:32 ` paolo dot bonzini at lu dot unisi dot ch 2007-11-08 19:56 ` bonzini at gnu dot org 2007-11-08 19:58 ` bonzini at gnu dot org 2007-11-10 10:46 ` steven at gcc dot gnu dot org 2007-11-10 13:04 ` bonzini at gnu dot org 2007-11-19 8:54 ` steven at gcc dot gnu dot org 2007-11-19 9:45 ` bonzini at gnu dot org 2007-11-29 11:56 ` aldyh at gcc dot gnu dot org 2007-12-03 23:22 ` aldyh 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=20071106170551.19125.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).