From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28681 invoked by alias); 19 Feb 2002 15:46:12 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 28621 invoked by uid 71); 19 Feb 2002 15:46:06 -0000 Resent-Date: 19 Feb 2002 15:46:05 -0000 Resent-Message-ID: <20020219154605.28614.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, michaels@stochastik.rwth-aachen.de Received:(qmail 25162 invoked by uid 61); 19 Feb 2002 15:38:19 -0000 Message-Id:<20020219153819.25152.qmail@sources.redhat.com> Date: Tue, 19 Feb 2002 07:46:00 -0000 From: michaels@stochastik.rwth-aachen.de Reply-To: michaels@stochastik.rwth-aachen.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: target/5728: GCC generated non-optimal code for Hitachi SH-4 X-SW-Source: 2002-02/txt/msg00473.txt.bz2 List-Id: >Number: 5728 >Category: target >Synopsis: GCC generated non-optimal code for Hitachi SH-4 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Tue Feb 19 07:46:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: michaels@stochastik.rwth-aachen.de >Release: gcc version 3.0.4 20020215 (prerelease) >Organization: >Environment: Debian Linux i686 host Hitachi SH-4 embedded target compiler built for sh-elf >Description: it seems gcc misses some quite obvious optimizations for Hitachi SH-4, and it even got worse since V3.0.1. The behaviour described here was verified with 3.0.3 and 3.0.4 20020215 (prerelease). Without -frename-registers, an additional unnecessary move is generated. The superfluous instructions are marked in the included assembly output. >How-To-Repeat: sh-elf-gcc -m4 -fomit-frame-pointer -Os -S -frename-registers test1.c >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="sh-gcc.txt" Content-Disposition: inline; filename="sh-gcc.txt" typedef unsigned long tU32; typedef unsigned long long tU64; tU32 test3(tU32 nus, tU32 mult) { tU32 tmp = ((tU64) nus * (tU64) mult)>>32; return tmp + 1; } /opt/cgcc2/bin/sh-elf-gcc -m4 -fomit-frame-pointer -Os -S -frename-registers test1.c .file "test1.c" .text .align 1 .global _test3 .type _test3,@function _test3: mov r4,r2 ! this move can be eliminated nop ! why is this NOP necessary? dmulu.l r5,r2 sts.l pr,@-r15 ! this can be eliminated - V3.0.1 does this! lds.l @r15+,pr ! this can be eliminated - V3.0.1 does this! sts mach,r0 mov r0,r3 ! this move can be eliminated rts add #1,r0 .Lfe1: .size _test3,.Lfe1-_test3 .ident "GCC: (GNU) 3.0.4 20020215 (prerelease)"