aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pass.h
diff options
context:
space:
mode:
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>2023-09-05 18:27:35 +0900
committerMax Filippov <jcmvbkbc@gmail.com>2023-09-06 03:23:33 -0700
commita4829dda6362f5f653c4bd5783374fafc0e8622f (patch)
tree599945d757705273f41155cfcf8b696d635cf30e /gcc/tree-pass.h
parent57d1c9c1fe57a0de66e5c20538f77f49b1298071 (diff)
downloadgcc-a4829dda6362f5f653c4bd5783374fafc0e8622f.zip
gcc-a4829dda6362f5f653c4bd5783374fafc0e8622f.tar.gz
gcc-a4829dda6362f5f653c4bd5783374fafc0e8622f.tar.bz2
xtensa: Optimize boolean evaluation when SImode EQ/NE to zero if TARGET_MINMAX
This patch optimizes the boolean evaluation for equality to 0 in SImode using the MINU (Minimum Value Unsigned) machine instruction available when TARGET_MINMAX is configured, for example, (x != 0) to MINU(x, 1) and (x == 0) to (MINU(x, 1) ^ 1). /* example */ int test0(int x) { return x == 0; } int test1(int x) { return x != 0; } ;; before test0: mov.n a10, a2 movi.n a9, 1 movi.n a2, 0 moveqz a2, a9, a10 ret.n test1: mov.n a10, a2 movi.n a9, 1 movi.n a2, 0 movnez a2, a9, a10 ret.n ;; after (prereq. TARGET_MINMAX) test0: movi.n a9, 1 minu a2, a2, a9 xor a2, a2, a9 ret.n test1: movi.n a9, 1 minu a2, a2, a9 ret.n gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_expand_scc): Add code for particular constants (only 0 and INT_MIN for now) for EQ/NE boolean evaluation in SImode. * config/xtensa/xtensa.md (*eqne_INT_MIN): Remove because its implementation has been integrated into the above.
Diffstat (limited to 'gcc/tree-pass.h')
0 files changed, 0 insertions, 0 deletions