Summary: | non-optimal code with __builtin_signbit | ||
---|---|---|---|
Product: | gcc | Reporter: | Uroš Bizjak <ubizjak> |
Component: | target | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | gcc-bugs |
Priority: | P2 | Keywords: | missed-optimization |
Version: | 4.1.0 | ||
Target Milestone: | 4.3.0 | ||
Host: | Target: | i?86-*-* | |
Build: | Known to work: | ||
Known to fail: | 4.0.0 4.1.0 | Last reconfirmed: | 2006-01-15 20:21:56 |
Description
Uroš Bizjak
2005-05-11 09:15:41 UTC
Confirmed. It looks that REG_EQUAL notes gets lost between regmove and lreg pass. A relevant part from compiling an example in description with '-O2' shows: pr21508.c.19.regmove: (note:HI 7 6 12 0 NOTE_INSN_FUNCTION_BEG) (insn:HI 12 7 13 0 (set (reg:DF 62) (mem/u/i:DF (symbol_ref/u:SI ("*.LC1") [flags 0x2]) [2 S8 A64])) 65 {*movdf_nointeger} (nil) (expr_list:REG_EQUAL (const_double:DF -2147483648 [0x80000000] 1.0e+0 [0x0.8p+1]) (nil))) in pr21508.c.22.lreg: (note:HI 7 6 12 0 NOTE_INSN_FUNCTION_BEG) (insn:HI 12 7 13 0 (set (reg:DF 62) (mem/u/i:DF (symbol_ref/u:SI ("*.LC1") [flags 0x2]) [2 S8 A64])) 65 {*movdf_nointeger} (nil) (nil)) However, compiling a simple program, such as: double test (double a) { return a + 1.0; } results in fld1 insn being used. REG_EQUAL notes are still present in lreg dump file: (note:HI 7 6 11 0 NOTE_INSN_FUNCTION_BEG) (insn:HI 11 7 12 0 (set (reg:DF 61) (mem/u/i:DF (symbol_ref/u:SI ("*.LC1") [flags 0x2]) [2 S8 A64])) 65 {*movdf_nointeger} (nil) (expr_list:REG_EQUAL (const_double:DF -2147483648 [0x80000000] 1.0e+0 [0x0.8p+1]) (nil))) On the mainline we get: subl $12, %esp fld1 faddl 16(%esp) fstpl (%esp) movl 4(%esp), %eax addl $12, %esp andl $-2147483648, %eax ret Which is optimial as there is no extra movl and there is fld1. |