This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-conversion] Make double_int a class with methods and operators. (issue6443093)


Richard Guenther <richard.guenther@gmail.com> writes:
>>>> Constructors are allowed, but PODs are often passed more efficiently.
>>>> That property seemed particularly important for double_int.
>>>
>>> Show us the difference in timing.  Show us the generated code.  I
>>> can't imagine that it could ever matter.
>>
>> I'm also curious about that statement...  PODs don't really seem to
>> offer much advantage with modern compilers, except in a few very
>> specific cases (of which this doesn't seem to be one), e.g. in unions.
>
> They make a difference for the by-value passing ABI.  double-ints can
> be passed in two registers on most platforms.

Sure, but that doesn't seem to depend on PODness -- non-PODs can be
passed in two registers as well, AFAICS...

E.g., in the following:

   typedef long valtype;

   struct X { valtype x, y; };
   struct Y { Y (valtype a, valtype b) : x (a), y (b) { } valtype x, y; };

   extern void fx (X x);
   void test_x () {X x = { 1, 2 }; fx (x); }

   extern void fy (Y y);
   void test_y () {Y y (1, 2); fy (y); }

test_x and test_y use exactly the same calling sequence (and contain
exactly the same assembly code)...  [on x86-64]

Thanks,

-miles

-- 
80% of success is just showing up.  --Woody Allen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]