public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104059] New: cprop_hardreg propgates hard registers for mov instructions between different REG_CLASS without considering cost
@ 2022-01-17  3:36 crazylht at gmail dot com
  2022-01-17  4:56 ` [Bug rtl-optimization/104059] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: crazylht at gmail dot com @ 2022-01-17  3:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104059
           Summary: cprop_hardreg propgates hard registers for mov
                    instructions between different REG_CLASS without
                    considering cost
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

int test (uint8_t *p, uint32_t t[1][1], int n) {

  int sum = 0;
  uint32_t a0;
  for (int i = 0; i < 4; i++, p++)
    t[i][0] = p[0];

  for (int i = 0; i < 4; i++) {
    {
      int t0 = t[0][i] + t[0][i];
      a0 = t0;
    };
    sum += a0;
  }
  return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1;
}

testcase is from PR104049, for x86 with -O3 -mavx2 ,before cprop_hardregs it's

----before cprop_hardreg------
(insn 100 79 81 2 (set (reg:SI 1 dx [orig:90 stmp__9.14 ] [90])
        (reg:SI 20 xmm0 [114])) 81 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 20 xmm0 [114])
        (nil)))
(debug_insn 81 100 96 2 (debug_marker) "/app/example.cpp":16:3 -1
     (nil))
(insn 96 81 82 2 (set (reg:SI 0 ax [116])
        (reg:SI 1 dx [orig:90 stmp__9.14 ] [90])) "/app/example.cpp":16:44 81
{*movsi_internal}
     (nil))
---end------------

------after cprop_hardreg--------
(insn 100 79 81 2 (set (reg:SI 1 dx [orig:90 stmp__9.14 ] [90])
        (reg:SI 20 xmm0 [114])) 81 {*movsi_internal}
     (nil))
(debug_insn 81 100 96 2 (debug_marker) "/app/example.cpp":16:3 -1
     (nil))
(insn 96 81 82 2 (set (reg:SI 0 ax [116])
        (reg:SI 20 xmm0 [orig:90 stmp__9.14 ] [90])) "/app/example.cpp":16:44
81 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 20 xmm0 [orig:90 stmp__9.14 ] [90])
        (nil)))
------end--------------

it's
        vmovd   edx, xmm0
        movl   eax, edx

vs
        vmovd   edx, xmm0
        vmovd   eax, xmm0

vmovd is expensive for many x86 targets.

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

end of thread, other threads:[~2022-02-15  6:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17  3:36 [Bug target/104059] New: cprop_hardreg propgates hard registers for mov instructions between different REG_CLASS without considering cost crazylht at gmail dot com
2022-01-17  4:56 ` [Bug rtl-optimization/104059] [12 Regression] " pinskia at gcc dot gnu.org
2022-01-17  8:40 ` rguenth at gcc dot gnu.org
2022-01-17 17:53 ` jakub at gcc dot gnu.org
2022-01-17 17:59 ` pinskia at gcc dot gnu.org
2022-01-19  3:35 ` pinskia at gcc dot gnu.org
2022-01-19  3:41 ` pinskia at gcc dot gnu.org
2022-01-27  6:02 ` crazylht at gmail dot com
2022-02-08  4:39 ` cvs-commit at gcc dot gnu.org
2022-02-15  6:37 ` crazylht 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).