public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67242] New: Missing optimization with float
@ 2015-08-16 20:12 f.boesing at gmx dot de
  2015-08-16 20:14 ` [Bug c/67242] " f.boesing at gmx dot de
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: f.boesing at gmx dot de @ 2015-08-16 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67242
           Summary: Missing optimization with float
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.boesing at gmx dot de
  Target Milestone: ---

testcase:

int n, dummy;
float dummyfloat;

void bug(void) 
{
 for(n=0; n<1000; n++)
    dummy = n;
 for(n=0; n<1000; n++)
    dummyfloat = n;
}

the first loop (dummy=) is optimized away with -O2 and -O3
the second (dummyfloat=) NOT.

Tested with 4.9.2 & 4.9.3, targets x86-64, arm-thumb and arm.

commandline: gcc -O2 bug.c -S


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

* [Bug c/67242] Missing optimization with float
  2015-08-16 20:12 [Bug c/67242] New: Missing optimization with float f.boesing at gmx dot de
@ 2015-08-16 20:14 ` f.boesing at gmx dot de
  2015-08-16 20:28 ` f.boesing at gmx dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: f.boesing at gmx dot de @ 2015-08-16 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Frank <f.boesing at gmx dot de> ---
works ok with local variables.


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

* [Bug c/67242] Missing optimization with float
  2015-08-16 20:12 [Bug c/67242] New: Missing optimization with float f.boesing at gmx dot de
  2015-08-16 20:14 ` [Bug c/67242] " f.boesing at gmx dot de
@ 2015-08-16 20:28 ` f.boesing at gmx dot de
  2015-08-17  7:24 ` [Bug tree-optimization/67242] Missing optimization with float IV in SCEV-CCP rguenth at gcc dot gnu.org
  2021-12-15 21:56 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: f.boesing at gmx dot de @ 2015-08-16 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Frank <f.boesing at gmx dot de> ---
x86-64:



        .file   "bug.c"
        .section        .text.unlikely,"x"
.LCOLDB0:
        .text
.LHOTB0:
        .p2align 4,,15
        .globl  bug
        .def    bug;    .scl    2;      .type   32;     .endef
        .seh_proc       bug
bug:
        .seh_endprologue
        movl    $999, dummy(%rip)
        xorl    %eax, %eax
        .p2align 4,,10
.L2:
        pxor    %xmm0, %xmm0
        cvtsi2ss        %eax, %xmm0
        addl    $1, %eax
        cmpl    $1000, %eax
        jne     .L2
        movss   %xmm0, dummyfloat(%rip)
        movl    $1000, n(%rip)
        ret
        .seh_endproc
        .section        .text.unlikely,"x"
.LCOLDE0:
        .text
.LHOTE0:
        .comm   dummyfloat, 4, 2
        .comm   dummy, 4, 2
        .comm   n, 4, 2
        .ident  "GCC: (tdm64-1) 4.9.2"







arm-thumb, soft float:
        .cpu arm7tdmi
        .fpu softvfp
        .eabi_attribute 20, 1
        .eabi_attribute 21, 1
        .eabi_attribute 23, 3
        .eabi_attribute 24, 1
        .eabi_attribute 25, 1
        .eabi_attribute 26, 1
        .eabi_attribute 30, 2
        .eabi_attribute 34, 0
        .eabi_attribute 18, 4
        .code   16
        .file   "bug.c"
        .global __aeabi_i2f
        .text
        .align  2
        .global bug
        .code   16
        .thumb_func
        .type   bug, %function
bug:
        push    {r3, r4, r5, lr}
        mov     r5, #250
        mov     r4, #0
        ldr     r2, .L5
        ldr     r3, .L5+4
        str     r2, [r3]
        lsl     r5, r5, #2
.L2:
        mov     r0, r4
        add     r4, r4, #1
        bl      __aeabi_i2f
        cmp     r4, r5
        bne     .L2
        ldr     r3, .L5+8
        str     r0, [r3]
        ldr     r3, .L5+12
        @ sp needed
        str     r4, [r3]
        pop     {r3, r4, r5}
        pop     {r0}
        bx      r0
.L6:
        .align  2
.L5:
        .word   999
        .word   dummy
        .word   dummyfloat
        .word   n
        .size   bug, .-bug
        .comm   dummyfloat,4,4
        .comm   dummy,4,4
        .comm   n,4,4
        .ident  "GCC: (GNU Tools for ARM Embedded Processors) 4.9.3 20150529
(release) [ARM/embedded-4_9-branch revision 224288]"


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

* [Bug tree-optimization/67242] Missing optimization with float IV in SCEV-CCP
  2015-08-16 20:12 [Bug c/67242] New: Missing optimization with float f.boesing at gmx dot de
  2015-08-16 20:14 ` [Bug c/67242] " f.boesing at gmx dot de
  2015-08-16 20:28 ` f.boesing at gmx dot de
@ 2015-08-17  7:24 ` rguenth at gcc dot gnu.org
  2021-12-15 21:56 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-08-17  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-17
            Summary|Missing optimization with   |Missing optimization with
                   |float                       |float IV in SCEV-CCP
     Ever confirmed|0                           |1
      Known to fail|                            |5.2.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  This is SCEV-const-prop not handling floats (obviously).  The trick
could be to handle this kind of DEFs of loop-closed PHI uses specially
(use the evolution of the source).


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

* [Bug tree-optimization/67242] Missing optimization with float IV in SCEV-CCP
  2015-08-16 20:12 [Bug c/67242] New: Missing optimization with float f.boesing at gmx dot de
                   ` (2 preceding siblings ...)
  2015-08-17  7:24 ` [Bug tree-optimization/67242] Missing optimization with float IV in SCEV-CCP rguenth at gcc dot gnu.org
@ 2021-12-15 21:56 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-15 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

end of thread, other threads:[~2021-12-15 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-16 20:12 [Bug c/67242] New: Missing optimization with float f.boesing at gmx dot de
2015-08-16 20:14 ` [Bug c/67242] " f.boesing at gmx dot de
2015-08-16 20:28 ` f.boesing at gmx dot de
2015-08-17  7:24 ` [Bug tree-optimization/67242] Missing optimization with float IV in SCEV-CCP rguenth at gcc dot gnu.org
2021-12-15 21:56 ` pinskia at gcc dot gnu.org

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).