From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26061 invoked by alias); 24 Sep 2009 17:24:20 -0000 Received: (qmail 25933 invoked by uid 48); 24 Sep 2009 17:23:58 -0000 Date: Thu, 24 Sep 2009 17:24:00 -0000 Subject: [Bug c/41462] New: redundant instructions with long double returned value X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "yuri at tsoft dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg02295.txt.bz2 When I compile this function: double f(long double i) {return (i);} with gcc flags -S -O3, I get the assembly below. There are two redundant FPU instructions there. double value is already in FPU after fldt. No need to store it and load it back since difference between double and long double is only in memory representation, and in FPU registers they are the same. ---- asm output (relevant part) ---- f: pushl %ebp movl %esp, %ebp subl $8, %esp <---- redundant related stack adjustment fldt 8(%ebp) fstpl -8(%ebp) <---- redundant STORE fldl -8(%ebp) <---- redundant LOAD leave ret -- Summary: redundant instructions with long double returned value Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: yuri at tsoft dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41462