public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-19398-1649@http.gcc.gnu.org/bugzilla/>]
* [Bug target/19398] New: Non-optimal code with cvttss2si
@ 2005-01-12 13:34 uros at kss-loka dot si
  2005-01-18 11:20 ` [Bug rtl-optimization/19398] secondary reloads don't consider "m" alternatives rth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: uros at kss-loka dot si @ 2005-01-12 13:34 UTC (permalink / raw)
  To: gcc-bugs

The testcase:
int test (float a) {
        return (a*a);
}

produces non-optimal asm code, when compiled with '-O2 -msse -mfpmath=387':
test:
        pushl  %ebp
        movl   %esp, %ebp
        subl   $4, %esp
        flds   8(%ebp)
        fmul   %st(0), %st
        fstps  -4(%ebp)
(*)     movss  -4(%ebp), %xmm0
(*)     cvttss2si       %xmm0, %eax
        leave
        ret

A cvttss2si insn could use memory input operand, so movss to %xmm0 is not
needed. Following RTL sequence is generated in ._.23.greg:

(insn 31 11 32 0 (set (mem:SF (plus:SI (reg/f:SI 6 bp)
                (const_int -4 [0xfffffffc])) [0 S4 A8])
        (reg/v:SF 8 st [orig:59 a ] [59])) 61 {*movsf_1} (nil)
    (nil))

(insn 32 31 12 0 (set (reg:SF 21 xmm0)
        (mem:SF (plus:SI (reg/f:SI 6 bp)
                (const_int -4 [0xfffffffc])) [0 S4 A8])) 61 {*movsf_1} (nil)
    (nil))

(insn:HI 12 32 16 0 (set (reg:SI 0 ax [60])
        (fix:SI (reg:SF 21 xmm0))) 112 {fix_truncsfsi_sse}
(insn_list:REG_DEP_TRUE 11 (nil))
    (nil))

It looks like gcc does not take into account the fact that cvttss2si can use
memory input operand.

-- 
           Summary: Non-optimal code with cvttss2si
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uros at kss-loka dot si
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2012-11-20 18:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19398-4@http.gcc.gnu.org/bugzilla/>
2012-10-27  8:14 ` [Bug rtl-optimization/19398] secondary reloads don't consider "m" alternatives ubizjak at gmail dot com
2012-11-13 18:34 ` ubizjak at gmail dot com
2012-11-20 18:03 ` uros at gcc dot gnu.org
2012-11-20 18:30 ` ubizjak at gmail dot com
     [not found] <bug-19398-1649@http.gcc.gnu.org/bugzilla/>
2006-10-21 19:27 ` uros at gcc dot gnu dot org
2005-01-12 13:34 [Bug target/19398] New: Non-optimal code with cvttss2si uros at kss-loka dot si
2005-01-18 11:20 ` [Bug rtl-optimization/19398] secondary reloads don't consider "m" alternatives rth at gcc dot gnu dot org
2005-01-18 12:22 ` uros at kss-loka dot si
2005-03-15 10:10 ` giovannibajo at libero dot it
2005-03-15 11:44 ` bernds_cb1 at t-online dot de
2005-03-15 12:23 ` giovannibajo at libero dot it
2005-03-15 12:35 ` uros at kss-loka dot si
2005-08-01 18:46 ` dalej at gcc dot gnu dot org
2005-08-08  9:58 ` bonzini at gcc dot gnu dot org
2005-08-08 10:17 ` bonzini at gcc dot 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).