public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at ucw dot cz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/17345] [3.5 Regression] internal compiler error: in optimize_mode_switching, at lcm.c:1225 Date: Thu, 09 Sep 2004 15:17:00 -0000 [thread overview] Message-ID: <20040909151720.29547.qmail@sourceware.org> (raw) In-Reply-To: <20040907105846.17345.wanderer@rsu.ru> ------- Additional Comments From hubicka at ucw dot cz 2004-09-09 15:17 ------- Subject: Re: [3.5 Regression] internal compiler error: in optimize_mode_switching, at lcm.c:1225 > > ------- Additional Comments From uros at kss-loka dot si 2004-09-09 14:16 ------- > Jan, > > thank you very much for looking into this bugreport! I admit, I didn't notice > this report, and I'm really sorry that even with a lot of testing, my patch The abnormal edges happen commonly only for C++ so it is rather dificult to catch. > broke something. Your patch fixes this breakage, could you please commit it to CVS ? I guess I need approval for this kind of patch... > > Regarding my proposal, I would suggest to change mode handling from this scheme: > ... > fldcw (new_mode) > fistp [or frndint] > fldcw (saved_mode) > ... > > fldcw (other_mode) > fistp [or frndint] > fldcw (saved_mode) > ... > > into something like this: > > ... > fldcw (new_mode) > fistp [or frndint] > ... > fldcw (other_mode) > fistp [or frndint] > ... > fldcw (saved_mode) > call [or __asm] > ... > fldcw (other_mode) > fistp [or frndint[ > ... > fldcw (saved_mode) > return This is dificult to do. Basically the loads of control word needs to depend on where reload ends up putting spilling code. There are two schemes - we might either teach reload to do spilling always in 80bit precision. This will kill performance somewhat but it might be usefull for people who need independency of results on optimization. Other scheme is to follow the current mode switching with a pass after reload that will insert actual loads from previously inserted computations. > > Basically, fldcw would be emitted only when rounding mode changes. Also, with > this scheme fistp and frndint patterns could have dependency on FP_mode > register, which would hopefully address mode changing in for loops. As it is now: > > ... > loop { > fldcw (new_mode) > fistp > fldcw (saved_mode) At same time it is important to not recaluclate saved_mode and new_mode unnecesarily. i think with your patch we will end up redoing the computation every time we need different rounding modes (ie try floor and ceil together in single loop) > } > ... > > > a better code could be generated: > ... > fldcw (new_mode) > loop { > fistp > } > ... > fldcw (saved_mode) > ret > > I guess mode would need to be changed to saved before call instruction or __asm > and on return from function. > > Another idea is to convert > (int) floor(double) into some kind of builtin_lfloor, etc on a tree level. This > builtin could then be expanded as fix_floor?f?i optab, and this could be > implemented with sse instructions as it is a case with fix_trunc?f?i optabs. > However, SSE has its own mode register and if handled the same way as i387 mode > register, another two stack slots would be needed to save old and new SSE > rounding mode value. I already (at least partly) implemented this. See mathfn_built_in and associated code. In the case we are missing some cases, just add more of them. Honza > > It is quite interesting, how many cases would this convertions catch. For > example, povray-3.50c: > > grep floor *.cpp | grep int - | wc -l > 39 > grep floor *.cpp | grep long - | wc -l > 7 > grep ceil *.cpp | grep int - | wc -l > 8 > > Uros. > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17345 > > ------- You are receiving this mail because: ------- > You are on the CC list for the bug, or are watching someone who is. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17345
next prev parent reply other threads:[~2004-09-09 15:17 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-09-07 10:58 [Bug c++/17345] New: " wanderer at rsu dot ru 2004-09-07 11:02 ` [Bug c++/17345] " wanderer at rsu dot ru 2004-09-07 11:02 ` wanderer at rsu dot ru 2004-09-07 11:03 ` wanderer at rsu dot ru 2004-09-07 15:24 ` [Bug rtl-optimization/17345] " pinskia at gcc dot gnu dot org 2004-09-07 16:27 ` giovannibajo at libero dot it 2004-09-07 16:33 ` pinskia at gcc dot gnu dot org 2004-09-07 16:34 ` [Bug rtl-optimization/17345] [3.5 Regression] " pinskia at gcc dot gnu dot org 2004-09-08 9:39 ` martin at mpa-garching dot mpg dot de 2004-09-08 11:15 ` giovannibajo at libero dot it 2004-09-08 11:21 ` [Bug middle-end/17345] " giovannibajo at libero dot it 2004-09-08 16:55 ` pinskia at gcc dot gnu dot org 2004-09-09 8:46 ` hubicka at ucw dot cz 2004-09-09 14:16 ` [Bug target/17345] " uros at kss-loka dot si 2004-09-09 15:01 ` uros at kss-loka dot si 2004-09-09 15:14 ` hubicka at ucw dot cz 2004-09-09 15:17 ` hubicka at ucw dot cz [this message] 2004-09-09 20:14 ` drow at gcc dot gnu dot org 2004-09-10 5:38 ` [Bug target/17345] [4.0 " uros at kss-loka dot si 2004-09-10 7:35 ` hubicka at ucw dot cz 2004-09-10 8:23 ` hubicka at ucw dot cz 2004-09-10 16:11 ` drow at gcc dot gnu dot org 2004-09-11 20:05 ` pinskia at gcc dot gnu dot org 2004-09-13 13:52 ` snyder at fnal dot gov 2004-09-13 14:11 ` uros at kss-loka dot si 2004-09-13 17:34 ` giovannibajo at libero dot it
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=20040909151720.29547.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).