public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ?
@ 2014-07-31 16:52 nasika.srikanth1 at gmail dot com
  2014-08-01  8:26 ` [Bug other/61979] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nasika.srikanth1 at gmail dot com @ 2014-07-31 16:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

            Bug ID: 61979
           Summary: Why float variable loading twice into the FTU Stack
                    during condition checking ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nasika.srikanth1 at gmail dot com

Actually its not a bug. But i identified that float variables are loading twice
into the FTU STACK during the condition checking ,that's actually my doubt and
i check without loading it again i remove repeated code and getting the same
output . But why gcc complier loads the float variable again into the FTU Stack
? For checking the condition it first  checks the parity flags(whether NAN ,INF
)then it again loads the float variable into FTU stack and check for the zero
flag( whether non zero) set or not. But  we can directly check the zero flag
after checking parity flag  with out loading the variable into the FTU stack.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FTU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
@ 2014-08-01  8:26 ` rguenth at gcc dot gnu.org
  2014-08-02  6:19 ` nasika.srikanth1 at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-01  8:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-08-01
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testcase that shows the problem?  On what architecture?  What's a FTU stack?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FTU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
  2014-08-01  8:26 ` [Bug other/61979] " rguenth at gcc dot gnu.org
@ 2014-08-02  6:19 ` nasika.srikanth1 at gmail dot com
  2014-08-02  6:37 ` [Bug other/61979] Why float variable loading twice into the FPU " nasika.srikanth1 at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nasika.srikanth1 at gmail dot com @ 2014-08-02  6:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #2 from Srikanth <nasika.srikanth1 at gmail dot com> ---
Created attachment 33225
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33225&action=edit
In this assemble code line number at 22-25 and after 27-30 both are same
instructions repeated for conditional checking.

In this assemble code line number at 22-25 and after 27-30 both are same
instructions repeated for conditional checking.

Architecture ---- Intel® Core™ i3-2350M CPU @ 2.30GHz × 4 

Sorry its my mistype *not FTU*,its actually FPU Stack means Floating point unit
stack




I just patch the above code by removing the repeated code


    file    "testcondition.c"
    .section    .rodata
.LC2:
    .string    "true"
.LC3:
    .string    "false"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushl    %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    andl    $-16, %esp
    subl    $32, %esp
    movl    .LC0, %eax
    movl    %eax, 28(%esp)
    flds    28(%esp)
    fldz
    fucomip    %st(1), %st
    fstp    %st(0)
    jp    .L6
    je    .L7
.L6:
    movl    $.LC2, (%esp)
    call    printf
    jmp    .L4
.L7:
    movl    $.LC3, (%esp)
    call    printf
.L4:
    movl    $0, %eax
    leave
    .cfi_restore 5
    .cfi_def_cfa 4, 4
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .section    .rodata
    .align 4
.LC0:
    .long    1094713344
    .ident    "GCC: (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1"
    .section    .note.GNU-stack,"",@progbits
>From gcc-bugs-return-457603-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Aug 02 06:21:59 2014
Return-Path: <gcc-bugs-return-457603-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31461 invoked by alias); 2 Aug 2014 06:21:58 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31413 invoked by uid 48); 2 Aug 2014 06:21:53 -0000
From: "nasika.srikanth1 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/61979] Why float variable loading twice into the FTU Stack during condition checking ?
Date: Sat, 02 Aug 2014 06:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: nasika.srikanth1 at gmail dot com
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61979-4-mx2RaHZs58@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61979-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61979-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg00100.txt.bz2
Content-length: 1197

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #3 from Srikanth <nasika.srikanth1 at gmail dot com> ---
Comment on attachment 33225
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33225
In this assemble code line number at 22-25 and after 27-30 both are same
instructions repeated for conditional checking.

>	file	"testcondition.c"
>	.section	.rodata
>.LC2:
>	.string	"true"
>.LC3:
>	.string	"false"
>	.text
>	.globl	main
>	.type	main, @function
>main:
>.LFB0:
>	.cfi_startproc
>	pushl	%ebp
>	.cfi_def_cfa_offset 8
>	.cfi_offset 5, -8
>	movl	%esp, %ebp
>	.cfi_def_cfa_register 5
>	andl	$-16, %esp
>	subl	$32, %esp
>	movl	.LC0, %eax
>	movl	%eax, 28(%esp)
>	flds	28(%esp)
>	fldz
>	fucomip	%st(1), %st
>	fstp	%st(0)
>	jp	.L6
        flds    28(%esp)
    fldz
    fucomip    %st(1), %st
    fstp    %st(0)
>	je	.L7
>.L6:
>	movl	$.LC2, (%esp)
>	call	printf
>	jmp	.L4
>.L7:
>	movl	$.LC3, (%esp)
>	call	printf
>.L4:
>	movl	$0, %eax
>	leave
>	.cfi_restore 5
>	.cfi_def_cfa 4, 4
>	ret
>	.cfi_endproc
>.LFE0:
>	.size	main, .-main
>	.section	.rodata
>	.align 4
>.LC0:
>	.long	1094713344
>	.ident	"GCC: (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1"
>	.section	.note.GNU-stack,"",@progbits
>From gcc-bugs-return-457604-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Aug 02 06:23:56 2014
Return-Path: <gcc-bugs-return-457604-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 768 invoked by alias); 2 Aug 2014 06:23:56 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 750 invoked by uid 48); 2 Aug 2014 06:23:53 -0000
From: "q.gcc@rsn-tech.co.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61993] constexpr static member function "is not constant"
Date: Sat, 02 Aug 2014 06:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: q.gcc@rsn-tech.co.uk
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-61993-4-qLSMH7Df1X@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61993-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61993-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg00101.txt.bz2
Content-length: 153

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida993

--- Comment #2 from steveren <q.gcc@rsn-tech.co.uk> ---
Ah, it is a dupe; sorry, I missed that one.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FPU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
  2014-08-01  8:26 ` [Bug other/61979] " rguenth at gcc dot gnu.org
  2014-08-02  6:19 ` nasika.srikanth1 at gmail dot com
@ 2014-08-02  6:37 ` nasika.srikanth1 at gmail dot com
  2014-08-02  6:42 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nasika.srikanth1 at gmail dot com @ 2014-08-02  6:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #4 from Srikanth <nasika.srikanth1 at gmail dot com> ---
In the Above comment-3 assembly code with black color letter are the repeated
code i.e storing the float variable twice in FPU stack during conditional
checking for parity flag and zero flag. I just patch that one by removing
repeated code ,after checking the  parity flag i just check the zero flag with
out loading it again into the FPU Stack and again compare with zero .


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FPU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
                   ` (2 preceding siblings ...)
  2014-08-02  6:37 ` [Bug other/61979] Why float variable loading twice into the FPU " nasika.srikanth1 at gmail dot com
@ 2014-08-02  6:42 ` pinskia at gcc dot gnu.org
  2014-08-02 11:12 ` nasika.srikanth1 at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-08-02  6:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Where is the testcase, this is only the assembly output.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FPU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
                   ` (3 preceding siblings ...)
  2014-08-02  6:42 ` pinskia at gcc dot gnu.org
@ 2014-08-02 11:12 ` nasika.srikanth1 at gmail dot com
  2014-08-02 11:33 ` glisse at gcc dot gnu.org
  2014-08-02 16:29 ` nasika.srikanth1 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: nasika.srikanth1 at gmail dot com @ 2014-08-02 11:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #6 from Srikanth <nasika.srikanth1 at gmail dot com> ---
int main()
{
float m=12
m?printf("true"):printf("false");
m=0;
m?printf("true"):printf("false");
}


and above is the  assemble code generated from the source file .. when i seeing
the assemble code i just recognize that float variable was loading twice during
the conditional checking that's what my doubt ? please tell me why after
comparison of parity flag for NAN or not,directly we can check for zero flag
for zero or not.But the generated assemble code in #comment 3 ,after comparison
of parity flag it again loading the same variable into the FPU stack and again
comparing with zero and checking for zero flag and goes to true or false
statment why?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FPU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
                   ` (4 preceding siblings ...)
  2014-08-02 11:12 ` nasika.srikanth1 at gmail dot com
@ 2014-08-02 11:33 ` glisse at gcc dot gnu.org
  2014-08-02 16:29 ` nasika.srikanth1 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-02 11:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> ---
Your testcase is missing a ';', a #include and a return. You don't say how you
compiled, but clearly you didn't pass any optimization flag (-O2 for instance),
so you shouldn't expect optimized code.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug other/61979] Why float variable loading twice into the FPU Stack during condition checking ?
  2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
                   ` (5 preceding siblings ...)
  2014-08-02 11:33 ` glisse at gcc dot gnu.org
@ 2014-08-02 16:29 ` nasika.srikanth1 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: nasika.srikanth1 at gmail dot com @ 2014-08-02 16:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61979

--- Comment #8 from Srikanth <nasika.srikanth1 at gmail dot com> ---
#include<stdio.h>
int main()
{
 float m=12;
 m?printf("true"):printf("false");
 m=0;
 m?printf("true"):printf("false");
 return 0;
}



complied : gcc -S testcase.c -o testcase.s


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-08-02 16:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 16:52 [Bug other/61979] New: Why float variable loading twice into the FTU Stack during condition checking ? nasika.srikanth1 at gmail dot com
2014-08-01  8:26 ` [Bug other/61979] " rguenth at gcc dot gnu.org
2014-08-02  6:19 ` nasika.srikanth1 at gmail dot com
2014-08-02  6:37 ` [Bug other/61979] Why float variable loading twice into the FPU " nasika.srikanth1 at gmail dot com
2014-08-02  6:42 ` pinskia at gcc dot gnu.org
2014-08-02 11:12 ` nasika.srikanth1 at gmail dot com
2014-08-02 11:33 ` glisse at gcc dot gnu.org
2014-08-02 16:29 ` nasika.srikanth1 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).