Riscv patterns to optimize away some redundant zero/sign extends.
authorJim Wilson <jimw@sifive.com>
Wed, 29 Nov 2017 22:14:17 +0000 (22:14 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 29 Nov 2017 22:14:17 +0000 (14:14 -0800)
commit08539f3e949c37dcfe6e128d78c527db47cc609d
tree22848e6d4ce568310ad8c46274537a4ecda6728e
parent591996bad79b7b109bb01fba69b1c7acc054e287
Riscv patterns to optimize away some redundant zero/sign extends.

gcc/
* config/riscv/riscv.c (SINGLE_SHIFT_COST): New.
(riscv_rtx_costs): Case ZERO_EXTRACT, match new pattern, and return
SINGLE_SHIFT_COST.  Case LT and ZERO_EXTEND, likewise.  Case ASHIFT,
use SINGLE_SHIFT_COST.
* config/riscv/riscv.md (lshrsi3_zero_extend_1): New.
(lshrsi3_zero_extend_2, lshrsi3_zero_extend_3): New.

gcc/testsuite/
* gcc.target/riscv/riscv.exp: New.
* gcc.target/riscv/zero-extend-1.c: New.
* gcc.target/riscv/zero-extend-2.c: New.
* gcc.target/riscv/zero-extend-3.c: New.
* gcc.target/riscv/zero-extend-4.c: New.

Co-Authored-By: Andrew Waterman <andrew@sifive.com>
From-SVN: r255257
gcc/ChangeLog
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/riscv/riscv.exp [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zero-extend-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zero-extend-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zero-extend-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/zero-extend-4.c [new file with mode: 0644]