Arm Community
Site
Search
User
Site
Search
User
Groups
Research Collaboration and Enablement
DesignStart
Education Hub
Innovation
Open Source Software and Platforms
Forums
AI and ML forum
Architectures and Processors forum
Arm Development Platforms forum
Arm Development Studio forum
Arm Virtual Hardware forum
Automotive forum
Compilers and Libraries forum
Graphics, Gaming, and VR forum
High Performance Computing (HPC) forum
Infrastructure Solutions forum
Internet of Things (IoT) forum
Keil forum
Morello Forum
Operating Systems forum
SoC Design and Simulation forum
中文社区论区
Blogs
AI and ML blog
Announcements
Architectures and Processors blog
Automotive blog
Graphics, Gaming, and VR blog
High Performance Computing (HPC) blog
Infrastructure Solutions blog
Innovation blog
Internet of Things (IoT) blog
Operating Systems blog
Research Articles
SoC Design and Simulation blog
Tools, Software and IDEs blog
中文社区博客
Support
Arm Support Services
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Support forums
Arm Development Studio forum
ARM CORTEX A8 : use of fpack-struct compiler directive
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
121 subscribers
Views
2792 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
ARM CORTEX A8 : use of fpack-struct compiler directive
Offline
shashikumar MS
over 9 years ago
Note: This was originally posted on 27th May 2009 at
http://forums.arm.com
Hi,
I am compiling an application with arm linux gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126) with the compiler directive's.
I want to optimize this application for the ARM and I am not suppose to use DSP.
[font="Courier New"]
arm-linux-gcc ../Src/*.c ../Src/SimdFunctions.s ../Src/getRectSubPix.s -DOPT_WIN_SIZE -DENABLE_SIMD_GETRECTSUBPIX -DUSE_SIMD -DUSE_SIMD_DAVID -I ../Inc -mcpu=cortex-a8 -mfpu=neon -Wa,-mfpu=neon -mfloat-abi=softfp -o ../Obj/opt_blink.out -O3 -fpack-struct -freorder-blocks-and-partition -lm -lc -lgcc -ftree-vectorize[/font]
after compilation total number of lines of assembly code generated is 35563.
If i remove the compiler directive -fpack-struct the total number of lines of assembly code is 22354.
I checked this by writing a small C program which updates the structure that consists of 3 integer elements. consider if i want to write 55, 66, 77 to these three elements then
with -fpack-sturct directive the program uses byte store to store 55, 66, 77 and then fills the remaining bytes with zeros which generates around 20 lines of assembly code
whereas without -fpack-sturct it writes directly to the location and the assembly generated is is of about 5 lines.
Also help me in any compilation directives to be given to optimize even more.
thanks and regards
Shashi
shashi.ms@samsung.com
Offline
Peter Harris
over 9 years ago
Note: This was originally posted on 27th May 2009 at
http://forums.arm.com
Packing data structures is one of those interesting areas of C which is really "interesting" on ARM, if only because the history of unaligned access support is so fragmented.
The GCC compiler assumes that unaligned access is not supported by default - so if you tell it all structures are packed it replaces neat word / halfword loads with individual byte loads and then assembles the result in registers. Consequently the amount of assembler you need goes up quite a lot.
I'm not aware of support in GCC for generating unaligned loads.
In general packing structures generates sub-optimal code - do you need to pack all of your structures?
Cancel
Up
0
Down
Cancel
Offline
shashikumar MS
over 9 years ago
Note: This was originally posted on 27th May 2009 at
http://forums.arm.com
Hi,
Thanks for the reply at the earliest.
I need not pack as most of the structures are defined in such a way that holes are not left in between.
we have done lots of c optimization in this application. are there any new compilation directives which can give more optimization for speed ?
Cancel
Up
0
Down
Cancel
Offline
Simon Craske
over 9 years ago
Note: This was originally posted on 27th May 2009 at
http://forums.arm.com
It may be worth seeing if ARM's RealView compiler can offer the performance you are after.
A free evaluation can be requested from [url="
http://www.arm.com/phpscripts/rvds_eval.php
"]
http://www.arm.com/phpscripts/rvds_eval.php[/url]
hth
s.
Cancel
Up
0
Down
Cancel