[PATCH] Add optimization flags for ARM926EJ-S

Boris Ulasevich boris.ulasevich at bell-sw.com
Wed Nov 14 13:59:21 UTC 2018


Hi Jakub,

On 13.11.2018 21:04, Jakub Vaněk wrote:
> Hi Boris,
> 
> (1) I can try to measure the load time for java -version. I guess the
> best way to benchmark it would be JMH, but I'm not sure where the
> effect would be the biggest (this is more or less a premature
> optimization).
> (2) I don't think they are widely used nowadays. Texas Instruments has
> these cores in some of their old SoCs:
> http://processors.wiki.ti.com/index.php/ARM9 . Yes, this flag would
> benefit only this particular ARM core.
> (3) We did this because the FLAGS_SETUP_ASFLAGS_CPU_DEP macro was
> moved here. EXTRA_CFLAGS is added to ASFLAGS too, but according to the
> comment inside it is a misuse to preserve backwards compatibility.

I mean that you set -mcpu flag in both flags.m4 and flags-other.m4.
It looks excessively, and, as I can see, it is not common to set
such flags in flags-other.m4.

> However, I have found a different reason why I used this patch back in
> the day. I tried to compile OpenJDK with just arm-sflt and it failed
> with the following error:

They say "PLD is available in ARMv6 and above, and E variants of ARMv5"!

> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s: Assembler messages:
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:83: Error:
> selected processor does not support `pld [from,#0]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:93: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:128: Error:
> selected processor does not support `pld [from,#0]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:141: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:166: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:174: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:212: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:226: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:280: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:318: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:331: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:389: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:446: Error:
> selected processor does not support `pld [from,#0]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:459: Error:
> selected processor does not support `pld [from]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:484: Error:
> selected processor does not support `pld [from,#-32]' in ARM mode
> /build/jdk/src/hotspot/os_cpu/linux_arm/linux_arm_32.s:492: Error:
> selected processor does not support `pld [from]' in ARM mode
> 
> I can redo the patch to remove the ARM926EJ-S specific bits and
> instead only supply -marm -march=armv5t or similar to the assembler
> when needed.
> 
> Thanks,
> Jakub
> 
> út 13. 11. 2018 v 11:15 odesílatel Boris Ulasevich
> <boris.ulasevich at bell-sw.com> napsal:
>>
>> Hi Jakub,
>>
>>     I am not against this patch, but I have a few concerns. (1) For me
>> motivation "might increase performance a little bit" is not quite clear.
>> It would be better to have some confidence. (2) Is the particular CPU
>> highly distributed? I am not sure anybody else will get benefit from
>> this change. (3) flags-other.m4 seems not to be a good place to setup
>> -mcpu details.
>>
>> thanks,
>> Boris
>>
>> On 13.11.2018 2:41, David Holmes wrote:
>>> Hi Jakub,
>>>
>>> Build file changes have to be reviewed on build-dev - cc'd.
>>>
>>> Thanks,
>>> David
>>>
>>> On 13/11/2018 8:57 AM, Jakub Vaněk wrote:
>>>> Hi,
>>>>
>>>> This patch adds a new ARM ABI option for ARM926EJ-S. The reason is not
>>>> because of ABI breakage, but it is because of GCC -mcpu flags
>>>> specifically for this CPU. We think that this might increase
>>>> performance a little bit. However, we do not have numbers for this.
>>>> Alternatively, we may just stick to the arm-sflt ABI option.
>>>>
>>>> This patch was successfully built with a few other independent patches
>>>> here: https://ci.adoptopenjdk.net/view/ev3dev/ ;
>>>> https://github.com/ev3dev-lang-java/openjdk-ev3
>>>> We haven't run full jtreg tests on the target platform yet, but Juan
>>>> Antonio Brena Moral invested his time into Adopt's openjdktests in
>>>> QEMU. Also, the JVM seems to run fine on the ARM board itself.
>>>>
>>>> Regards,
>>>>
>>>> Jakub Vanek (with credit to Juan Antonio)
>>>>
>>>> # HG changeset patch
>>>> # User Jakub Vaněk <linuxtardis at gmail.com>
>>>> # Date 1542060149 -3600
>>>> #      Mon Nov 12 23:02:29 2018 +0100
>>>> # Node ID 82c5c630ee8f9237b533ba6414143d109dec0180
>>>> # Parent  a609d549992a4d094a514a6c0f5b79443192d8bf
>>>> Add optimization flags for ARM926EJ-S
>>>>
>>>> diff --git a/make/autoconf/flags-other.m4 b/make/autoconf/flags-other.m4
>>>> --- a/make/autoconf/flags-other.m4
>>>> +++ b/make/autoconf/flags-other.m4
>>>> @@ -119,6 +119,10 @@
>>>>      # Misuse EXTRA_CFLAGS to mimic old behavior
>>>>      $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
>>>>
>>>> +  if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm926ejs; then
>>>> +    $2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS -mcpu=arm926ej-s"
>>>> +  fi
>>>> +
>>>>      AC_SUBST($2JVM_ASFLAGS)
>>>>    ])
>>>>
>>>> diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
>>>> --- a/make/autoconf/flags.m4
>>>> +++ b/make/autoconf/flags.m4
>>>> @@ -34,7 +34,7 @@
>>>>    AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
>>>>    [
>>>>      AC_ARG_WITH(abi-profile, [AS_HELP_STRING([--with-abi-profile],
>>>> -      [specify ABI profile for ARM builds
>>>> (arm-vfp-sflt,arm-vfp-hflt,arm-sflt,
>>>> armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain dependent@:>@
>>>> ])])
>>>> +      [specify ABI profile for ARM builds
>>>> (arm-vfp-sflt,arm-vfp-hflt,arm-sflt,
>>>> arm926ejs,armv5-vfp-sflt,armv6-vfp-hflt,aarch64) @<:@toolchain
>>>> dependent@:>@ ])])
>>>>
>>>>      if test "x$with_abi_profile" != x; then
>>>>        if test "x$OPENJDK_TARGET_CPU" != xarm && \
>>>> @@ -55,6 +55,9 @@
>>>>        elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-sflt; then
>>>>          ARM_FLOAT_TYPE=sflt
>>>>          ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
>>>> +    elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm926ejs; then
>>>> +      ARM_FLOAT_TYPE=sflt
>>>> +      ARM_ARCH_TYPE_FLAGS='-mcpu=arm926ej-s -marm'
>>>>        elif test "x$OPENJDK_TARGET_ABI_PROFILE" = xarmv5-vfp-sflt; then
>>>>          ARM_FLOAT_TYPE=vfp-sflt
>>>>          ARM_ARCH_TYPE_FLAGS='-march=armv5t -marm'
>>>>


More information about the build-dev mailing list