[RISCV][test] Add new tests for add-mul optimization in the zba extension with SH*ADD
authorBen Shi <powerman1st@163.com>
Sat, 19 Jun 2021 02:09:08 +0000 (10:09 +0800)
committerBen Shi <powerman1st@163.com>
Sat, 19 Jun 2021 06:31:01 +0000 (14:31 +0800)
commit31190738c024298745d877a47ef95a5263ea5c9e
treec1b704df92dcbf44c8f2584a65a125f57042c805
parent382b3fe043380c02bcffc8e3fba928bea12c0f5a
[RISCV][test] Add new tests for add-mul optimization in the zba extension with SH*ADD

These tests will show the following optimization by future patches.

Rx + Ry * 18  => (SH1ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 20  => (SH2ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 24  => (SH3ADD (SH1ADD Rx, Rx), Ry)
Rx + Ry * 36  => (SH2ADD (SH3ADD Rx, Rx), Ry)
Rx + Ry * 40  => (SH3ADD (SH2ADD Rx, Rx), Ry)
Rx + Ry * 72  => (SH3ADD (SH3ADD Rx, Rx), Ry)
Rx * (3 << C) => (SLLI (SH1ADD Rx, Rx), C)
Rx * (5 << C) => (SLLI (SH2ADD Rx, Rx), C)
Rx * (9 << C) => (SLLI (SH3ADD Rx, Rx), C)

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D104507
llvm/test/CodeGen/RISCV/rv32zba.ll
llvm/test/CodeGen/RISCV/rv64zba.ll