[llvm-commits] patch: x86 vector udiv
Peter Cooper
peter_cooper at apple.com
Thu Nov 3 13:42:54 PDT 2011
Hi Duncan
I see what you mean. So it turns out that there's already some code to match powers of 2. The attached patch is an implementation with only one piece of code to cover both scalars and vectors.
Thanks,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8429.patch
Type: application/octet-stream
Size: 2131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111103/868d5c46/attachment.obj>
-------------- next part --------------
On Nov 3, 2011, at 2:16 AM, Duncan Sands wrote:
> Hi Peter,
>
>> I've written a version in InstCombine which is now working.
>
> I think it would be better if the same code worked for the scalar and
> vector cases. This means writing a bunch of utility functions but once
> that's done hopefully it becomes trivial to convert all kinds of scalar
> transforms to work also on vectors. Maybe a good first step is to introduce
> a helper class for representing either a ConstantInt or a vector of
> ConstantInt, analogous to the helper classes in Operator.h (eg:
> OverflowingBinaryOperator) or IntrinsicInst.h.
>
> Ciao, Duncan.
>
>>
>> Please have a look and see if its at the right stage of compilation.
>>
>> Cheers,
>> Pete
>>
>>
>>
>>
>> On Nov 2, 2011, at 5:23 PM, Chris Lattner wrote:
>>
>>>
>>> On Nov 1, 2011, at 6:04 PM, Eli Friedman wrote:
>>>
>>>> On Tue, Nov 1, 2011 at 5:40 PM, Peter Cooper<peter_cooper at apple.com> wrote:
>>>>> Hi
>>>>>
>>>>> Please review this patch for pr8429 to turn vector udiv into vector shrl instructions when dividing by powers of 2. This was already done on scalars but not on vectors.
>>>>>
>>>>> I also found that vector shifts were always scalarised on x86 even with SSE on so i turned these into the equivalent intrinsics.
>>>>
>>>> The change to X86ISelLowering.cpp is wrong; the psrld instruction is
>>>> not equivalent to ISD::SRL in the general case.
>>>>
>>>> For the rest of the changes, it would be better to handle this
>>>> transformation in instcombine.
>>>
>>> I agree - this is a generally useful canonicalization that should be done early.
>>>
>>> -Chris
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list