http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53976
Bug #: 53976
Summary: [SH] Unnecessary clrt after bt
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: target
AssignedTo: [email protected]
ReportedBy: [email protected]
Target: sh*-*-*
The following function
long long test (long long a, long long b, int c, int d)
{
if (c != d)
return a + b;
return 0;
}
compiled with -O2 -m4-single -ml:
mov.l @(4,r15),r1 ! 47 movsi_ie/7 [length = 2]
mov.l @r15,r2 ! 48 movsi_ie/7 [length = 2]
cmp/eq r1,r2 ! 10 cmpeqsi_t/3 [length = 2]
bt/s .L3 ! 11 branch_true [length = 2]
clrt ! 53 clrt [length = 2]
addc r4,r6 ! 54 addc [length = 2]
addc r5,r7 ! 55 addc1 [length = 2]
mov r6,r0 ! 32 movsi_ie/2 [length = 2]
rts ! 59 *return_i [length = 2]
mov r7,r1 ! 33 movsi_ie/2 [length = 2]
.align 1
.L3:
mov #0,r6 ! 51 movsi_ie/3 [length = 2]
mov #0,r7 ! 52 movsi_ie/3 [length = 2]
mov r6,r0 ! 63 movsi_ie/2 [length = 2]
rts ! 66 *return_i [length = 2]
mov r7,r1 ! 64 movsi_ie/2 [length = 2]
The clrt insn is not needed since T = 0 if the conditional branch is not taken.
The same applies for DImode subtraction.