Using floating point instructions

2016-12-06 Thread G 3
I'm working on a program that calls PowerPC assembly floating point  
instructions from C. It would have calls like this:


double inputA, inputB, answer;
asm volatile("fadd %0, %1, %2" : "=f" (answer) : "f" (inputA),  
"f" (inputB));   // answer = inputA + inputB


The odd thing is it only works in the debug configuration in XCode.  
In Release configuration, I see this error:

error: output constraint 0 must specify a single register
error: output operand 0 must use '&' constraint

Is there a way to fix this problem?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Using floating point instructions

2016-12-06 Thread G 3


On Dec 6, 2016, at 4:41 PM, Greg Parker wrote:




On Dec 6, 2016, at 7:27 AM, G 3  wrote:

I'm working on a program that calls PowerPC assembly floating  
point instructions from C. It would have calls like this:


double inputA, inputB, answer;
asm volatile("fadd %0, %1, %2" : "=f" (answer) : "f" (inputA),  
"f" (inputB));   // answer = inputA + inputB


The odd thing is it only works in the debug configuration in  
XCode. In Release configuration, I see this error:

error: output constraint 0 must specify a single register
error: output operand 0 must use '&' constraint

Is there a way to fix this problem?


You'll get better answers from a clang list such as cfe- 
us...@lists.llvm.org. Most of the audience here probably does not  
have a copy of clang that can compile PowerPC code.


Why are you using constraint "f" here? I would expect you to use  
"d" with variables of type double.


I did a little experiment and tried this: asm volatile("fadd %0, %1, % 
2" : "=f" (answer) : "d" (inputA), "f" (inputB));


It didn't work. This is the error message I saw: error: impossible  
constraint in 'asm'.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com