rs6000: use li;x?oris to build constant
commit97a8e88cd7d22562c0ea4f73687d3c93c21e12fb
authorJiufu Guo <guojiufu@linux.ibm.com>
Mon, 19 Dec 2022 08:40:01 +0000 (19 16:40 +0800)
committerJiufu Guo <guojiufu@linux.ibm.com>
Mon, 19 Dec 2022 09:11:36 +0000 (19 17:11 +0800)
tree16e87c8c821f73f1d3d8c49c3452694f879b4e45
parent17b41a28396b748c1824d92ef431a7d39f48a051
rs6000: use li;x?oris to build constant

For constant C:
If '(c & 0xFFFFFFFF00008000ULL) == 0xFFFFFFFF00008000ULL' or say:
32(1) || 16(x) || 1(1) || 15(x), using "li; xoris" would be ok.

If '(c & 0xFFFFFFFF80008000ULL) == 0x80000000ULL' or say:
32(0) || 1(1) || 15(x) || 1(0) || 15(x), we could use "li; oris" to
build constant 'C'.

Here N(M) means N continuous bit M, x for M means it is ok for either
1 or 0; '||' means concatenation.

This patch update rs6000_emit_set_long_const to support those constants.

PR target/106708

gcc/ChangeLog:

* config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
"li; x?oris" to build constant.

gcc/testsuite/ChangeLog:

* gcc.target/powerpc/pr106708.c: New test.
gcc/config/rs6000/rs6000.cc
gcc/testsuite/gcc.target/powerpc/pr106708.c [new file with mode: 0644]