public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/37364]  New: [4.4 Regression] IRA generates ineffient code
@ 2008-09-04  5:45 hjl dot tools at gmail dot com
  2008-09-04  9:50 ` [Bug middle-end/37364] " rguenth at gcc dot gnu dot org
                   ` (36 more replies)
  0 siblings, 37 replies; 38+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-09-04  5:45 UTC (permalink / raw)
  To: gcc-bugs

bash-3.2$ cat /tmp/x.c
#include <mmintrin.h>
extern __m64 x, y;
unsigned long long  foo(__m64 m) {
  return _mm_cvtm64_si64(_mm_add_pi32(x, y));
}
bash-3.2$ ./xgcc -B./ -march=core2 -S -O2 /tmp/x.c
bash-3.2$ cat x.s
        .file   "x.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
.LFB129:
        .cfi_startproc
        movq    x(%rip), %mm0
        paddd   y(%rip), %mm0
        movq    %mm0, -8(%rsp)
        movq    -8(%rsp), %rax
        ret
        .cfi_endproc
.LFE129:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 4.4.0 20080903 (experimental) [trunk revision
139952]"
        .section        .note.GNU-stack,"",@progbits
bash-3.2$ ./xgcc -B./ -march=core2 -S -O2 /tmp/x.c -fno-ira
bash-3.2$ cat x.s
        .file   "x.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
.LFB129:
        .cfi_startproc
        movq    x(%rip), %mm0
        paddd   y(%rip), %mm0
        movd    %mm0, %rax
        ret
        .cfi_endproc
.LFE129:
        .size   foo, .-foo
        .ident  "GCC: (GNU) 4.4.0 20080903 (experimental) [trunk revision
139952]"
        .section        .note.GNU-stack,"",@progbits
bash-3.2$ 

The problem is IRA turns

(insn 8 7 14 2 ../../include/mmintrin.h:300 (set (reg:V2SI 61)
        (plus:V2SI (reg:V2SI 63 [ x ])
            (mem/c/i:V2SI (symbol_ref:DI ("y") <var_decl 0x7fd36e03cc80 y>) [2 
y+0 S8 A64]))) 992 {*mmx_addv2si3} (expr_list:REG_DEAD (reg:V2SI 63 [ x ])
        (nil)))

(insn 14 8 20 2 /tmp/x.c:12 (set (reg/i:DI 0 ax)
        (subreg:DI (reg:V2SI 61) 0)) 89 {*movdi_1_rex64} (expr_list:REG_DEAD
(re
g:V2SI 61)
        (nil)))

into

(insn 26 8 14 2 ../../include/mmintrin.h:300 (set (mem/c:V2SI (plus:DI
(reg/f:DI
 7 sp)
                (const_int -8 [0xfffffffffffffff8])) [3 S8 A64])
        (reg:V2SI 29 mm0 [orig:63 x ] [63])) 946 {*movv2si_internal_rex64}
(nil)
)

(insn:HI 14 26 20 2 /tmp/x.c:12 (set (reg/i:DI 0 ax)
        (mem/c:DI (plus:DI (reg/f:DI 7 sp)
                (const_int -8 [0xfffffffffffffff8])) [3 S8 A64])) 89
{*movdi_1_r
ex64} (nil))

while the old RA generates

(insn:HI 14 8 20 2 /tmp/x.c:12 (set (reg/i:DI 0 ax)
        (reg:DI 29 mm0 [orig:63 x ] [63])) 89 {*movdi_1_rex64} (nil))

The outputs from regmove pass are different. With IRA, we got

(insn:HI 8 7 14 2 ../../include/mmintrin.h:300 (set (reg:V2SI 61)
        (plus:V2SI (reg:V2SI 63 [ x ])
            (mem/c/i:V2SI (symbol_ref:DI ("y") <var_decl 0x7f66abfb5c80 y>) [2
y
+0 S8 A64]))) 992 {*mmx_addv2si3} (expr_list:REG_DEAD (reg:V2SI 63 [ x ])
        (nil)))

(insn:HI 14 8 20 2 /tmp/x.c:12 (set (reg/i:DI 0 ax)
        (subreg:DI (reg:V2SI 61) 0)) 89 {*movdi_1_rex64} (expr_list:REG_DEAD
(re
g:V2SI 61)
        (nil)))

Without IRA, we got
(insn:HI 8 7 14 2 ../../include/mmintrin.h:300 (set (reg:V2SI 63 [ x ])
        (plus:V2SI (reg:V2SI 63 [ x ])
            (mem/c/i:V2SI (symbol_ref:DI ("y") <var_decl 0x7fd36e03cc80 y>) [2 
y+0 S8 A64]))) 992 {*mmx_addv2si3} (nil))

(insn:HI 14 8 20 2 /tmp/x.c:12 (set (reg/i:DI 0 ax)
        (subreg:DI (reg:V2SI 63 [ x ]) 0)) 89 {*movdi_1_rex64} (expr_list:REG_D
EAD (reg:V2SI 63 [ x ])
        (nil)))

Does it have any impact on code generation?


-- 
           Summary: [4.4 Regression] IRA generates ineffient code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: x86_64-unknown-linux-gnu


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


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

end of thread, other threads:[~2009-02-04  7:58 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-04  5:45 [Bug middle-end/37364] New: [4.4 Regression] IRA generates ineffient code hjl dot tools at gmail dot com
2008-09-04  9:50 ` [Bug middle-end/37364] " rguenth at gcc dot gnu dot org
2008-09-04 16:04 ` hjl dot tools at gmail dot com
2008-09-04 16:14 ` hjl dot tools at gmail dot com
2008-09-04 17:44 ` hjl dot tools at gmail dot com
2008-09-04 17:55 ` hjl dot tools at gmail dot com
2008-09-04 18:40 ` [Bug middle-end/37364] [4.4 Regression] IRA generates inefficient code hjl dot tools at gmail dot com
2008-09-04 19:26 ` vmakarov at redhat dot com
2008-09-04 19:46 ` hjl dot tools at gmail dot com
2008-09-04 20:14 ` rguenth at gcc dot gnu dot org
2008-09-04 20:18 ` hjl dot tools at gmail dot com
2008-09-04 20:32 ` hjl dot tools at gmail dot com
2008-09-06 15:58 ` [Bug target/37364] [4.4 Regression] IRA generates inefficient code due to missing regmove pass ubizjak at gmail dot com
2008-09-06 16:26 ` ubizjak at gmail dot com
2008-09-06 16:50 ` hjl dot tools at gmail dot com
2008-09-09 16:02 ` hjl dot tools at gmail dot com
2008-09-11 13:47 ` bonzini at gnu dot org
2008-09-11 17:34 ` ubizjak at gmail dot com
2008-10-22  3:19 ` mmitchel at gcc dot gnu dot org
2008-10-23  8:44 ` Joey dot ye at intel dot com
2008-10-24  8:37 ` Joey dot ye at intel dot com
2008-10-24 10:12 ` bonzini at gnu dot org
2008-10-24 10:17 ` bonzini at gnu dot org
2008-10-25  4:15 ` Joey dot ye at intel dot com
2008-10-28  1:13 ` hjl dot tools at gmail dot com
2008-10-28  1:21 ` Joey dot ye at intel dot com
2008-10-28  1:37 ` hjl dot tools at gmail dot com
2008-11-04 19:30 ` hjl dot tools at gmail dot com
2008-11-30 20:46 ` steven at gcc dot gnu dot org
2008-11-30 20:53 ` hjl dot tools at gmail dot com
2008-11-30 21:20 ` steven at gcc dot gnu dot org
2008-11-30 21:34 ` steven at gcc dot gnu dot org
2008-12-01 18:27 ` ubizjak at gmail dot com
2008-12-21 18:06 ` hjl dot tools at gmail dot com
2009-01-29 17:13 ` hjl dot tools at gmail dot com
2009-01-29 17:57 ` hjl dot tools at gmail dot com
2009-02-04  7:57 ` bonzini at gnu dot org
2009-02-04  7:58 ` bonzini at gnu dot 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).