SlideShare a Scribd company logo
Optimizing NDK projects
for multiple CPU architectures


       Alexander Weggerle
       Technical Consultant Engineer
       Intel Software and Services Group
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Introduction

• Performance critical apps are popular
 • Games
 • Real time multimedia
 • Augmented reality

• Users are sensitive
 • Don’t accept lags
 • Fluid animations
 • Minimal load time

                  Optimization is important


                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Compatibility

             “I want my app to run on all architectures”




• You already done for Java & HTML

• NDK based apps usually just needs a recompilation
          APP_ABI := all

                                                            Application.mk




                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Target compiler options

• NDK-build system Android.mk file evaluated for
  each architecture

• Variable TARGET_ARCH_ABI describes actual
  architecture

  TARGET_ARCH_ABI                                ifeq ($(TARGET_ARCH_ABI),x86)
                                                 LOCAL_CFLAGS     := -mtune=atom -mssse3
  x86                                            endif

  armeabi                                        ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
                                                 LOCAL_CFLAGS     := -march=armv7-a
  armeabi-v7a                                    Endif
  mips                                                                                  Android.mk




                       Copyright© 2012, Intel Corporation. All rights reserved.
                 *Other brands and names are the property of their respective owners.
Recommended Compiler options (x86)

• -mtune=atom
 • Out of Order scheduling

• -march=atom
 • movbe instruction
 • Code is only guaranteed to run on Atom.
   – Might not run on emulator or other CPUs

• -ansi-alias / -restrict / -no-prec-div




                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Multiple Code Paths

• Different reasons for multiple code paths
 • Optimizing for multiple architectures
 • Single Instruction Multiple Data (SIMD)
 • Assembly kernels
 • Memory alignment
 • Instruction set support




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Multiple Code Paths
Compiler macros
• Directly inside source code

• No runtime overhead

• Works with all build configurations
         #ifdef __i386__
                  strlcat(buf, "__i386__", sizeof(buf));
         #endif
         #ifdef __arm__
                  strlcat(buf, "__arm__", sizeof(buf));
         #endif
         #ifdef _MIPS_ARCH
                  strlcat(buf, "_MIPS_ARCH", sizeof(buf));
         #endif

                                                                                            source.c




                           Copyright© 2012, Intel Corporation. All rights reserved.
                     *Other brands and names are the property of their respective owners.
Multiple Code Paths
Make system
• Make system will select source file depending on
  architecture

• No runtime overhead

       arch_x86.cpp
       const char *getTarget ();


       arch_arm.cpp                             arch.h                                         cpufeaturestest.cpp
       const char *getTarget ();                const char *getTarget ();                      printf(“%s”, getTarget());

       arch_default.cpp
       const char *getTarget ();




                                         Copyright© 2012, Intel Corporation. All rights reserved.
                                   *Other brands and names are the property of their respective owners.
Multiple Code Paths
Cpufeatures API
• Checks for architecture and
  special CPU features

• Uses compiler macros +
  runtime detection internally
 • Small runtime overhead




                           Copyright© 2012, Intel Corporation. All rights reserved.
                     *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Porting Native (C/C++) Android* Apps to x86

http://software.intel.com/en-us/articles/ndk-android-application-porting-
methodologies/

            Native Apps
• Optimized NDK for Intel Atom based
  devices available on
  http://developer.android.com/sdk/nd
  k/index.html since July’11.
• For most apps, changing the make
  file and a recompile should be
  sufficient to port to Intel Atom
  devices.
• If ARM-specific features are used,
  Intel SSE equivalents should be
  added (build flag)
• Developer recompiles, re-packages
  and publishes.



                                  Copyright© 2012, Intel Corporation. All rights reserved.
                            *Other brands and names are the property of their respective owners.
ARM* NEON to Intel® SSE

• Single Instruction Multiple Data (SIMD)

• Most ARM NEON functions have a 1:1 equivalent in
  Intel® SSE

• Intel provides C++ header file to do the mapping
        // VADD.I8 d0,d0,d0
 int8x8_t    vadd_s8(int8x8_t a, int8x8_t b);
 #ifdef USE_MMX
        #define vadd_s8 _mm_add_pi8   //MMX
 #else
        #define vadd_s8 _mm_add_epi8
 #endif

                                                                                          neonvssse.h


                         Copyright© 2012, Intel Corporation. All rights reserved.
                   *Other brands and names are the property of their respective owners.
Differences between ARM and x86
Alignment
• ARM uses aligned, x86 uses packed memory

  struct TestStruct
                                                                           ARM
  {
     int mVar1;
     long long mVar2;
     int mVar3;
  };
                                                                            x86




• Compiler parameter helps to workaround
  -malign-double




                              Copyright© 2012, Intel Corporation. All rights reserved.
                        *Other brands and names are the property of their respective owners.
Agenda

• Compatibility

• Compiler options

• Code paths

• Differences between ARM and x86

• Publishing




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Market
Fat binary
• Include all binaries into one apk
                                                libs/armeabi
       Source


                 ndk-build                                                         apkbuilder

                                              libs/armeabi-
                                                    v7a                                         …



                                                    libs/x86




• Device removes incompatible libs at installation

                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Market
Multiple APKs
• Support for different …
 • Texture formats
 • Screen sizes and densities
 • Platform versions
 • CPU architectures

• Saves bandwidth and space while installation




                        Copyright© 2012, Intel Corporation. All rights reserved.
                  *Other brands and names are the property of their respective owners.
Conclusion & Call to action

• NDK provides plenty of mechanisms to
  differentiate between architectures

• Recompile your NDK based app with
  APP_ABI := all




                      Copyright© 2012, Intel Corporation. All rights reserved.
                *Other brands and names are the property of their respective owners.
21
Legal Disclaimer & Optimization Notice

        INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY
        ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS
        DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR
        IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES
        RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY
        PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.

        Software and workloads used in performance tests may have been optimized for performance only on
        Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using
        specific computer systems, components, software, operations and functions. Any change to any of
        those factors may cause the results to vary. You should consult other information and performance
        tests to assist you in fully evaluating your contemplated purchases, including the performance of that
        product when combined with other products.

        Copyright © , Intel Corporation. All rights reserved. Intel, the Intel logo, Xeon, Core, VTune, and Cilk
        are trademarks of Intel Corporation in the U.S. and other countries.


             Optimization Notice
             Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that
             are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and
             other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on
             microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended
             for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for
             Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information
             regarding the specific instruction sets covered by this notice.
                                                                                                          Notice revision #20110804


22                                                                  Intel Confidential
                                                      Copyright© 2012, Intel Corporation. All rights reserved.
17.04.2013                                      *Other brands and names are the property of their respective owners.
Droidcon2013 ndk cpu_architecture_optimization_weggerle_intel

More Related Content

PDF
ARM and SoC Traning Part I -- Overview
PDF
Porting linux on ARM
PPT
Program development tools
PDF
Intel tools to optimize HPC systems
PDF
Methods and practices to analyze the performance of your application with Int...
PDF
AFDS 2011 Phil Rogers Keynote: “The Programmer’s Guide to the APU Galaxy.”
PDF
Android Optimization: Myth and Reality
PPTX
Using JavaScript to Build HTML5 Tools (Ian Maffett)
ARM and SoC Traning Part I -- Overview
Porting linux on ARM
Program development tools
Intel tools to optimize HPC systems
Methods and practices to analyze the performance of your application with Int...
AFDS 2011 Phil Rogers Keynote: “The Programmer’s Guide to the APU Galaxy.”
Android Optimization: Myth and Reality
Using JavaScript to Build HTML5 Tools (Ian Maffett)

What's hot (20)

PDF
Accelerated Android Development with Linaro
PDF
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
PDF
EclipseCon 2011: Deciphering the CDT debugger alphabet soup
PDF
Droid con 2012 bangalore v2.0
PPT
Arista @ HPC on Wall Street 2012
PPTX
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
PDF
Nvidia Cuda Apps Jun27 11
PDF
Guides To Analyzing WebKit Performance
PDF
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
KEY
Open source hardware and the web
PDF
резников дмитрий
PPTX
HSA Introduction Hot Chips 2013
PPTX
Understanding open max il
PDF
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
PDF
Develop Community-based Android Distribution and Upstreaming Experience
PDF
PPT
OpenMAX Overview
PPTX
Intel_Low Power Intelligent Solutions with Intel Atom Processor
PDF
Intel® Advanced Vector Extensions Support in GNU Compiler Collection
PDF
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Accelerated Android Development with Linaro
Intel® MPI Library e OpenMP* - Intel Software Conference 2013
EclipseCon 2011: Deciphering the CDT debugger alphabet soup
Droid con 2012 bangalore v2.0
Arista @ HPC on Wall Street 2012
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
Nvidia Cuda Apps Jun27 11
Guides To Analyzing WebKit Performance
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
Open source hardware and the web
резников дмитрий
HSA Introduction Hot Chips 2013
Understanding open max il
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Develop Community-based Android Distribution and Upstreaming Experience
OpenMAX Overview
Intel_Low Power Intelligent Solutions with Intel Atom Processor
Intel® Advanced Vector Extensions Support in GNU Compiler Collection
Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Ad

Viewers also liked (9)

PPTX
Microwave Devices Lecture08
PPTX
Dvortsov A. V., "Resonance Method of Measuring a Stuff Dielectric Properties ...
PDF
DIC_video_coding_standards_07
PDF
A review of temperature compensation techniques 2014 lisi_v01
PDF
Android programming -_pushing_the_limits
PPT
Ibtc dwt hybrid coding of digital images
PDF
crashing in style
PDF
Reborn Digital: coding text
PDF
Droidcon de 2014 google cast
Microwave Devices Lecture08
Dvortsov A. V., "Resonance Method of Measuring a Stuff Dielectric Properties ...
DIC_video_coding_standards_07
A review of temperature compensation techniques 2014 lisi_v01
Android programming -_pushing_the_limits
Ibtc dwt hybrid coding of digital images
crashing in style
Reborn Digital: coding text
Droidcon de 2014 google cast
Ad

Similar to Droidcon2013 ndk cpu_architecture_optimization_weggerle_intel (20)

PDF
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
PDF
Android on IA devices and Intel Tools
PDF
Android OS Porting: Introduction
PDF
MeeGo Overview DeveloperDay Munich
PPTX
Multi-OS Engine Technology Overview
PDF
Running native code on Android #OSDCfr 2012
PDF
Utilisation des capteurs dans les applications windows 8
PDF
Android NDK and the x86 Platform
PDF
Porting Android
PDF
Porting Android ABS 2011
PDF
Porting Android
PDF
Intel AppUp™ SDK Suite 1.2 for MeeGo
PDF
Developing Multi-OS Native Mobile Applications with Intel INDE
PDF
Mobile operating systems - Application Benchmarking
PDF
Discover System Facilities inside Your Android Phone
PPTX
Android Native Apps Development
PDF
Android Internals
PDF
Android Attacks
PDF
Understanding the Dalvik Virtual Machine
PDF
Simulation Directed Co-Design from Smartphones to Supercomputers
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
Android on IA devices and Intel Tools
Android OS Porting: Introduction
MeeGo Overview DeveloperDay Munich
Multi-OS Engine Technology Overview
Running native code on Android #OSDCfr 2012
Utilisation des capteurs dans les applications windows 8
Android NDK and the x86 Platform
Porting Android
Porting Android ABS 2011
Porting Android
Intel AppUp™ SDK Suite 1.2 for MeeGo
Developing Multi-OS Native Mobile Applications with Intel INDE
Mobile operating systems - Application Benchmarking
Discover System Facilities inside Your Android Phone
Android Native Apps Development
Android Internals
Android Attacks
Understanding the Dalvik Virtual Machine
Simulation Directed Co-Design from Smartphones to Supercomputers

More from Droidcon Berlin (20)

PDF
Raspberry Pi
PDF
Android industrial mobility
PDF
Details matter in ux
PDF
From sensor data_to_android_and_back
PDF
droidparts
PDF
new_age_graphics_android_x86
PDF
5 tips of monetization
PDF
Testing and Building Android
PDF
Matchinguu droidcon presentation
PDF
Cgm life sdk_droidcon_2014_v3
PDF
The artofcalabash peterkrauss
PDF
Raesch, gries droidcon 2014
PDF
Android open gl2_droidcon_2014
PDF
20140508 quantified self droidcon
PDF
Tuning android for low ram devices
PDF
Froyo to kit kat two years developing & maintaining deliradio
PDF
Droidcon2013 security genes_trendmicro
PDF
Droidcon2013 commercialsuccess rannenberg
PDF
Droidcon2013 bootstrap luedeke
PDF
Droidcon2013 app analytics_huber_1und1
Raspberry Pi
Android industrial mobility
Details matter in ux
From sensor data_to_android_and_back
droidparts
new_age_graphics_android_x86
5 tips of monetization
Testing and Building Android
Matchinguu droidcon presentation
Cgm life sdk_droidcon_2014_v3
The artofcalabash peterkrauss
Raesch, gries droidcon 2014
Android open gl2_droidcon_2014
20140508 quantified self droidcon
Tuning android for low ram devices
Froyo to kit kat two years developing & maintaining deliradio
Droidcon2013 security genes_trendmicro
Droidcon2013 commercialsuccess rannenberg
Droidcon2013 bootstrap luedeke
Droidcon2013 app analytics_huber_1und1

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Modernizing your data center with Dell and AMD
PDF
Encapsulation_ Review paper, used for researhc scholars
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Big Data Technologies - Introduction.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Modernizing your data center with Dell and AMD
Encapsulation_ Review paper, used for researhc scholars
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Big Data Technologies - Introduction.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Droidcon2013 ndk cpu_architecture_optimization_weggerle_intel

  • 1. Optimizing NDK projects for multiple CPU architectures Alexander Weggerle Technical Consultant Engineer Intel Software and Services Group
  • 2. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 3. Introduction • Performance critical apps are popular • Games • Real time multimedia • Augmented reality • Users are sensitive • Don’t accept lags • Fluid animations • Minimal load time Optimization is important Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 4. Compatibility “I want my app to run on all architectures” • You already done for Java & HTML • NDK based apps usually just needs a recompilation APP_ABI := all Application.mk Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 5. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 6. Target compiler options • NDK-build system Android.mk file evaluated for each architecture • Variable TARGET_ARCH_ABI describes actual architecture TARGET_ARCH_ABI ifeq ($(TARGET_ARCH_ABI),x86) LOCAL_CFLAGS := -mtune=atom -mssse3 x86 endif armeabi ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) LOCAL_CFLAGS := -march=armv7-a armeabi-v7a Endif mips Android.mk Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 7. Recommended Compiler options (x86) • -mtune=atom • Out of Order scheduling • -march=atom • movbe instruction • Code is only guaranteed to run on Atom. – Might not run on emulator or other CPUs • -ansi-alias / -restrict / -no-prec-div Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 8. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 9. Multiple Code Paths • Different reasons for multiple code paths • Optimizing for multiple architectures • Single Instruction Multiple Data (SIMD) • Assembly kernels • Memory alignment • Instruction set support Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 10. Multiple Code Paths Compiler macros • Directly inside source code • No runtime overhead • Works with all build configurations #ifdef __i386__ strlcat(buf, "__i386__", sizeof(buf)); #endif #ifdef __arm__ strlcat(buf, "__arm__", sizeof(buf)); #endif #ifdef _MIPS_ARCH strlcat(buf, "_MIPS_ARCH", sizeof(buf)); #endif source.c Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 11. Multiple Code Paths Make system • Make system will select source file depending on architecture • No runtime overhead arch_x86.cpp const char *getTarget (); arch_arm.cpp arch.h cpufeaturestest.cpp const char *getTarget (); const char *getTarget (); printf(“%s”, getTarget()); arch_default.cpp const char *getTarget (); Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 12. Multiple Code Paths Cpufeatures API • Checks for architecture and special CPU features • Uses compiler macros + runtime detection internally • Small runtime overhead Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 13. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 14. Porting Native (C/C++) Android* Apps to x86 http://software.intel.com/en-us/articles/ndk-android-application-porting- methodologies/ Native Apps • Optimized NDK for Intel Atom based devices available on http://developer.android.com/sdk/nd k/index.html since July’11. • For most apps, changing the make file and a recompile should be sufficient to port to Intel Atom devices. • If ARM-specific features are used, Intel SSE equivalents should be added (build flag) • Developer recompiles, re-packages and publishes. Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 15. ARM* NEON to Intel® SSE • Single Instruction Multiple Data (SIMD) • Most ARM NEON functions have a 1:1 equivalent in Intel® SSE • Intel provides C++ header file to do the mapping // VADD.I8 d0,d0,d0 int8x8_t vadd_s8(int8x8_t a, int8x8_t b); #ifdef USE_MMX #define vadd_s8 _mm_add_pi8 //MMX #else #define vadd_s8 _mm_add_epi8 #endif neonvssse.h Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 16. Differences between ARM and x86 Alignment • ARM uses aligned, x86 uses packed memory struct TestStruct ARM { int mVar1; long long mVar2; int mVar3; }; x86 • Compiler parameter helps to workaround -malign-double Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 17. Agenda • Compatibility • Compiler options • Code paths • Differences between ARM and x86 • Publishing Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 18. Market Fat binary • Include all binaries into one apk libs/armeabi Source ndk-build apkbuilder libs/armeabi- v7a … libs/x86 • Device removes incompatible libs at installation Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 19. Market Multiple APKs • Support for different … • Texture formats • Screen sizes and densities • Platform versions • CPU architectures • Saves bandwidth and space while installation Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 20. Conclusion & Call to action • NDK provides plenty of mechanisms to differentiate between architectures • Recompile your NDK based app with APP_ABI := all Copyright© 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
  • 21. 21
  • 22. Legal Disclaimer & Optimization Notice INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Software and workloads used in performance tests may have been optimized for performance only on Intel microprocessors. Performance tests, such as SYSmark and MobileMark, are measured using specific computer systems, components, software, operations and functions. Any change to any of those factors may cause the results to vary. You should consult other information and performance tests to assist you in fully evaluating your contemplated purchases, including the performance of that product when combined with other products. Copyright © , Intel Corporation. All rights reserved. Intel, the Intel logo, Xeon, Core, VTune, and Cilk are trademarks of Intel Corporation in the U.S. and other countries. Optimization Notice Intel’s compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 22 Intel Confidential Copyright© 2012, Intel Corporation. All rights reserved. 17.04.2013 *Other brands and names are the property of their respective owners.