Bug 54378 - code bloat for long << shifts
Summary: code bloat for long << shifts
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2012-08-26 13:03 UTC by Georg-Johann Lay
Modified: 2012-08-26 13:06 UTC (History)
1 user (show)

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-08-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2012-08-26 13:03:54 UTC
Something goes woring with cost computaton fir shifts:

long ashl32_7 (long x)
{
    return x << 7;
}

compiled with -O2 -dp -mmcu=atmega8 -S -fno-split-wide-types
results in


ashl32_7:
/* DEBUG: cost = 32.  */
	lsl r22	 ;  27	*ashlsi3_const/4	[length = 8]
	rol r23
	rol r24
	rol r25
	lsl r22
	rol r23
	rol r24
	rol r25
/* DEBUG: cost = 32.  */
	lsl r22	 ;  28	*ashlsi3_const/4	[length = 8]
	rol r23
	rol r24
	rol r25
	lsl r22
	rol r23
	rol r24
	rol r25
/* DEBUG: cost = 32.  */
	lsl r22	 ;  29	*ashlsi3_const/4	[length = 8]
	rol r23
	rol r24
	rol r25
	lsl r22
	rol r23
	rol r24
	rol r25
/* DEBUG: cost = 16.  */
	lsl r22	 ;  30	*ashlsi3_const/2	[length = 4]
	rol r23
	rol r24
	rol r25
/* DEBUG: pattern-cost = 4.  */
	ret	 ;  26	return	[length = 1]


The insns are already there at .expand
Comment 1 Georg-Johann Lay 2012-08-26 13:06:28 UTC
... 3 typo in 2 words

Something goes wrong with cost computation for shifts