[RISCV] Don't combine ROTR ((GREV x, 24), 16)->(GREV x, 8) on RV64.
authorCraig Topper <craig.topper@sifive.com>
Wed, 2 Mar 2022 17:42:43 +0000 (09:42 -0800)
committerCraig Topper <craig.topper@sifive.com>
Wed, 2 Mar 2022 17:47:06 +0000 (09:47 -0800)
commita1f8349d770f7fc84e6109e6b398c42707506fd9
tree65b85571a9d9222f201b43da90101d565fa3882c
parentac93f95861268c058d3f3bffd447a594a793c6b3
[RISCV] Don't combine ROTR ((GREV x, 24), 16)->(GREV x, 8) on RV64.

This miscompile was introduced in D119527.

This was a special pattern for rotate+bswap on RV32. It doesn't
work for RV64 since the rotate needs to be half the bitwidth. The
equivalent pattern for RV64 is ROTR ((GREV x, 56), 32) so match
that instead.

This could be generalized further as noted in the new FIXME.

Reviewed By: Chenbing.Zheng

Differential Revision: https://reviews.llvm.org/D120686
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rv64zbp-intrinsic.ll
llvm/test/CodeGen/RISCV/rv64zbp.ll