On Wed, Aug 31, 2011 at 10:35 AM, Duncan Sands <baldr...@free.fr> wrote: > Hi Artem, > > On 31/08/11 10:27, Artem Shinkarov wrote: >> >> On Wed, Aug 31, 2011 at 12:51 AM, Chris Lattner<clatt...@apple.com> >> wrote: >>> >>> On Aug 30, 2011, at 10:01 AM, Artem Shinkarov wrote: >>>>>> >>>>>> The patch at the moment lacks of some examples, but mainly it works >>>>>> fine for me. It would be nice if i386 gurus could look into the way I >>>>>> am doing the expansion. >>>>>> >>>>>> Middle-end parts seems to be more or less fine, they have not changed >>>>>> much from the previous time. >>>>> >>>>> +@code{__builtin_shuffle (vec, mask)} and >>>>> +@code{__builtin_shuffle (vec0, vec1, mask)}. Both functions construct >>>>> >>>>> the latter would be __builtin_shuffle2. >>>> >>>> Why?? >>>> That was the syntax we agreed on that elegantly handles both cases in >>>> one place. >>> >>> If you're going to add vector shuffling builtins, you might consider >>> adding the same builtin that clang has for compatibility: >>> >>> http://clang.llvm.org/docs/LanguageExtensions.html#__builtin_shufflevector >>> >>> It should be straight-forward to map it into the same IR. >>> >>> -Chris >>> >> >> Chris >> >> I am trying to use OpenCL syntax here which says that the mask for >> shuffling is a vector. Also I didn't really get from the clang >> description if the indexes could be non-constnants? If not, then I >> have a problem here, because I want to support this. > > probably it maps directly to the LLVM shufflevector instruction, see > http://llvm.org/docs/LangRef.html#i_shufflevector > That requires the shuffle mask to be constant.
I see. I think it's not worth copying LLVM builtins that merely map its internal IL. Richard. > Ciao, Duncan. >