xenial (3) shuffle.3clc.gz

Provided by: opencl-1.2-man-doc_1.0~svn27110-1_all bug

NAME

       shuffle - Constructs a permutation of elements from one (or two) input vectors.

       gentypen shuffle(gentypem x, ugentypen mask);

       gentypen shuffle2(gentypem x, gentypem y, ugentypen mask);

DESCRIPTION

       The shuffle and shuffle2 built-in functions construct a permutation of elements from one or two input
       vectors respectively that are of the same type, returning a vector with the same element type as the
       input and length that is the same as the shuffle mask. The size of each element in the mask must match
       the size of each element in the result. For shuffle, only the ilogb(3clc)(2m-1) least significant bits of
       each mask element are considered. For shuffle2, only the ilogb(3clc)(2m-1)+1 least significant bits of
       each mask element are considered. Other bits in the mask shall be ignored.

       The elements of the input vectors are numbered from left to right across one or both of the vectors. For
       this purpose, the number of elements in a vector is given by vec_step(3clc)(gentypem). The shuffle mask
       operand specifies, for each element of the result vector, which element of the one or two input vectors
       the result element gets.

       We use the generic type name gentypen (or gentypem) to indicate the built-in data types char{2|4|8|16},
       uchar{2|4|8|16}, short{2|4|8|16}, ushort{2|4|8|16}, int{2|4|8|16}, uint{2|4|8|16}, long{2|4|8|16},
       ulong{2|4|8|16}, or float{2|4|8|16} as the type for the arguments unless otherwise stated. We use the
       generic name ugentypen to indicate the built-in unsigned integer data types. If the double is supported,
       then gentypen (or gentypem) also indicate the built-in data types double{2|4|8|16}.

       The generic type name gentypen (or gentypem) may indicate the data type half{2|4|8|16} if the
       cl_khr_fp16(3clc) extension is supported.

   Example
       uint4 mask = (uint4)(3, 2, 1, 0); float4 a; float4 r =
       shuffle(a, mask); // r.s0123 = a.wzyx

       uint8 mask = (uint8)(0, 1, 2, 3, 4, 5, 6, 7);

       float4 a, b; float8 r = shuffle2(a, b, mask); // r.s0123
       = a.xyzw // r.s4567 = b.xyzw

       uint4 mask; float8 a; float4 b; b = shuffle(a, mask);

       Examples that are not valid are:

       uint8 mask; short16 a; short8 b; b = shuffle(a, mask);

SPECIFICATION

       OpenCL Specification[1]

SEE ALSO

       miscVectorFunctions(3clc)

AUTHORS

       The Khronos Group

       Copyright © 2007-2011 The Khronos Group Inc.
       Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or
       associated documentation files (the "Materials"), to deal in the Materials without restriction, including
       without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to
       the condition that this copyright notice and permission notice shall be included in all copies or
       substantial portions of the Materials.

NOTES

        1. OpenCL Specification
           page 282, section 6.12.12 Miscellaneous Vector Functions