[Bug ada/53590] new compiler generates both SISD and SIMD instructions for parallel operations of a "pure" function

bauhaus at futureapps dot de gcc-bugzilla@gcc.gnu.org
Wed Jun 6 13:29:00 GMT 2012


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

--- Comment #1 from Georg Bauhaus <bauhaus at futureapps dot de> 2012-06-06 13:29:36 UTC ---
For comparison, consider this, giving expected results (1 DIVPD).

-- 8< --

typedef double fpt;

typedef fpt Vec[2];
struct ArrayWrap {
  Vec _;
};


struct ArrayWrap f (fpt x0, fpt x1, fpt y0, fpt y1) {
    return (struct ArrayWrap) { ._ = { x0 / y0, x1 / y1 } };
}

-- >8 --

(The corresponding Ada is

   type ArrayWrap is record
      Data : Vec;
   end record;

(and

   function F (X0, X1, Y0, Y1 : Fpt) return ArrayWrap is
   begin
      return (Data => (X0 / Y0, X1 / Y1));
   end F;

giving the same results as originally reported, i.e. two DIVSD and
in addition one DIVPD.)

The C compiler (from the same build), when run with the same options,

$ gcc -c -W -O3 -fno-inline -fomit-frame-pointer -msse3 -mfpmath=sse
-march=core2 autovect.c

produces

0000000000000000 <f>:
   0:    66 0f 14 c1              unpcklpd %xmm1,%xmm0
   4:    66 0f 14 d3              unpcklpd %xmm3,%xmm2
   8:    66 0f 5e c2              divpd  %xmm2,%xmm0
   c:    66 0f 29 44 24 e8        movapd %xmm0,-0x18(%rsp)
  12:    f2 0f 10 4c 24 f0        movsd  -0x10(%rsp),%xmm1
  18:    f2 0f 10 44 24 e8        movsd  -0x18(%rsp),%xmm0
  1e:    c3                       retq 

Which has one DIVPD, as expected.



More information about the Gcc-bugs mailing list