[RISCV] Make the code in MatchSLLIUW ignore the lower bits of the AND mask where...
authorCraig Topper <craig.topper@sifive.com>
Sun, 24 Jan 2021 08:13:12 +0000 (00:13 -0800)
committerCraig Topper <craig.topper@sifive.com>
Sun, 24 Jan 2021 08:34:45 +0000 (00:34 -0800)
This avoids being dependent on SimplifyDemandedBits having cleared
those bits.

It could make sense to teach SimplifyDemandedBits to keep all
lower bits 1 in an AND mask when possible. This could be
implemented with slli+srli in the general case rather than
needing to materialize the constant.

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

index 078ed1b..2198b27 100644 (file)
@@ -871,7 +871,7 @@ bool RISCVDAGToDAGISel::MatchSLLIUW(SDNode *N) const {
 
   // Immediate range should be enforced by uimm5 predicate.
   assert(VC2 < 32 && "Unexpected immediate");
-  return VC1 == ((uint64_t)0xFFFFFFFF << VC2);
+  return (VC1 >> VC2) == UINT64_C(0xFFFFFFFF);
 }
 
 bool RISCVDAGToDAGISel::selectVSplat(SDValue N, SDValue &SplatVal) {