[PATCH][DAGCombiner] Distribute TRUNC through AND in rotation amount

Richard Sandiford rsandifo at linux.vnet.ibm.com
Thu Mar 6 01:55:33 PST 2014


Adam Nemet <anemet at apple.com> writes:
> This is already done for shifts.  Allow it for rotations as well. E.g.:
>
>    (rotl:i32 x, (trunc (and y, 31))) -> (rotl:i32 x, (and (trunc y), 31))
>
> Use the newly factored-out distributeTruncateThroughAnd.
>
> With this patch and some X86.td tweaks we should be able to remove redundant
> masking of the rotation amount like in the example above.  HW implicitly
> performs this masking.
>
> The testcase will be added as part of the X86 patch.

LGTM FWIW (don't know whether that counts)

Thanks,
Richard




More information about the llvm-commits mailing list