http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53190

             Bug #: 53190
           Summary: CSE (?) CSEs asms
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org


For the attached testcase CSE ends up CSEing

(insn 2556 2555 2557 128 (parallel [
            (set (reg:DI 542 [ __res ])
                (asm_operands:DI ("cvtss2si %1, %0") ("=r") 0 [
                        (reg:SF 543)
                    ]
                     [
                        (asm_input:SF ("xm") (null):0)
                    ]
                     [] /home/aj/build/glibc/testing/math/libm-test.c:8699))
            (clobber (reg:QI 18 fpsr))
            (clobber (reg:QI 17 flags))
        ]) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 -1
     (nil))

(insn 2557 2556 2558 128 (set (reg/v:DI 403 [ __res ])
        (reg:DI 542 [ __res ])) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 62
{*movdi_internal_rex64}
     (nil))

to

(insn 2556 2555 2557 128 (set (reg:DI 542 [ __res ])
        (reg:DI 525 [ __res ])) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 62
{*movdi_internal_rex64}
     (nil))

(insn 2557 2556 2558 128 (set (reg/v:DI 403 [ __res ])
        (reg:DI 525 [ __res ])) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 62
{*movdi_internal_rex64}
     (nil))

where reg:DI 525 is computed from an asm() in a different floating-point
status area:

(insn 2479 2478 2480 127 (parallel [
            (set (reg:DI 525 [ __res ])
                (asm_operands:DI ("cvtss2si %1, %0") ("=r") 0 [
                        (reg:SF 526)
                    ]
                     [
                        (asm_input:SF ("xm") (null):0)
                    ]
                     [] /home/aj/build/glibc/testing/math/libm-test.c:8699))
            (clobber (reg:QI 18 fpsr))
            (clobber (reg:QI 17 flags))
        ]) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 -1
     (nil))

(insn 2480 2479 2481 127 (set (reg/v:DI 391 [ __res ])
        (reg:DI 525 [ __res ])) ../sysdeps/x86_64/fpu/bits/mathinline.h:82 62
{*movdi_internal_rex64}
     (nil))

the bug is sensitive to inlinign decisions and -fno-ipa-sra manages to
hide it.

Compile flags for the above is

-std=gnu99 -fgnu89-inline -O2 -fmerge-all-constants -fno-builtin

adding -frounding-math does not change anything, even if techincalli required.

Reply via email to