This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/82524] [7/8 Regression] expensive-optimizations produces wrong results


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
To me it looks like a LRA bug.
In *.ira we have:
(insn 28 27 29 2 (parallel [
            (set (reg/v:SI 135 [ result ])
                (ashift:SI (reg:SI 153)
                    (const_int 16 [0x10])))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":26 504 {*ashlsi3_1}
     (expr_list:REG_DEAD (reg:SI 153)
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
...
(insn 38 37 39 2 (parallel [
            (set (zero_extract:SI (reg/v:SI 135 [ result ])
                    (const_int 8 [0x8])
                    (const_int 8 [0x8]))
                (subreg:SI (plus:QI (subreg:QI (zero_extract:SI (reg:SI 159)
                                (const_int 8 [0x8])
                                (const_int 8 [0x8])) 0)
                        (subreg:QI (zero_extract:SI (reg:SI 163)
                                (const_int 8 [0x8])
                                (const_int 8 [0x8])) 0)) 0))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":27 235 {*addqi_ext_2}
     (expr_list:REG_DEAD (reg:SI 163)
        (expr_list:REG_DEAD (reg:SI 159)
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))
...
(insn 48 47 50 2 (set (strict_low_part (subreg:QI (reg/v:SI 135 [ result ]) 0))
        (reg:QI 174)) "pr82545.c":28 97 {*movstrictqi_1}
     (expr_list:REG_DEAD (reg:QI 174)
        (nil)))
(insn 50 48 56 2 (parallel [
            (set (reg:SI 176)
                (and:SI (reg/v:SI 135 [ result ])
                    (const_int 16777215 [0xffffff])))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":30 384 {*andsi_1}
     (expr_list:REG_DEAD (reg/v:SI 135 [ result ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

which at least to the RTL documentation is valid, if zero_extract or
strict_low_part is on the LHS, it means the rest of the original register is
preserved, just the bitfield in there is modified.
But with LRA we get:
(insn 28 27 29 2 (parallel [
            (set (reg/v:SI 0 ax [orig:135 result ] [135])
                (ashift:SI (reg:SI 0 ax [153])
                    (const_int 16 [0x10])))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":26 504 {*ashlsi3_1}
     (nil))
...
(insn 66 37 38 2 (set (reg:SI 0 ax [159])
        (reg:SI 3 bx [159])) "pr82545.c":27 82 {*movsi_internal}
     (nil))
(insn 38 66 39 2 (parallel [
            (set (zero_extract:SI (reg:SI 0 ax [159])
                    (const_int 8 [0x8])
                    (const_int 8 [0x8]))
                (subreg:SI (plus:QI (subreg:QI (zero_extract:SI (reg:SI 0 ax
[159])
                                (const_int 8 [0x8])
                                (const_int 8 [0x8])) 0)
                        (subreg:QI (zero_extract:SI (reg:SI 1 dx [163])
                                (const_int 8 [0x8])
                                (const_int 8 [0x8])) 0)) 0))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":27 235 {*addqi_ext_2}
     (nil))
...
(insn 48 47 50 2 (set (strict_low_part (reg:QI 0 ax [orig:135 result ] [135]))
        (reg:QI 1 dx [174])) "pr82545.c":28 97 {*movstrictqi_1}
     (nil))
(insn 50 48 56 2 (parallel [
            (set (reg:SI 0 ax [176])
                (and:SI (reg/v:SI 0 ax [orig:135 result ] [135])
                    (const_int 16777215 [0xffffff])))
            (clobber (reg:CC 17 flags))
        ]) "pr82545.c":30 384 {*andsi_1}
     (nil))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]