Consider the following:

  struct s { double x; double y; };

  double f(struct s s) { return s.x + s.y; }

When compiled with optimisation, this generates:

  f:
          movsd   %xmm1, -8(%rsp)
          addsd   %xmm1, %xmm0
          ret

What is the movsd doing here ?


-- 
           Summary: Useless move to memory when passing small structs to
                    functions
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jch at pps dot jussieu dot fr
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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

Reply via email to