Compile following function with options -Os -mthumb -march=armv5te
float return_zero()
{
return 0;
}
Gcc generates:
ldr r0, .L2
bx lr
.L3:
.align 2
.L2:
.word 0
Floating point 0 is also integer 0. So the function body can be simplified as
mov r0, 0
bx lr
Now we can remove the memory load and constant pool. The result code is smaller
and faster.
The memory load and constant pool is expanded in pass machine_reorg.
--
Summary: Load floating point constant 0 directly
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: carrot at google dot com
GCC build triplet: i686-linux
GCC host triplet: i686-linux
GCC target triplet: arm-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40670