[Bug target/56102] New: Wrong rtx cost calculated for Thumb1
amker.cheng at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 25 03:40:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56102
Bug #: 56102
Summary: Wrong rtx cost calculated for Thumb1
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: amker.cheng@gmail.com
For below program:
double g = 1.0;
double func(int a, double d)
{
if (a > 0)
return 0.0 + g;
else
return 2.0 + d;
}
compiling with:
./arm-none-eabi-gcc -mthumb -mcpu=cortex-m0 -Os test.c -S -o test.S
The assembly code is:
.cpu cortex-m0
.fpu softvfp
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 4
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.code 16
.file "main.c"
.global __aeabi_dadd
.text
.align 1
.global func
.code 16
.thumb_func
.type func, %function
func:
push {r3, lr}
cmp r0, #0
ble .L2
ldr r3, .L6+16
ldr r0, [r3]
ldr r1, [r3, #4]
ldr r3, .L6+4
ldr r2, .L6
b .L4
.L2:
mov r0, r2
mov r1, r3
ldr r2, .L6+8
ldr r3, .L6+12
.L4:
bl __aeabi_dadd
@ sp needed
pop {r3, pc}
.L7:
.align 3
.L6:
.word 0
.word 0
.word 0
.word 1073741824
.word .LANCHOR0
.size func, .-func
.global g
.data
.align 3
.set .LANCHOR0,. + 0
.type g, %object
.size g, 8
g:
.word 0
.word 1072693248
.ident "GCC: (GNU) 4.8.0 20130122 (experimental)"
The problem is double word constant isn't split by GCC, causing bigger code
size.
More information about the Gcc-bugs
mailing list