[PATCH] DAGCombiner: Add another rotate pattern.

Jay Foad jay.foad at gmail.com
Thu Jul 18 04:40:41 PDT 2013


> +    // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y), 31)))) ->
> +    //   (rotl x, y)
> +    // fold (or (shl x, (*ext y)), (srl x, (*ext (and (sub 32, y), 31)))) ->
> +    //   (rotr x, (sub 32, y))

"and (sub 32, y), 31" should be "and (sub 0, y), 31". There are four
occurrences of this in the whole patch.

> +          if (SUBC->getAPIntValue() == 0 &&
> +              ANDC->getAPIntValue() == OpSizeInBits - 1 &&
> +              RExtOp0.getOperand(0).getOperand(1) == LExtOp0)

Do you need an explicit check that OpSizeInBits is a power of two?

Jay.



More information about the llvm-commits mailing list