help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C/C++ Extended Assembly Constraint Confusion


From: woessner
Subject: Re: C/C++ Extended Assembly Constraint Confusion
Date: Tue, 20 Mar 2012 11:19:16 -0700 (PDT)
User-agent: G2/1.0

On Monday, March 19, 2012 4:41:21 PM UTC-4, Jan Seiffert wrote:
> a) filter the const with an #ifndef __cplusplus

In terms of performance, I suppose making TWO_PI static is sufficient.  
However, that's very unsatisfying - it really should be const.

> b) ask the compiler to put the const into a xmm register for you, beware of
> clobbering it (you already did so with the "x" constrain for the other
> constants, so why not for this?)

This really shouldn't be necessary.  The andpd instruction can operate on a 
memory location.  So I'd rather not waste the register (and cycles) by loading 
a value that doesn't need to be loaded.

> c) does it help if you use the old extern-"C"-trick around the function?

No.  I suppose I could put the function in a separate file, compile it with gcc 
and link to it.  But that omits the possibility of inline-ing the function.

I can also use a const_cast to do away with the const-ness, but it generates 
the following warning: "use of memory input without lvalue in asm operand 3 is 
deprecated".  But at least it works.

Thanks,
Bill


reply via email to

[Prev in Thread] Current Thread [Next in Thread]