]> git.ipfire.org Git - thirdparty/gcc.git/commit
xtensa: Recover constant synthesis for HImode after LRA transition
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Sun, 4 Feb 2024 10:20:16 +0000 (19:20 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Sun, 4 Feb 2024 21:25:10 +0000 (13:25 -0800)
commit7c2c7dd24bd93cd9cb8a6e54a4d11850982665fd
treee1781634da2399bf8d746f8a82098ac5cefe3e21
parent777df37a12e55ecbc135efbed2749a8a8a756d4d
xtensa: Recover constant synthesis for HImode after LRA transition

After LRA transition, HImode constants that don't fit into signed 12 bits
are no longer subject to constant synthesis:

    /* example */
    void test(void) {
      short foo = 32767;
      __asm__ ("" :: "r"(foo));
    }

    ;; before
     .literal_position
     .literal .LC0, 32767
    test:
     l32r a9, .LC0
     ret.n

This patch fixes that:

    ;; after
    test:
     movi.n a9, -1
     extui a9, a9, 17, 15
     ret.n

gcc/ChangeLog:

* config/xtensa/xtensa.md (SHI): New mode iterator.
(2 split patterns related to constsynth):
Change to also accept HImode operands.
gcc/config/xtensa/xtensa.md