Android/ARM codegen

Dan Olson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon Aug 3 22:12:50 PDT 2015


"Joakim" <dlang at joakim.fea.st> writes:

> On Friday, 17 July 2015 at 17:57:01 UTC, Joakim wrote:
>> On Friday, 17 July 2015 at 16:33:07 UTC, Dan Olson wrote:
>>> "Joakim" <dlang at joakim.fea.st> writes:
>
> Dan, as I said in the main forum, most of the druntime/phobos modules'
> tests pass on Android/ARM now.  However, I had to turn off
> optimizations for a handful of modules, have you had to do the same?
> As noted before, one optimization pass was screwing up ldc.eh.  I also
> had to turn off all optimizations, ie -O0, for std.random and
> std.stream to get their unit tests to pass.  For one phobos module,
> std.regex, turning off all optimizations for druntime's core.memory
> got the regex tests to pass.
>
> Other than those four modules, everything is compiled with -O3 and
> seems to work, except for the two modules that still segfault,
> std.net.isemail and std.regex.internal.tests, where compiling those
> modules with -O0 doesn't make a difference.  I haven't spent any time
> tracking down if other optimized modules might be causing those two to
> segfault, as was the case with std.regex and core.memory, or exactly
> which llvm optimizations are causing problems with core.memory,
> std.random, and std.stream.
>
> Are you seeing similar results with your 2.067 branch of ldc with iOS?
> Since ARM codegen should be similar for the two, I wonder if I'm the
> only one seeing this.

Hi Joakim - I have -O3 optimization on for all modules in the release
build and I think I have tested with most of the other -O levels.  I did
run into an alignment error with neon instructions in std.random
unittest with LLVM 3.5.1 and 0.15.1 (2.066) and eventually disabled neon
(-mattr=-neon) during optimization as a workaround.  I have not tried
reenabling neon for merge-2.067 and LLVM 3.6.

The problem was a vst1.64 instruction requesting 128-bit alignment when
the data was only 64-bit aligned:

0x52197a:  vst1.64 {d16, d17}, [r5:128]  // r5 addr not properly aligned

If it can happen in std.random it could happen elsewhere.

You might try -mattr=-neon and see what happens.

One other difference to think about is that Android is AAPCS and iOS is
a variant of the older APCS.  LLVM has some different paths for these.
I studied it some a few weeks ago as I made the extern(C) ABI compatible
with clang.
-- 
Dan


More information about the digitalmars-d-ldc mailing list