Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 3, 2013, 10:06 AM   #26
Q-chan
macrumors member
 
Join Date: Nov 2009
Location: Boston, MA, USA
asm need is not only for speed...

Thank you, "gnasher729" for your hints. I'm struggling similarly like "Elhardt" with inline asm, but for a different reason: Porting a large C++ system that uses atomic instructions for synchronization to MacOS. And until C++11 is fully and consistently implemented by all major compilers and on all major platforms, inline asm is the only portable option (requiring just very few hardware-specific variations). Setting-up Xcode for this is just painful.
Q-chan is offline   0 Reply With Quote
Old Oct 3, 2013, 10:40 AM   #27
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by Q-chan View Post
Thank you, "gnasher729" for your hints. I'm struggling similarly like "Elhardt" with inline asm, but for a different reason: Porting a large C++ system that uses atomic instructions for synchronization to MacOS. And until C++11 is fully and consistently implemented by all major compilers and on all major platforms, inline asm is the only portable option (requiring just very few hardware-specific variations). Setting-up Xcode for this is just painful.
See libkern/OSAtomic.h

Inline assembler is _not_ an option at all. This stuff is complicated. The functions in OSAtomic.h use different implementations at runtime depending on exactly which processor they are running on. I haven't checked it, but I wouldn't be surprised if you get the new Haswell features for much faster atomic operations in the non-conflicting case if you run on a Haswell processor.
gnasher729 is offline   0 Reply With Quote
Old Oct 4, 2013, 10:50 AM   #28
sgorozco
macrumors newbie
 
Join Date: Oct 2013
Please keep us Informed :)

Hello Elhardt!

I'm also looking for a straightforward way to add an Arm-assembler algorithm (already working in Android) to our iOs port, currently being written in XCode5. This particular assembler core routine resulted in a 25x increase from our C optimized version, so I really value your rationale and defense for well-tuned hand-crafted assembly code.

It was curious and very frustrating because after referencing the assembly language file, the compiler began spitting localised errors (mainly choking with the GCC style assembler directives and a refusal to use the LDR r, =32-bitconst pseudo-instruction.) This led me to believe that after fixing the syntax problems everything would be fine. Yet after fixing the last of these errors, a completely new batch of previously unreported errors, starting from the first uncommented assembly source code line, began to appear! In other words, the syntax was validated by some part of XCode, but then, a different layer completely refused to accept the syntax!


Please post if you succeed in your attempts. I'll do the same if I succeed in mine.

Cheers!
=)
sgorozco is offline   0 Reply With Quote
Old Oct 4, 2013, 05:01 PM   #29
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by sgorozco View Post
Hello Elhardt!

I'm also looking for a straightforward way to add an Arm-assembler algorithm (already working in Android) to our iOs port, currently being written in XCode5. This particular assembler core routine resulted in a 25x increase from our C optimized version, so I really value your rationale and defense for well-tuned hand-crafted assembly code.
Curious what you have been doing.
gnasher729 is offline   0 Reply With Quote
Old Oct 5, 2013, 02:10 AM   #30
firewood
macrumors 603
 
Join Date: Jul 2003
Location: Silicon Valley
Quote:
Originally Posted by gnasher729 View Post
Curious what you have been doing.
I've got ARM assembly code in a similar situation. It's very similar to the stuff that Apple hand-coded in their own Accelerate/vDSP/mathlib frameworks for iOS. Unfortunately, it's not exactly identical to what Apple provides, and is significantly slower in compiled C.
firewood is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Disable mail inline attachments LxHunter OS X Mavericks (10.9) 1 Nov 19, 2013 08:13 AM
No more inline PDF preview in Mail Supp0rtLinux Mac Applications and Mac App Store 0 Oct 30, 2013 02:56 PM
Inline Editing in new CKEditor ckeuser Web Design and Development 2 Dec 10, 2012 06:40 AM
XCode 4.2 and referencing external files BlinksTale Mac Programming 7 Nov 30, 2012 02:41 PM
Run executable from Xcode External Build System Project bogatyr Mac Programming 1 Jun 28, 2012 11:07 AM

Forum Jump

All times are GMT -5. The time now is 07:49 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC