public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/50107] New: [IRA, i386] allocates regiters in very non-optimal way
@ 2011-08-17 13:42 kirill.yukhin at intel dot com
  2011-08-17 13:53 ` [Bug rtl-optimization/50107] " kirill.yukhin at intel dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: kirill.yukhin at intel dot com @ 2011-08-17 13:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50107

             Bug #: 50107
           Summary: [IRA, i386] allocates regiters in very non-optimal way
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kirill.yukhin@intel.com


Created attachment 25032
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25032
Patch, enabling MULX insn

Hi,
I am working on enabling of new MULX instruction for GCC.
It have to relax generic unsigned mult in two ways: no falgs are clobbered, and
(the main) destination may be arbitrary 2 GPR's.

Patch is attached along with testcase.

Problem is that such relaxation leads to useless spills/fills.
Command line is:
./build-x86_64-linux/gcc/xgcc -B./build-x86_64-linux/gcc test.c -S -Ofast
Here is assembly with MULX:
test_mul_64:
.LFB0:
        movq    %rdi, %rdx
        pushq   %rbx              <--------
        mulx    %rsi, %rbx, %rcx
        addq    $3, %rcx
        adcq    $0, %rbx
        movq    %rcx, %rax
        movq    %rcx, k2(%rip)
        movq    %rbx, %rdx        <--------
        movq    %rbx, k2+8(%rip)
        popq    %rbx              <--------
        ret

You can see, that if we replace ebx usage with edx, instruction marked with
arrows will dissapear. 

Maybe the problem is connected with my definition of MULX?
But it seems to me as IRA misoptimization.

BTW, r8, r9 etc. regs are caller-safe, so we may just use them without saving
to stack? Why IRA doesn't do that?

Thanks, K


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-12-26 22:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-17 13:42 [Bug rtl-optimization/50107] New: [IRA, i386] allocates regiters in very non-optimal way kirill.yukhin at intel dot com
2011-08-17 13:53 ` [Bug rtl-optimization/50107] " kirill.yukhin at intel dot com
2011-08-17 17:19 ` vmakarov at redhat dot com
2011-08-17 18:58 ` hjl.tools at gmail dot com
2011-08-17 19:18 ` hjl.tools at gmail dot com
2011-08-17 19:32 ` hjl.tools at gmail dot com
2011-08-17 22:29 ` vmakarov at redhat dot com
2011-08-18 14:55 ` hjl.tools at gmail dot com
2011-08-18 15:03 ` vmakarov at gcc dot gnu.org
2011-08-18 15:31 ` hjl.tools at gmail dot com
2011-08-18 18:29 ` vmakarov at redhat dot com
2011-08-18 19:02 ` hjl.tools at gmail dot com
2011-08-19  6:05 ` [Bug rtl-optimization/50107] [IRA, i386] allocates registers " hjl.tools at gmail dot com
2011-08-19 16:14 ` hjl.tools at gmail dot com
2011-08-19 16:24 ` vmakarov at redhat dot com
2021-12-26 22:18 ` pinskia at gcc dot gnu.org

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).