aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.h
diff options
context:
space:
mode:
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>2022-07-22 20:15:50 +0900
committerMax Filippov <jcmvbkbc@gmail.com>2022-07-22 12:25:38 -0700
commit64cb87b2381aceaa37230bae7f43c7b9f978d3e3 (patch)
treececb4747879ad3afa80f418cee67b3c3738da96c /gcc/value-range.h
parentcf1725610526fe347d2530455b32affc033fd7fc (diff)
downloadgcc-64cb87b2381aceaa37230bae7f43c7b9f978d3e3.zip
gcc-64cb87b2381aceaa37230bae7f43c7b9f978d3e3.tar.gz
gcc-64cb87b2381aceaa37230bae7f43c7b9f978d3e3.tar.bz2
xtensa: Optimize "bitwise AND NOT with imm" followed by "branch if (not) equal to zero"
The RTL combiner will transform "if ((x & C) == C) goto label;" into "if ((~x & C) == 0) goto label;" and will try to match it with the insn patterns. /* example */ void test_0(int a) { if ((char)a == 255) foo(); } void test_1(int a) { if ((unsigned short)a == 0xFFFF) foo(); } void test_2(int a) { if ((a & 0x00003F80) != 0x00003F80) foo(); } ;; before test_0: extui a2, a2, 0, 8 movi a3, 0xff bne a2, a3, .L1 j.l foo, a9 .L1: ret.n test_1: movi.n a3, -1 extui a2, a2, 0, 16 extui a3, a3, 16, 16 bne a2, a3, .L3 j.l foo, a9 .L3: ret.n test_2: movi a3, 0x80 extui a2, a2, 7, 7 addmi a3, a3, 0x3f00 slli a2, a2, 7 beq a2, a3, .L5 j.l foo, a9 .L5: ret.n ;; after test_0: movi a3, 0xff bnall a2, a3, .L1 j.l foo, a9 .L1: ret.n test_1: movi.n a3, -1 extui a3, a3, 16, 16 bnall a2, a3, .L3 j.l foo, a9 .L3: ret.n test_2: movi a3, 0x80 addmi a3, a3, 0x3f00 ball a2, a3, .L5 j.l foo, a9 .L5: ret.n gcc/ChangeLog: * config/xtensa/xtensa.md (*masktrue_const_bitcmpl): Add a new insn_and_split pattern, and a few split patterns for spacial cases.
Diffstat (limited to 'gcc/value-range.h')
0 files changed, 0 insertions, 0 deletions