Tag: arm

iPhone/iPad double precision math

The accepted answer to this Community Wiki question: What are best practices that you use when writing Objective-C and Cocoa? says that iPhones can’t do double precision math (or rather, they can, but only emulated in software.) Unfortunately the 2009 link it provides as a reference: Double vs float on the iPhone directly contradicts that […]

Wrong method implementation address from otool for armv7?

I’m constantly getting 1 byte offset for implementation address of method shown by ‘otool‘. For an example ‘otool -o’ gives 0xe99d5 but ‘otool -tvV’ gives: +[NSError(SomeCategory) someMethod]: 000e99d4 b590 push {r4, r7, lr} 000e99d6 f6441184 movw r1, 0x4984 000e99da af01 add r7, sp, #4 000e99dc f2c0010a movt r1, 0xa So method starts at 0xe99d4. 0xe99d5 […]

Could use some clarification on arm architecture settings in Xcode

From what I’ve read, the iPhone 5 will use a new architecture, armv7s. My project had valid architectures as armv7, and had Build Active Architecture Only set to true. Since every app in the store right now is built for armv6 and/or armv7, I can’t imagine that it will not run on the new iPhone. […]

How to deal with compiler optimization problems

I’m having an annoying problem with my iPhone app. Whenever I set the optimization level to something other than “None”, I get computation errors. This only happens in when building for the iPhone SDK (the iPhone Simulator is always fine). I wouldn’t mind disabling optimizations in release mode, but the application is a tiny bit […]

How to link iPad Air app (arm64) against existing armv7 static libraries?

I have compiled armv7 static libraries (lib*.a) and i’m going to compile iPad Air app (arm64). I’m getting linker warning and then linker error: $ lipo -info /Users/user/Documents/dev/src/iOS_Projects/iProject/libMyLib.a input file /Users/user/Documents/dev/src/iOS_Projects/iProject/libMyLib.a is not a fat file Non-fat file: /Users/user/Documents/dev/src/iOS_Projects/iProject/libMyLib.a is architecture: armv7 Ld: warning: ignoring file /Users/user/Documents/dev/src/iOS_Projects/iProject/libMyLib.a, file was built for archive which is not […]

False positive: Undefined or garbage value returned to caller

The following code populates a result using inline assembly: uint64_t Foo::f() { uint64_t result; asm volatile (“vldmia %1, {q0-q1} \n” // q0-1 = *this ⋮ “vstmia %0, {d0} \n” // result = d0 :: “r”(&result), “r”(this) : “q0”, “q1”); return result; } The result variable is unconditionally set in the assembly code, but Xcode’s Analyzer […]

How do I use the ARM assembler in XCode?

Just for educational purposes, I would like to add a function to an existing iPhone app, written in ARM assembly. I don’t need a tutorial on ARM assembly in general, because I already read too many of them. I just don’t know how to actually run the code! What I would like to do is […]

Optimizing RGBA8888 to RGB565 conversion with NEON

I’m trying to optimize an image format conversion on iOS using the NEON vector instruction set. I assumed this would map well to that because it processes a bunch of similar data. My attempts haven’t gone that well, though, achieving only a marginal speedup vs the naive c implementation: for(int i = 0; i < […]

Mixing ARM and THUMB instructions

I am trying to mix ARM and THUMB instructions in my assembly code. For example, in the following code I try to use both modes: .thumb @ .code 16 .section __TEXT,__text .globl mySymbol1 mySymbol1: …. .arm @ .code 32 .section __TEXT,__text .globl mySymbol2 mySymbol2: … Now, as per my understanding when I compile this code […]

is char signed or unsigned by default on iOS?

Is char signed or unsigned by default on iOS? (I thought this would’ve been a well answered question, but oddly google turned up nothing at all useful!)