VAX: Actually produce QImode and HImode `ctz' operations
authorMaciej W. Rozycki <macro@linux-mips.org>
Sat, 5 Dec 2020 18:26:25 +0000 (18:26 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Sat, 5 Dec 2020 18:26:25 +0000 (18:26 +0000)
commitb9240a4abcd1e194dbd80460a9a7632e63fb7f49
tree325563920c978c0f1be2eec6fcf273c8d6336810
parent273ffa3a6fef82738dd86522374fae69ab0e2651
VAX: Actually produce QImode and HImode `ctz' operations

The middle end does not refer to `ctzqi2'/`ctzhi2' or `ffsqi2'/`ffshi2'
patterns by name where `__builtin_ctz' or `__builtin_ffs' respectively
is invoked for an argument of the QImode or HImode type, and instead it
extends the data type before passing it to `ctzsi2' or `ffssi2'.

Avoid the redundant operation and use a peephole2 to convert it to the
right RTL expression that will collapse the two operations into a single
machine instruction instead unless we need the extended intermediate
result for another purpose.

gcc/
* config/vax/builtins.md: Add a peephole2 for QImode and HImode
`ctz' operations.
(any_extend): New code iterator.

gcc/testsuite/
* gcc.target/vax/ctzhi.c: New test.
* gcc.target/vax/ctzqi.c: New test.
* gcc.target/vax/ffshi.c: New test.
* gcc.target/vax/ffsqi.c: New test.
gcc/config/vax/builtins.md
gcc/testsuite/gcc.target/vax/ctzhi.c [new file with mode: 0644]
gcc/testsuite/gcc.target/vax/ctzqi.c [new file with mode: 0644]
gcc/testsuite/gcc.target/vax/ffshi.c [new file with mode: 0644]
gcc/testsuite/gcc.target/vax/ffsqi.c [new file with mode: 0644]