]> git.ipfire.org Git - thirdparty/gcc.git/commit
xtensa: Eliminate [DS]Cmode hard register clobber that is immediately followed by...
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Tue, 14 Jun 2022 03:53:04 +0000 (12:53 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Wed, 15 Jun 2022 23:55:36 +0000 (16:55 -0700)
commitce3867d414bd7d9e5b6fb2a51b1fb3d9e9e1eae9
treec2054d38d52990d22da106d50d64e68a16f0acb0
parentcfad4856fa46abc878934a9433d0bfc2482ccf00
xtensa: Eliminate [DS]Cmode hard register clobber that is immediately followed by whole overwrite the register

RTL expansion of substitution to [DS]Cmode hard register includes obstructive
register clobber.

A simplest example:

    double _Complex test(double _Complex c) {
      return c;
    }

will be converted to:

    (set (reg:DF 42 [ c ]) (reg:DF 2 a2))
    (set (reg:DF 43 [ c+8 ]) (reg:DF 4 a4))
    (clobber (reg:DC 2 a2))
    (set (reg:DF 2 a2) (reg:DF 42 [ c ]))
    (set (reg:DF 4 a4) (reg:DF 43 [ c+8 ]))
    (use (reg:DC 2 a2))
    (return)

and then finally:

    test:
mov a8, a2
mov a9, a3
mov a6, a4
mov a7, a5
mov a2, a8
mov a3, a9
mov a4, a6
mov a5, a7
ret

As you see, it is so ridiculous.

This patch eliminates such clobber in order to prune away the wasted move
instructions by the optimizer:

    test:
ret

gcc/ChangeLog:

* config/xtensa/xtensa.md (DSC): New split pattern and mode iterator.
gcc/config/xtensa/xtensa.md