[DAGCombiner] Recognize another rotation idiom

Adam Nemet anemet at apple.com
Thu Mar 6 11:25:50 PST 2014


On Mar 6, 2014, at 1:34 AM, Richard Sandiford <rsandifo at linux.vnet.ibm.com> wrote:

> Sorry for the slow reply!

Not a problem.  Thanks very much for the reviews!

> Adam Nemet <anemet at apple.com> writes:
>> --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>> index 5057850..2305687 100644
>> --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>> +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>> @@ -3352,7 +3352,7 @@ static bool MatchRotateHalf(SDValue Op, SDValue &Shift, SDValue &Mask) {
>> //
>> //     (or (shift1 X, Neg), (shift2 X, Pos))
>> //
>> -// reduces to a rotate in direction shift2 by Pos and a rotate in direction
>> +// reduces to a rotate in direction shift2 by Pos or a rotate in direction
>> // shift1 by Neg.  The range [0, OpSize) means that we only need to consider
>> // shift amounts with defined behavior.
>> static bool matchRotateSub(SDValue Pos, SDValue Neg, unsigned OpSize) {
> 
> I take your point, but "or" kind-of suggests that these are two separate
> conditions, whereas they're really just two ways of expressing the same
> condition.  Maybe "or (equivalently)”?

Works for me.

Adam

> 
> Both patches LGTM otherwise, thanks.
> 
> Richard
> 





More information about the llvm-commits mailing list