From 64fbebacdc301d46f759c53c0152b6e121e379a9 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 1 Dec 2023 17:49:18 -0500 Subject: [PATCH 01/17] Clarify __swizzled_vec__ class Prior to this commit, the `__swizzled_vec__` class was not precisely specified. We said that it had the same interface as `vec` except for a small set of differences that we enumerated. However, it became clear after discussing with the original authors that this wasn't a complete list of differences. This commit adds a complete list of the members and friend functions for the `__swizzled_vec__` type. In many cases, the descriptions simply defer to the `vec` specification, but there are also many cases where the semantics are special for `__swizzled_vec__`. The updated specification also describes `__swizzled_vec__` as a view over the original `vec` object, which I think is what we originally intended. I intentionally removed wording like "may not be bound to a l-value or escape the expression it was constructed in." I think the true restriction is that the lifetime of the `__swizzled_vec__` must not outlive the lifetime of the underlying `vec`, which is the case for any view. I also intentionally removed the statement: > Both kinds of swizzle member functions must not perform the swizzle > operation themselves, instead the swizzle operation must be performed > by the returned instance of `__swizzled_vec__` when used within an > expression, meaning if the returned `__swizzled_vec__` is never used > in an expression no swizzle operation is performed. This wording made is sound like the point of `__swizzled_vec__` was to delay the swizzle operation as a sort of optimization. However, our original intent was only to specify `__swizzled_vec__` as a view. This commit also uses our updated style to specify the `__swizzled_vec__` type, using a format that gives more horizontal space for the synopses and descriptions. Closes #504 --- adoc/chapters/programming_interface.adoc | 533 +++++++++++++++++++++-- adoc/code/swizzle-example.cpp | 14 + adoc/headers/swizzled-vec.h | 18 + 3 files changed, 526 insertions(+), 39 deletions(-) create mode 100644 adoc/code/swizzle-example.cpp create mode 100644 adoc/headers/swizzled-vec.h diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 64520352..c182796d 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17625,11 +17625,6 @@ instance. Since the swizzle operation may result in a different number of elements, the [code]#+__swizzled_vec__+# instance may represent a different number of elements than the original [code]#vec#. -Both kinds of swizzle member functions must not perform the swizzle operation -themselves, instead the swizzle operation must be performed by the returned -instance of [code]#+__swizzled_vec__+# when used within an expression, meaning -if the returned [code]#+__swizzled_vec__+# is never used in an expression no -swizzle operation is performed. Both the [code]#swizzle# member function template and the simple swizzle member functions allow swizzle indexes to be repeated. @@ -17640,40 +17635,500 @@ member function template. [[swizzled-vec-class]] -==== Swizzled [code]#vec# class - -The [code]#+__swizzled_vec__+# class must define an unspecified temporary which -provides the entire interface of the SYCL [code]#vec# class template, including -swizzled member functions, with the additions and alterations described below. -The member functions of the [code]#+__swizzled_vec__+# class behave as though -they operate on a [code]#vec# that is the result of the swizzle operation. - - * The [code]#+__swizzled_vec__+# class template must be readable as an r-value - reference on the RHS of an expression. - In this case the swizzle operation is performed on the RHS of the expression - and then the result is applied to the LHS of the expression. - * The [code]#+__swizzled_vec__+# class template must be assignable as an - l-value reference on the LHS of an expression. - In this case the RHS of the expression is applied to the original SYCL - [code]#vec# which the [code]#+__swizzled_vec__+# represents via the swizzle - operation. - Note that a [code]#+__swizzled_vec__+# that is used in an l-value expression - may not contain any repeated element indexes. -+ -For example: [code]#f4.xxxx() = fx.wzyx()# would not be valid. - * The [code]#+__swizzled_vec__+# class template must be convertible to an - instance of SYCL [code]#vec# with the type [code]#DataT# and number of - elements specified by the swizzle member function, if [code]#NumElements > - 1#, and must be convertible to an instance of type [code]#DataT#, if - [code]#NumElements == 1#. - * The [code]#+__swizzled_vec__+# class template must be non-copyable, - non-moveable, non-user constructible and may not be bound to a l-value or - escape the expression it was constructed in. - For example [code]#auto x = f4.x()# would not be valid. - * The [code]#+__swizzled_vec__+# class template should return - [code]#+__swizzled_vec__&+# for each operator inherited from the [code]#vec# - class template interface which would return [code]#vec&#. +==== The [code]#+__swizzled_vec__+# class + +The [code]#+__swizzled_vec__+# class is a view over a [code]#vec# object which +reflects a swizzle operation. +The tables below define the interface to this class, but in general it supports +the same interface as [code]#vec#. +Member functions and operators that read elements from the +[code]#+__swizzled_vec__+# return the values of elements from the underlying +[code]#vec# as if it had been modified by the swizzle operation. +Member functions and operators that modify elements of the +[code]#+__swizzled_vec__+# modify corresponding elements of the underlying +[code]#vec# as translated by the swizzle operation. +The following example illustrates this behavior: + +[source,,linenums] +---- +include::{code_dir}/swizzle-example.cpp[lines=4..-1] +---- + +A synopsis of the [code]#+__swizzled_vec__+# class is shown below. +The member type aliases are described in <>, the +constructors are described in <>, the member +functions are described in <>, and the hidden friend +functions are described in <>. + +The [code]#+__swizzled_vec__+# type is a class template, but the template +parameters are unspecified. +The description below describes the member functions and hidden friend functions +using two exposition-only private members named [code]#DataT# and +[code]#NumElements#. +[code]#DataT# represents the element type of the underlying [code]#vec#. +[code]#NumElements# represents the number of elements in the result of the +swizzle operation, which could be different from the number of elements in the +underlying [code]#vec#. + +The [code]#+__swizzled_vec__+# class is not user constructible. + +// Interface for class: __swizzled_vec__ +[source,,linenums] +---- +include::{header_dir}/swizzled-vec.h[lines=4..-1] +---- + +[[table.types.swizzled-vec]] +.Member type aliases for the [code]#+__swizzled_vec__+# class template +[separator="@"] +|==== +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +using element_type = DataT +using value_type = DataT +---- +!==== +Each of these type aliases tells the type of an element in the underlying +[code]#vec#. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +#ifdef __SYCL_DEVICE_ONLY__ +using vector_t = /*unspecified*/ +#endif +---- +!==== +This type alias is available only in device code. +The [code]#vector_t# type represents a native vector type of +[code]#NumElements# elements where each element's type is [code]#DataT#. +|==== + +[[table.constructors.swizzled-vec]] +.Constructors for the [code]#+__swizzled_vec__+# class template +[separator="@"] +|==== +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +__swizzled_vec__() = delete +__swizzled_vec__(const __swizzled_vec__&) = delete +---- +!==== +The default constructor and copy constructor are deleted. +|==== + +[[table.members.swizzled-vec]] +.Member functions for the [code]#+__swizzled_vec__+# class template +[separator="@"] +|==== +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +#ifdef __SYCL_DEVICE_ONLY__ +operator vector_t() const +#endif + +operator DataT() const +static constexpr size_t byte_size() noexcept +static constexpr size_t size() noexcept + +size_t get_size() const // Deprecated +size_t get_count() const // Deprecated + +template +vec convert() const + +template asT as() const + +template +void store(size_t offset, multi_ptr ptr) const +---- +!==== +_Constraints:_ These functions have the same constraints as the equivalent +member functions of the [code]#vec# class. + +_Effects:_ The effect of these functions is the same as if they were applied to +a temporary [code]#vec# object that contains the result of the swizzle +operation. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +operator vec() const +---- +!==== +_Constraints:_ Available only when [code]#NumElements > 1#. + +_Returns:_ A new [code]#vec# object that represents the elements of the +[code]#vec# object that underlies the [code]#+__swizzled_vec__+# view with the +swizzle operation applied. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template __swizzled_vec__ swizzle() const + +__swizzled_vec__ XYZW_ACCESS() const +__swizzled_vec__ RGBA_ACCESS() const +__swizzled_vec__ INDEX_ACCESS() const + +#ifdef SYCL_SIMPLE_SWIZZLES +__swizzled_vec__ XYZW_SWIZZLE() const +__swizzled_vec__ RGBA_SWIZZLE() const +#endif + +__swizzled_vec__ lo() const +__swizzled_vec__ hi() const +__swizzled_vec__ odd() const +__swizzled_vec__ even() const +---- +!==== +_Constraints:_ These functions have the same constraints as the equivalent +member functions of the [code]#vec# class. + +_Returns:_ A new [code]#+__swizzled_vec__+# view of the underlying [code]#vec# +object, where the view represents the combination of two swizzle operations. +The first is the swizzle operation represented by the "this" view. +The second is the swizzle operation defined by the member function. +The indices used by the second swizzle are the indices produced by the first +swizzle. +For example, if the second swizzle references the first element, this means the +element of the underlying [code]#vec# that corresponds to the first element +produced by the first swizzle. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template +void load(size_t offset, multi_ptr ptr) +---- +!==== +_Effects:_ Loads values from memory into elements of the underlying [code]#vec# +object. +A total of [code]#NumElements# values are loaded from memory, starting at the +the address [code]#ptr + offset*sizeof(DataT)#. +The first value from memory is written to the element in [code]#vec# that +corresponds to the first element of the swizzle operation. +The second value from memory is written to the element in [code]#vec# that +corresponds to the second element of the swizzle operation, etc. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +DataT& operator[](int index) +const DataT& operator[](int index) const +---- +!==== +_Returns:_ A reference to the element of the underlying [code]#vec# object that +corresponds to the position [code]#index# of the swizzle operation. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template +__swizzled_vec__& operator=(const __swizzled_vec__& rhs) +---- +!==== +_Constraints:_ Available only when the element data type of [code]#rhs# is the +same as [code]#DataT# and when the number of elements in the [code]#rhs# view +is equal to [code]#NumElements#. + +_Effects:_ Assigns elements from the [code]#rhs# [code]#+__swizzled_vec__+# +view to elements of "this" [code]#+__swizzled_vec__+# view. +The value from the [code]#rhs# corresponding to the first element of the +[code]#rhs# swizzle operation is assigned to the element of the underlying +[code]#vec# object that corresponds to the first element of the "this" swizzle +operation, etc. + +The order in which the elements are assigned is unspecified. +Therefore, if the "this" view has any repeated elements in the swizzle, those +elements may receive unspecified values. + +_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +__swizzled_vec__& operator=(const DataT& rhs) +---- +!==== +_Effects:_ Assigns the value [code]#rhs# to those elements of the underlying +[code]#vec# object that have corresponding elements in the +[code]#+__swizzled_vec__+# view. +Elements in the underlying [code]#vec# object that do not have elements in the +[code]#+__swizzled_vec__+# view are not assigned. + +_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +__swizzled_vec__& operator=(const vec& rhs) +---- +!==== +_Effects:_ Assigns elements from [code]#rhs# to elements of the [code]#vec# +object that underlies this [code]#+__swizzled_vec__+# view. +The first element of [code]#rhs# is assigned to the element of the underlying +[code]#vec# object that corresponds to the first element of the swizzle +operation, etc. + +The order in which the elements are assigned is unspecified. +Therefore, if the [code]#+__swizzled_vec__+# view has any repeated elements in +the swizzle, those elements may receive unspecified values. + +_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. +|==== + +[[table.functions.swizzled-vec]] +.Hidden friend functions of the [code]#+__swizzled_vec__+# class template +[separator="@"] +|==== +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template (1) +friend vec operatorOP(const __swizzled_vec__& lhs, + const __swizzled_vec__& rhs) + +friend vec operatorOP(const vec& lhs, (2) + const __swizzled_vec__& rhs); + +friend vec operatorOP(const __swizzled_vec__& lhs, (3) + const vec& rhs) + +friend vec operatorOP(const __swizzled_vec__& lhs, const DataT& rhs) (4) +friend vec operatorOP(const DataT& lhs, const __swizzled_vec__& rhs) (5) +---- +!==== +Where [code]#OP# is: [code]#pass:[+]#, [code]#-#, [code]#*#, [code]#/#, +[code]#%#, [code]#&#, [code]#|#, [code]#^#, [code]#<<#, [code]#>>#. + +_Constraints:_ If [code]#OP# is one of the following: [code]#%#, [code]#&#, +[code]#|#, [code]#^#, [code]#<<#, [code]#>>#; available only when: [code]#DataT +!= float && DataT != double && DataT != half#. + +In addition, overload (1) is available only when the element data type of +[code]#rhs# is the same as [code]#DataT# and when the number of elements in the +[code]#rhs# view is equal to [code]#NumElements#. + +_Effects:_ These functions behave as though the swizzle operation represented +by each [code]#+__swizzled_vec__+# parameter was first evaluated into a +temporary [code]#vec# object, and then [code]#operatorOP# was called with the +temporary [code]#vec# object. + +_Returns:_ A new [code]#vec# object that represents the result of the +operation. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template (1) +friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, + const __swizzled_vec__& rhs) + +friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, (2) + const vec& rhs) + +friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, const DataT& rhs) (3) + +friend vec& operatorOP(vec& lhs, (4) + const __swizzled_vec__& rhs) +---- +!==== +Where [code]#OP# is: [code]#pass:[+=]#, [code]#-=#, [code]#*=#, [code]#/=#, +[code]#%=#, [code]#&=#, [code]#|=#, [code]#^=#, [code]#+<<=+#, [code]#>>=#. + +_Constraints:_ If [code]#OP# is one of the following: [code]#%=#, [code]#&=#, +[code]#|=#, [code]#^=#, [code]#+<<=+#, [code]#>>=#; available only when: +[code]#DataT != float && DataT != double && DataT != half#. + +In addition, overload (1) is available only when the element data type of +[code]#rhs# is the same as [code]#DataT# and when the number of elements in the +[code]#rhs# view is equal to [code]#NumElements#. + +_Effects:_ These functions operate as follow. + +A left hand side value is computed from [code]#lhs#. +If [code]#lhs# is a [code]#+__swizzled_vec__+# view, the swizzle operation is +computed using the underlying [code]#vec# object and the results are used as +the left hand side value. +Otherwise, [code]#lhs# is a [code]#vec# object, and that object is used as the +left hand side value. + +A right hand side value is computed from [code]#rhs# in the same way. + +The non-assignment part of the operation is performed on these two values, +producing a result. +This result is assigned to [code]#lhs# as follows. + +If [code]#lhs# is a [code]#vec# object, each element of the result is assigned +to the corresponding element of [code]#lhs#. +If [code]#lhs# is a [code]#+__swizzled_vec__+# view, the first element of the +result is assigned to the element of the underlying [code]#vec# object that +corresponds to the first element of the swizzle operation, etc. + +_Returns:_ A reference to the [code]#lhs#. +For overloads (1) - (3), this is the [code]#+__swizzled_vec__+# view. +For overload (4), this is the [code]#vec# object. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +friend __swizzled_vec__& operatorOP(__swizzled_vec__& sv) +---- +!==== +Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. + +_Constraints:_ Available only when [code]#DataT# is not [code]#bool#. + +_Effects:_ Perform an in-place element-wise [code]#OP# prefix arithmetic +operation on those elements of the [code]#vec# object that have corresponding +elements in the [code]#sv# view. +Elements in the underlying [code]#vec# object that do not have elements in the +[code]#sv# view are not modified. + +_Returns:_ A reference to the [code]#sv# view. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +friend vec operatorOP(__swizzled_vec__& sv, int) +---- +!==== +Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. + +_Constraints:_ Available only when [code]#DataT# is not [code]#bool#. + +_Effects:_ Perform an in-place element-wise [code]#OP# postfix arithmetic +operation on those elements of the [code]#vec# object that have corresponding +elements in the [code]#sv# view. +Elements in the underlying [code]#vec# object that do not have elements in the +[code]#sv# view are not modified. + +_Returns:_ A new [code]#vec# object that represents the elements of [code]#sv# +after the swizzle operation is applied and before the postfix arithmetic +operation is applied. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +friend vec operatorOP(const __swizzled_vec__& sv) +---- +!==== +Where [code]#OP# is: [code]#pass:[+]#, [code]#-#. + +_Effects:_ These functions behave as though the swizzle operation represented +by the [code]#+__swizzled_vec__+# parameter was first evaluated into a +temporary [code]#vec# object, and then [code]#operatorOP# was applied to the +temporary [code]#vec# object. + +_Returns:_ A [code]#vec# object that represents the result of the operation. + +a@ +[frame=all,grid=none] +!==== +a! +[source] +---- +template (1) +friend vec operatorOP(const __swizzled_vec__& lhs, + const __swizzled_vec__& rhs) + +friend vec operatorOP(const vec& lhs, (2) + const __swizzled_vec__& rhs) + +friend vec operatorOP(const __swizzled_vec__& lhs, (3) + const vec& rhs) + +friend vec operatorOP(const __swizzled_vec__& lhs, const DataT& rhs) (4) +friend vec operatorOP(const DataT& lhs, const __swizzled_vec__& rhs) (5) +---- +!==== +Where [code]#OP# is: [code]#&&#, [code]#||#, [code]#==#, [code]#!=#, [code]#<#, +[code]#>#, [code]#+<=+#, [code]#>=#. + +_Constraints (1):_ Available only when the element data type of [code]#rhs# is +the same as [code]#DataT# and when the number of elements in the [code]#rhs# +view is equal to [code]#NumElements#. + +_Effects:_ These functions behave as though the swizzle operation represented +by each [code]#+__swizzled_vec__+# parameter was first evaluated into a +temporary [code]#vec# object, and then [code]#operatorOP# was called with the +temporary [code]#vec# object. + +_Returns:_ A [code]#vec# object that represents the result of the operation. + +a@ +[frame=all,grid=none,separator="#"] +!==== +a# +[source] +---- +friend vec operator~(const __swizzled_vec__& sv) (1) +friend vec operator!(const __swizzled_vec__& sv) (2) +---- +!==== +_Constraints (1):_ Available only when: [code]#DataT != float && DataT != +double && DataT != half#. + +_Effects:_ These functions behave as though the swizzle operation represented +by the [code]#+__swizzled_vec__+# parameter was first evaluated into a +temporary [code]#vec# object, and then the bitwise or logical NOT operation was +applied to the temporary [code]#vec# object. + +_Returns:_ A [code]#vec# object that represents the result of the operation. +|==== ==== Rounding modes diff --git a/adoc/code/swizzle-example.cpp b/adoc/code/swizzle-example.cpp new file mode 100644 index 00000000..2a6567ab --- /dev/null +++ b/adoc/code/swizzle-example.cpp @@ -0,0 +1,14 @@ +// Copyright (c) 2011-2023 The Khronos Group, Inc. +// SPDX-License-Identifier: Apache-2.0 + +#include +using namespace sycl; // (optional) avoids need for "sycl::" before SYCL names + +int main() { + vec v{5, 6, 7, 8}; + vec slice = v.swizzle<2,1>(); // slice has the value {7,6} + slice = v.swizzle<2,2>(); // slice is now {7,7} + int i = v.swizzle<2,1>()[1]; // i has the value 6 + v.swizzle<2>() = 0; // v is now {5,6,0,8} + v.swizzle<1>()++; // v is now {5,7,0,8} +} diff --git a/adoc/headers/swizzled-vec.h b/adoc/headers/swizzled-vec.h new file mode 100644 index 00000000..b56d7366 --- /dev/null +++ b/adoc/headers/swizzled-vec.h @@ -0,0 +1,18 @@ +// Copyright (c) 2011-2023 The Khronos Group, Inc. +// SPDX-License-Identifier: Apache-2.0 + +namespace /*unspecified*/ { + +template +class __swizzled_vec__ { + private: + // The "DataT" and "NumElements" members are exposition-only + using DataT = /* element type of the underlying vec */; + static constexpr int NumElements = /* number of elements produced by the swizzle */; + + public: + // Public members as defined in the tables below + // Hidden friend functions as defined in the table below +}; + +} // namespace From 0271b4e1c1dad3348f526d441ff34ea1a5877aa3 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 8 Dec 2023 08:39:08 -0500 Subject: [PATCH 02/17] Tweak introduction of swizzled_vec Improve the wording in the introduction of the section on `__swizzled_vec__` based on review comment feedback. --- adoc/chapters/programming_interface.adoc | 9 +++++---- adoc/code/swizzle-example.cpp | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index c182796d..fb7ce597 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17638,15 +17638,16 @@ member function template. ==== The [code]#+__swizzled_vec__+# class The [code]#+__swizzled_vec__+# class is a view over a [code]#vec# object which -reflects a swizzle operation. +captures the effects of a swizzle operation without actually performing that +operation. The tables below define the interface to this class, but in general it supports the same interface as [code]#vec#. Member functions and operators that read elements from the -[code]#+__swizzled_vec__+# return the values of elements from the underlying -[code]#vec# as if it had been modified by the swizzle operation. +[code]#+__swizzled_vec__+# return elements from the underlying [code]#vec# as +translated by the captured swizzle operation. Member functions and operators that modify elements of the [code]#+__swizzled_vec__+# modify corresponding elements of the underlying -[code]#vec# as translated by the swizzle operation. +[code]#vec# as translated by the captured swizzle operation. The following example illustrates this behavior: [source,,linenums] diff --git a/adoc/code/swizzle-example.cpp b/adoc/code/swizzle-example.cpp index 2a6567ab..8be04fe8 100644 --- a/adoc/code/swizzle-example.cpp +++ b/adoc/code/swizzle-example.cpp @@ -11,4 +11,6 @@ int main() { int i = v.swizzle<2,1>()[1]; // i has the value 6 v.swizzle<2>() = 0; // v is now {5,6,0,8} v.swizzle<1>()++; // v is now {5,7,0,8} + v.swizzle<2,3>(); // Has no effect because result of swizzle is + // neither read nor modified } From 9585110c44a52a9fb2f81b40652f56c4b05ecac8 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Mon, 18 Dec 2023 14:52:40 -0500 Subject: [PATCH 03/17] Add constraint for assignment operators Addresses a code review comment. Some compiler implementations may not allow the lhs of a swizzled vector assignment to have repeated elements, so add a constraint to disallow this. It should be easy to implement this using normal SFINAE techniques. --- adoc/chapters/programming_interface.adoc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index fb7ce597..43e2973f 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17860,9 +17860,13 @@ template __swizzled_vec__& operator=(const __swizzled_vec__& rhs) ---- !==== -_Constraints:_ Available only when the element data type of [code]#rhs# is the -same as [code]#DataT# and when the number of elements in the [code]#rhs# view -is equal to [code]#NumElements#. +_Constraints:_ Available only when all of the following conditions are met: + +* The element data type of [code]#rhs# is the same as [code]#DataT#; +* The number of elements in the [code]#rhs# view is equal to + [code]#NumElements#; and +* The "this" [code]#+__swizzled_vec__+# view does not contain any repeated + elements. _Effects:_ Assigns elements from the [code]#rhs# [code]#+__swizzled_vec__+# view to elements of "this" [code]#+__swizzled_vec__+# view. @@ -17871,10 +17875,6 @@ The value from the [code]#rhs# corresponding to the first element of the [code]#vec# object that corresponds to the first element of the "this" swizzle operation, etc. -The order in which the elements are assigned is unspecified. -Therefore, if the "this" view has any repeated elements in the swizzle, those -elements may receive unspecified values. - _Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. a@ @@ -17886,6 +17886,9 @@ a! __swizzled_vec__& operator=(const DataT& rhs) ---- !==== +_Constraints:_ Available only when the "this" [code]#+__swizzled_vec__+# view +does not contain any repeated elements. + _Effects:_ Assigns the value [code]#rhs# to those elements of the underlying [code]#vec# object that have corresponding elements in the [code]#+__swizzled_vec__+# view. @@ -17903,16 +17906,15 @@ a! __swizzled_vec__& operator=(const vec& rhs) ---- !==== +_Constraints:_ Available only when the "this" [code]#+__swizzled_vec__+# view +does not contain any repeated elements. + _Effects:_ Assigns elements from [code]#rhs# to elements of the [code]#vec# object that underlies this [code]#+__swizzled_vec__+# view. The first element of [code]#rhs# is assigned to the element of the underlying [code]#vec# object that corresponds to the first element of the swizzle operation, etc. -The order in which the elements are assigned is unspecified. -Therefore, if the [code]#+__swizzled_vec__+# view has any repeated elements in -the swizzle, those elements may receive unspecified values. - _Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. |==== From f71b77eb30debc2d641711f6a2adbdbf448c7223 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Tue, 19 Dec 2023 11:19:33 -0500 Subject: [PATCH 04/17] Clarify "__swizzled_vec__" Clarify the distinction between `__swizzled_vec__` and `__swizzled_vec__` when used in the synopses. --- adoc/chapters/programming_interface.adoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 43e2973f..fbdb2205 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17661,6 +17661,8 @@ constructors are described in <>, the member functions are described in <>, and the hidden friend functions are described in <>. +The [code]#+__swizzled_vec__+# class is not user constructible. + The [code]#+__swizzled_vec__+# type is a class template, but the template parameters are unspecified. The description below describes the member functions and hidden friend functions @@ -17671,7 +17673,13 @@ using two exposition-only private members named [code]#DataT# and swizzle operation, which could be different from the number of elements in the underlying [code]#vec#. -The [code]#+__swizzled_vec__+# class is not user constructible. +When the string [code]#+__swizzled_vec__+# is used inside the class definition +in the synopses below, it refers to the instantiation with the same set of +template parameters as the enclosing class. +This is consistent with {cpp} syntax. +When the string [code]#+__swizzled_vec__+# is used inside the +class definition, it refers to a possibly different instantiation of the +[code]#+__swizzled_vec__+# class. // Interface for class: __swizzled_vec__ [source,,linenums] From cd14ca9417196406c04eb7cb15a50f5105d30f16 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Thu, 21 Dec 2023 09:45:37 -0500 Subject: [PATCH 05/17] Avoid use of "this" (in quotes) I got feedback that the convention of putting quotes around "this" to indicate the C++ "this" object was confusing. I did this in cases where there was some ambiguity about which `__swizzled_vec__` we are referring to. Reword these sentences to find another way to clarify the ambiguity. --- adoc/chapters/programming_interface.adoc | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index fbdb2205..03a0b47c 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17818,7 +17818,8 @@ member functions of the [code]#vec# class. _Returns:_ A new [code]#+__swizzled_vec__+# view of the underlying [code]#vec# object, where the view represents the combination of two swizzle operations. -The first is the swizzle operation represented by the "this" view. +The first is the swizzle operation represented by the [code]#+__swizzled_vec__+# +view. The second is the swizzle operation defined by the member function. The indices used by the second swizzle are the indices produced by the first swizzle. @@ -17873,17 +17874,16 @@ _Constraints:_ Available only when all of the following conditions are met: * The element data type of [code]#rhs# is the same as [code]#DataT#; * The number of elements in the [code]#rhs# view is equal to [code]#NumElements#; and -* The "this" [code]#+__swizzled_vec__+# view does not contain any repeated - elements. +* The [code]#+__swizzled_vec__+# view (i.e. the left hand side of the + assignment) does not contain any repeated elements. _Effects:_ Assigns elements from the [code]#rhs# [code]#+__swizzled_vec__+# -view to elements of "this" [code]#+__swizzled_vec__+# view. -The value from the [code]#rhs# corresponding to the first element of the -[code]#rhs# swizzle operation is assigned to the element of the underlying -[code]#vec# object that corresponds to the first element of the "this" swizzle -operation, etc. +view to elements of the left hand side [code]#+__swizzled_vec__+# view. +The value corresponding to the first element of the [code]#rhs# swizzle +operation is assigned to the element of the underlying [code]#vec# object that +corresponds to the first element of the left hand side swizzle operation, etc. -_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the left hand side [code]#+__swizzled_vec__+# view. a@ [frame=all,grid=none] @@ -17894,8 +17894,8 @@ a! __swizzled_vec__& operator=(const DataT& rhs) ---- !==== -_Constraints:_ Available only when the "this" [code]#+__swizzled_vec__+# view -does not contain any repeated elements. +_Constraints:_ Available only when the [code]#+__swizzled_vec__+# view does not +contain any repeated elements. _Effects:_ Assigns the value [code]#rhs# to those elements of the underlying [code]#vec# object that have corresponding elements in the @@ -17903,7 +17903,7 @@ _Effects:_ Assigns the value [code]#rhs# to those elements of the underlying Elements in the underlying [code]#vec# object that do not have elements in the [code]#+__swizzled_vec__+# view are not assigned. -_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the [code]#+__swizzled_vec__+# view. a@ [frame=all,grid=none] @@ -17914,8 +17914,8 @@ a! __swizzled_vec__& operator=(const vec& rhs) ---- !==== -_Constraints:_ Available only when the "this" [code]#+__swizzled_vec__+# view -does not contain any repeated elements. +_Constraints:_ Available only when the [code]#+__swizzled_vec__+# view does not +contain any repeated elements. _Effects:_ Assigns elements from [code]#rhs# to elements of the [code]#vec# object that underlies this [code]#+__swizzled_vec__+# view. @@ -17923,7 +17923,7 @@ The first element of [code]#rhs# is assigned to the element of the underlying [code]#vec# object that corresponds to the first element of the swizzle operation, etc. -_Returns:_ A reference to the "this" [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the [code]#+__swizzled_vec__+# view. |==== [[table.functions.swizzled-vec]] From 0d9fbfb56f79aed7dab8b075d5252f4e07a3fe4d Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 15 Mar 2024 17:13:42 -0400 Subject: [PATCH 06/17] Make swizzle view members const We discovered after some implemenation experience that the definitions proposed in the early commits of this PR don't support all of the desired use cases. A simple example is: ``` sycl::vec v; v.swizzle<1>()++; ``` This won't compile because the declaration of `operator++` takes a mutable reference to the swizzle object: ``` friend vec operator++(__swizzled_vec__& sv, int); ``` C++ language rules prohibit binding the temporary object returned by `v.swizzle<>()` to the mutable l-value reference parameter to `operator++`. To fix this, we changed all the swizzle operators to take a `const` reference to the swizzle object. This makes sense because the swizzle class is a view over the underlying `vec`, and member functions on a view class are normally `const`, even for functions that mutate the object that underlies the view. The logic here is that the view itself is not modified, only the object referenced by the view. This raises a new problem, though, because we don't want to allow code to change a `const vec` via a swizzle. For example, code like this should result in a diagnostic: ``` const sycl::vec v; v.swizzle<1>()++; ``` To fix this, we replace `__swizzled_vec__` with two classes: `__writeable_swizzle__` and `__const_swizzle__`. We use `__const_swizzle__` for swizzles of `const vec`, and this class provides only the non-mutating operators. --- adoc/chapters/programming_interface.adoc | 542 +++++++++++++++-------- adoc/headers/swizzled-vec.h | 14 +- adoc/headers/vec.h | 33 +- 3 files changed, 405 insertions(+), 184 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index b152a078..be3cf93c 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17101,18 +17101,27 @@ template asT as() const a@ [source] ---- -template __swizzled_vec__ swizzle() const +template __writeable_swizzle__ swizzle() +template __const_swizzle__ swizzle() const ---- - a@ Return an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. + a@ Return an instance of the implementation-defined + [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# class + representing a swizzled view of the vector as described in + <>. + The [code]#swizzleIndexes# argument pack specifies the elements in the + swizzle. a@ [source] ---- -__swizzled_vec__ XYZW_ACCESS() const +__writeable_swizzle__ XYZW_ACCESS() +__const_swizzle__ XYZW_ACCESS() const ---- a@ Available only when: [code]#+NumElements <= 4+#. -Returns an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. Where [code]#XYZW_ACCESS# is: [code]#x# for [code]#NumElements == 1#, [code]#x, y# for @@ -17125,20 +17134,27 @@ Where [code]#XYZW_ACCESS# is: [code]#x# for [code]#NumElements == 1#, a@ [source] ---- -__swizzled_vec__ RGBA_ACCESS() const +__writeable_swizzle__ RGBA_ACCESS() +__const_swizzle__ RGBA_ACCESS() const ---- a@ Available only when: [code]#NumElements == 4#. -Returns an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. Where [code]#RGBA_ACCESS# is: [code]#r, g, b, a#. a@ [source] ---- -__swizzled_vec__ INDEX_ACCESS() const +__writeable_swizzle__ INDEX_ACCESS() +__const_swizzle__ INDEX_ACCESS() const ---- - a@ Returns an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. + a@ Return an instance of the implementation-defined + [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# class + representing a swizzled view of the vector as described in + <>. Where [code]#INDEX_ACCESS# is: [code]#s0# for [code]#NumElements == 1#, [code]#s0, s1# for @@ -17155,11 +17171,14 @@ Where [code]#INDEX_ACCESS# is: [code]#s0# for [code]#NumElements == 1#, a@ [source] ---- -__swizzled_vec__ XYZW_SWIZZLE() const +__writeable_swizzle__ XYZW_SWIZZLE() +__const_swizzle__ XYZW_SWIZZLE() const ---- a@ Available only when: [code]#+NumElements <= 4+#, and when the macro [code]#SYCL_SIMPLE_SWIZZLES# is defined before including [code]##. -Returns an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. Where XYZW_SWIZZLE is all permutations with repetition, of any subset with length greater than [code]#1#, of [code]#x, y# for [code]#NumElements == 2#, @@ -17171,11 +17190,14 @@ Where XYZW_SWIZZLE is all permutations with repetition, of any subset with lengt a@ [source] ---- -__swizzled_vec__ RGBA_SWIZZLE() const +__writeable_swizzle__ RGBA_SWIZZLE() +__const_swizzle__ RGBA_SWIZZLE() const ---- a@ Available only when: [code]#NumElements == 4#, and when the macro [code]#SYCL_SIMPLE_SWIZZLES# is defined before including [code]##. -Returns an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence which can be used to apply the swizzle in a valid expression as described in <>. +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. Where RGBA_SWIZZLE is all permutations with repetition, of any subset with length greater than [code]#1#, of [code]#r, g, b, a#. For example a four element [code]#vec# provides permutations including [code]#rbga#, [code]#rggg# and [code]#rb#. @@ -17183,42 +17205,62 @@ For example a four element [code]#vec# provides permutations including [code]#rb a@ [source] ---- -__swizzled_vec__ lo() const +__writeable_swizzle__ lo() +__const_swizzle__ lo() const ---- a@ Available only when: [code]#NumElements > 1#. -Return an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence made up of the lower half of this SYCL vec which can be used to apply the swizzle in a valid expression as described in <>. When [code]#NumElements == 3#, this SYCL [code]#vec# is treated as though +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. +The swizzle consists of the lower half of the elements in the vector. +When [code]#NumElements == 3#, the vector is treated as though [code]#NumElements == 4# with the fourth element undefined. a@ [source] ---- -__swizzled_vec__ hi() const +__writeable_swizzle__ hi() +__const_swizzle__ hi() const ---- a@ Available only when: [code]#NumElements > 1#. -Return an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence made up of the upper half of this SYCL vec which can be used to apply the swizzle in a valid expression as described in <>. When [code]#NumElements == 3#, this SYCL [code]#vec# is treated as though +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. +The swizzle consists of the upper half of the elements in the vector. +When [code]#NumElements == 3#, the vector is treated as though [code]#NumElements == 4# with the fourth element undefined. a@ [source] ---- -__swizzled_vec__ odd() const +__writeable_swizzle__ odd() +__const_swizzle__ odd() const ---- a@ Available only when: [code]#NumElements > 1#. -Return an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence made up of the odd indexes of this SYCL vec which can be used to apply the swizzle in a valid expression as described in <>. When [code]#NumElements == 3#, this SYCL [code]#vec# is treated as though +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. +The swizzle consists of the elements in the vector with an odd numbered index. +When [code]#NumElements == 3#, the vector is treated as though [code]#NumElements == 4# with the fourth element undefined. a@ [source] ---- -__swizzled_vec__ even() const +__writeable_swizzle__ even() +__const_swizzle__ even() const ---- a@ Available only when: [code]#NumElements > 1#. -Return an instance of the implementation-defined intermediate class template [code]#+__swizzled_vec__+# representing an index sequence made up of the even indexes of this SYCL vec which can be used to apply the swizzle in a valid expression as described in <>. When [code]#NumElements == 3#, this SYCL [code]#vec# is treated as though +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. +The swizzle consists of the elements in the vector with an even numbered index. +When [code]#NumElements == 3#, the vector is treated as though [code]#NumElements == 4# with the fourth element undefined. a@ @@ -17625,13 +17667,17 @@ Note that the simple swizzle functions are only available for up to 4 element vectors and are only available when the macro [code]#SYCL_SIMPLE_SWIZZLES# is defined before including [code]##. -In both cases the return type is always an instance of -[code]#+__swizzled_vec__+#, an implementation-defined temporary class -representing the result of the swizzle operation on the original [code]#vec# -instance. -Since the swizzle operation may result in a different number of elements, the -[code]#+__swizzled_vec__+# instance may represent a different number of elements -than the original [code]#vec#. +In both cases the return value is an instance of either the +[code]#+__writeable_swizzle__+# or the [code]#+__const_swizzle__+# class +template. +These classes have an implementation-defined name, and they represent a view of +the original [code]#vec# object with the swizzle operation applied. +The [code]#+__writeable_swizzle__+# class represents a writeable view of the +[code]#vec# object, while the [code]#+__const_swizzle__+# class represents a +read-only view. +Since the swizzle operation may result in a different number of elements, these +views may represent a different number of elements than the original [code]#vec# +object. Both the [code]#swizzle# member function template and the simple swizzle member functions allow swizzle indexes to be repeated. @@ -17642,19 +17688,21 @@ member function template. [[swizzled-vec-class]] -==== The [code]#+__swizzled_vec__+# class - -The [code]#+__swizzled_vec__+# class is a view over a [code]#vec# object which -captures the effects of a swizzle operation without actually performing that +==== The swizzled vector classes + +The [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# classes are +each views over a [code]#vec# object which captures the effects of a swizzle +operation without actually performing that operation. +The tables below define the interfaces to these classes, but in general +[code]#+__writeable_swizzle__+# supports the same interface as [code]#vec#, +while [code]#+__const_swizzle__+# supports only the non-mutating operations of +[code]#vec#. +Member functions and operators that read elements from these views return +elements from the underlying [code]#vec# as translated by the captured swizzle operation. -The tables below define the interface to this class, but in general it supports -the same interface as [code]#vec#. -Member functions and operators that read elements from the -[code]#+__swizzled_vec__+# return elements from the underlying [code]#vec# as -translated by the captured swizzle operation. -Member functions and operators that modify elements of the -[code]#+__swizzled_vec__+# modify corresponding elements of the underlying -[code]#vec# as translated by the captured swizzle operation. +Member functions and operators that modify elements of these views modify +corresponding elements of the underlying [code]#vec# as translated by the +captured swizzle operation. The following example illustrates this behavior: [source,,linenums] @@ -17662,40 +17710,48 @@ The following example illustrates this behavior: include::{code_dir}/swizzle-example.cpp[lines=4..-1] ---- -A synopsis of the [code]#+__swizzled_vec__+# class is shown below. +Synopses of the [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# +classes are shown below. The member type aliases are described in <>, the constructors are described in <>, the member functions are described in <>, and the hidden friend functions are described in <>. -The [code]#+__swizzled_vec__+# class is not user constructible. +The [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# classes are +not user constructible. -The [code]#+__swizzled_vec__+# type is a class template, but the template -parameters are unspecified. +The [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# types are +class templates, but the template parameters are unspecified. The description below describes the member functions and hidden friend functions using two exposition-only private members named [code]#DataT# and [code]#NumElements#. -[code]#DataT# represents the element type of the underlying [code]#vec#. -[code]#NumElements# represents the number of elements in the result of the -swizzle operation, which could be different from the number of elements in the -underlying [code]#vec#. - -When the string [code]#+__swizzled_vec__+# is used inside the class definition -in the synopses below, it refers to the instantiation with the same set of -template parameters as the enclosing class. +The type alias [code]#DataT# represents the element type of the underlying +[code]#vec#. +The constant [code]#NumElements# represents the number of elements in the result +of the swizzle operation, which could be different from the number of elements +in the underlying [code]#vec#. + +When the string [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# +is used inside the class definition in the synopses below, it refers to the +instantiation with the same set of template parameters as the enclosing class. This is consistent with {cpp} syntax. -When the string [code]#+__swizzled_vec__+# is used inside the -class definition, it refers to a possibly different instantiation of the -[code]#+__swizzled_vec__+# class. +When the string [code]#+__writeable_swizzle__+# or +[code]#+__const_swizzle__+# is used inside the class +definition, it refers to a possibly different instantiation of the +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# class. + +Although the synopses below illustrate [code]#+__writeable_swizzle__+# and +[code]#+__const_swizzle__+# as two separate classes, this is exposition only. +An implementation could instead implement a single combined class with +additional constraints on the member functions. -// Interface for class: __swizzled_vec__ [source,,linenums] ---- include::{header_dir}/swizzled-vec.h[lines=4..-1] ---- [[table.types.swizzled-vec]] -.Member type aliases for the [code]#+__swizzled_vec__+# class template +.Member type aliases for the swizzled vector class templates [separator="@"] |==== a@ @@ -17723,12 +17779,11 @@ using vector_t = /*unspecified*/ ---- !==== This type alias is available only in device code. -The [code]#vector_t# type represents a native vector type of -[code]#NumElements# elements where each element's type is [code]#DataT#. -|==== +The [code]#vector_t# type represents a native vector type of [code]#NumElements# +elements where each element's type is [code]#DataT#. [[table.constructors.swizzled-vec]] -.Constructors for the [code]#+__swizzled_vec__+# class template +.Constructors for the swizzled vector class templates [separator="@"] |==== a@ @@ -17737,15 +17792,22 @@ a@ a! [source] ---- -__swizzled_vec__() = delete -__swizzled_vec__(const __swizzled_vec__&) = delete +__writeable_swizzle__() = delete +__writeable_swizzle__(const __writeable_swizzle__&) = delete + +__const_swizzle__() = delete +__const_swizzle__(const __const_swizzle__&) = delete + +__const_swizzle__& operator=(const __const_swizzle__&) = delete ---- !==== The default constructor and copy constructor are deleted. + +The copy assignment operator for [code]#+__const_swizzle__+# is deleted. |==== [[table.members.swizzled-vec]] -.Member functions for the [code]#+__swizzled_vec__+# class template +.Member functions for the swizzled vector class templates [separator="@"] |==== a@ @@ -17775,6 +17837,9 @@ template void store(size_t offset, multi_ptr ptr) const ---- !==== +_Availability:_ These functions are available in both +[code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+#. + _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. @@ -17791,11 +17856,13 @@ a! operator vec() const ---- !==== +_Availability:_ These functions are available in both +[code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+#. + _Constraints:_ Available only when [code]#NumElements > 1#. _Returns:_ A new [code]#vec# object that represents the elements of the -[code]#vec# object that underlies the [code]#+__swizzled_vec__+# view with the -swizzle operation applied. +[code]#vec# object that underlies the view with the swizzle operation applied. a@ [frame=all,grid=none] @@ -17803,30 +17870,51 @@ a@ a! [source] ---- -template __swizzled_vec__ swizzle() const +template __writeable_swizzle__ swizzle() const (1) -__swizzled_vec__ XYZW_ACCESS() const -__swizzled_vec__ RGBA_ACCESS() const -__swizzled_vec__ INDEX_ACCESS() const +__writeable_swizzle__ XYZW_ACCESS() const (2) +__writeable_swizzle__ RGBA_ACCESS() const (3) +__writeable_swizzle__ INDEX_ACCESS() const (4) #ifdef SYCL_SIMPLE_SWIZZLES -__swizzled_vec__ XYZW_SWIZZLE() const -__swizzled_vec__ RGBA_SWIZZLE() const +__writeable_swizzle__ XYZW_SWIZZLE() const (5) +__writeable_swizzle__ RGBA_SWIZZLE() const (6) #endif -__swizzled_vec__ lo() const -__swizzled_vec__ hi() const -__swizzled_vec__ odd() const -__swizzled_vec__ even() const +__writeable_swizzle__ lo() const (7) +__writeable_swizzle__ hi() const (8) +__writeable_swizzle__ odd() const (9) +__writeable_swizzle__ even() const (10) + + +template __const_swizzle__ swizzle() const (11) + +__const_swizzle__ XYZW_ACCESS() const (12) +__const_swizzle__ RGBA_ACCESS() const (13) +__const_swizzle__ INDEX_ACCESS() const (14) + +#ifdef SYCL_SIMPLE_SWIZZLES +__const_swizzle__ XYZW_SWIZZLE() const (15) +__const_swizzle__ RGBA_SWIZZLE() const (16) +#endif + +__const_swizzle__ lo() const (17) +__const_swizzle__ hi() const (18) +__const_swizzle__ odd() const (19) +__const_swizzle__ even() const (20) ---- !==== +_Availability:_ Functions (1) - (10) are available only in +[code]#+__writeable_swizzle__+#. +Functions (11) - (20) are available only in [code]#+__const_swizzle__+#. + _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. -_Returns:_ A new [code]#+__swizzled_vec__+# view of the underlying [code]#vec# -object, where the view represents the combination of two swizzle operations. -The first is the swizzle operation represented by the [code]#+__swizzled_vec__+# -view. +_Returns:_ A new view of the underlying [code]#vec# object, where the view +represents the combination of two swizzle operations. +The first is the swizzle operation represented by the +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# view. The second is the swizzle operation defined by the member function. The indices used by the second swizzle are the indices produced by the first swizzle. @@ -17841,9 +17929,11 @@ a! [source] ---- template -void load(size_t offset, multi_ptr ptr) +void load(size_t offset, multi_ptr ptr) const ---- !==== +_Availability:_ Available only in [code]#+__writeable_swizzle__+#. + _Effects:_ Loads values from memory into elements of the underlying [code]#vec# object. A total of [code]#NumElements# values are loaded from memory, starting at the @@ -17859,10 +17949,14 @@ a@ a! [source] ---- -DataT& operator[](int index) -const DataT& operator[](int index) const +DataT& operator[](int index) const (1) +const DataT& operator[](int index) const (2) ---- !==== +_Availability:_ Functions (1) is available only in +[code]#+__writeable_swizzle__+#. +Functions (2) is available only in [code]#+__const_swizzle__+#. + _Returns:_ A reference to the element of the underlying [code]#vec# object that corresponds to the position [code]#index# of the swizzle operation. @@ -17873,24 +17967,31 @@ a! [source] ---- template -__swizzled_vec__& operator=(const __swizzled_vec__& rhs) +const __writeable_swizzle__& operator=(const __writeable_swizzle__& rhs) const + +template +const __writeable_swizzle__& operator=(const __const_swizzle__& rhs) const ---- !==== +_Availability:_ Available only in [code]#+__writeable_swizzle__+#. + _Constraints:_ Available only when all of the following conditions are met: * The element data type of [code]#rhs# is the same as [code]#DataT#; * The number of elements in the [code]#rhs# view is equal to [code]#NumElements#; and -* The [code]#+__swizzled_vec__+# view (i.e. the left hand side of the +* The [code]#+__writeable_swizzle__+# view (i.e. the left hand side of the assignment) does not contain any repeated elements. -_Effects:_ Assigns elements from the [code]#rhs# [code]#+__swizzled_vec__+# -view to elements of the left hand side [code]#+__swizzled_vec__+# view. +_Effects:_ Assigns elements from the right hand side +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# view to elements +of the left hand side [code]#+__writeable_swizzle__+# view. The value corresponding to the first element of the [code]#rhs# swizzle operation is assigned to the element of the underlying [code]#vec# object that corresponds to the first element of the left hand side swizzle operation, etc. -_Returns:_ A reference to the left hand side [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the left hand side [code]#+__writeable_swizzle__+# +view. a@ [frame=all,grid=none] @@ -17898,19 +17999,21 @@ a@ a! [source] ---- -__swizzled_vec__& operator=(const DataT& rhs) +const __writeable_swizzle__& operator=(const DataT& rhs) const ---- !==== -_Constraints:_ Available only when the [code]#+__swizzled_vec__+# view does not -contain any repeated elements. +_Availability:_ Available only in [code]#+__writeable_swizzle__+#. + +_Constraints:_ Available only when the [code]#+__writeable_swizzle__+# view does +not contain any repeated elements. _Effects:_ Assigns the value [code]#rhs# to those elements of the underlying [code]#vec# object that have corresponding elements in the -[code]#+__swizzled_vec__+# view. +[code]#+__writeable_swizzle__+# view. Elements in the underlying [code]#vec# object that do not have elements in the -[code]#+__swizzled_vec__+# view are not assigned. +[code]#+__writeable_swizzle__+# view are not assigned. -_Returns:_ A reference to the [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the [code]#+__writeable_swizzle__+# view. a@ [frame=all,grid=none] @@ -17918,23 +18021,25 @@ a@ a! [source] ---- -__swizzled_vec__& operator=(const vec& rhs) +const __writeable_swizzle__& operator=(const vec& rhs) const ---- !==== -_Constraints:_ Available only when the [code]#+__swizzled_vec__+# view does not -contain any repeated elements. +_Availability:_ Available only in [code]#+__writeable_swizzle__+#. + +_Constraints:_ Available only when the [code]#+__writeable_swizzle__+# view does +not contain any repeated elements. _Effects:_ Assigns elements from [code]#rhs# to elements of the [code]#vec# -object that underlies this [code]#+__swizzled_vec__+# view. +object that underlies this [code]#+__writeable_swizzle__+# view. The first element of [code]#rhs# is assigned to the element of the underlying [code]#vec# object that corresponds to the first element of the swizzle operation, etc. -_Returns:_ A reference to the [code]#+__swizzled_vec__+# view. +_Returns:_ A reference to the [code]#+__writeable_swizzle__+# view. |==== [[table.functions.swizzled-vec]] -.Hidden friend functions of the [code]#+__swizzled_vec__+# class template +.Hidden friend functions of the swizzled vector class templates [separator="@"] |==== a@ @@ -17943,38 +18048,73 @@ a@ a! [source] ---- -template (1) -friend vec operatorOP(const __swizzled_vec__& lhs, - const __swizzled_vec__& rhs) +template (1) +friend vec +operatorOP(const __writeable_swizzle__& lhs, + const __writeable_swizzle__& rhs) + +template (2) +friend vec +operatorOP(const __writeable_swizzle__& lhs, + const __const_swizzle__& rhs) + +template (3) +friend vec +operatorOP(const __const_swizzle__& lhs, + const __writeable_swizzle__& rhs) + +template (4) +friend vec +operatorOP(const __const_swizzle__& lhs, const __const_swizzle__& rhs) + +friend vec (5) +operatorOP(const vec& lhs, const __writeable_swizzle__& rhs) + +friend vec (6) +operatorOP(const vec& lhs, const __const_swizzle__& rhs) -friend vec operatorOP(const vec& lhs, (2) - const __swizzled_vec__& rhs); +friend vec (7) +operatorOP(const __writeable_swizzle__& lhs, const vec& rhs) -friend vec operatorOP(const __swizzled_vec__& lhs, (3) - const vec& rhs) +friend vec (8) +operatorOP(const __const_swizzle__& lhs, const vec& rhs) -friend vec operatorOP(const __swizzled_vec__& lhs, const DataT& rhs) (4) -friend vec operatorOP(const DataT& lhs, const __swizzled_vec__& rhs) (5) +friend vec (9) +operatorOP(const __writeable_swizzle__& lhs, const DataT& rhs) + +friend vec (10) +operatorOP(const __const_swizzle__& lhs, const DataT& rhs) + +friend vec (11) +operatorOP(const DataT& lhs, const __writeable_swizzle__& rhs) + +friend vec (12) +operatorOP(const DataT& lhs, const __const_swizzle__& rhs) ---- !==== Where [code]#OP# is: [code]#pass:[+]#, [code]#-#, [code]#*#, [code]#/#, [code]#%#, [code]#&#, [code]#|#, [code]#^#, [code]#<<#, [code]#>>#. +_Availability:_ Overloads (1), (2), (3), (5), (7), (9), and (11) are hidden +friends of [code]#+__writeable_swizzle__+#. +Overloads (4), (6), (8), (10), and (12) are hidden friends of +[code]#+__const_swizzle__+#. + _Constraints:_ If [code]#OP# is one of the following: [code]#%#, [code]#&#, [code]#|#, [code]#^#, [code]#<<#, [code]#>>#; available only when: [code]#DataT != float && DataT != double && DataT != half#. -In addition, overload (1) is available only when the element data type of -[code]#rhs# is the same as [code]#DataT# and when the number of elements in the -[code]#rhs# view is equal to [code]#NumElements#. +In addition, overloads (1) - (4) are available only when the element data type +of [code]#lhs# is the same as the element data type of [code]#rhs# and when the +number of elements in the [code]#lhs# view is equal to the number of elements in +the [code]#rhs# view. -_Effects:_ These functions behave as though the swizzle operation represented -by each [code]#+__swizzled_vec__+# parameter was first evaluated into a -temporary [code]#vec# object, and then [code]#operatorOP# was called with the -temporary [code]#vec# object. +_Effects:_ These functions behave as though the swizzle operation represented by +each [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# parameter +was first evaluated into a temporary [code]#vec# object, and then +[code]#operatorOP# was called with the temporary [code]#vec# object. -_Returns:_ A new [code]#vec# object that represents the result of the -operation. +_Returns:_ A new [code]#vec# object that represents the result of the operation. a@ [frame=all,grid=none] @@ -17982,54 +18122,56 @@ a@ a! [source] ---- -template (1) -friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, - const __swizzled_vec__& rhs) +template (1) +friend const __writeable_swizzle__& +operatorOP(const __writeable_swizzle__& lhs, + const __writeable_swizzle__& rhs) -friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, (2) - const vec& rhs) +template (2) +friend const __writeable_swizzle__& +operatorOP(const __writeable_swizzle__& lhs, + const __const_swizzle__& rhs) -friend __swizzled_vec__& operatorOP(__swizzled_vec__& lhs, const DataT& rhs) (3) +friend const __writeable_swizzle__& (3) +operatorOP(const __writeable_swizzle__& lhs, const vec& rhs) -friend vec& operatorOP(vec& lhs, (4) - const __swizzled_vec__& rhs) +friend const __writeable_swizzle__& (4) +operatorOP(const __writeable_swizzle__& lhs, const DataT& rhs) ---- !==== Where [code]#OP# is: [code]#pass:[+=]#, [code]#-=#, [code]#*=#, [code]#/=#, [code]#%=#, [code]#&=#, [code]#|=#, [code]#^=#, [code]#+<<=+#, [code]#>>=#. +_Availability:_ These are hidden friend functions only in +[code]#+__writeable_swizzle__+#. + _Constraints:_ If [code]#OP# is one of the following: [code]#%=#, [code]#&=#, [code]#|=#, [code]#^=#, [code]#+<<=+#, [code]#>>=#; available only when: [code]#DataT != float && DataT != double && DataT != half#. -In addition, overload (1) is available only when the element data type of -[code]#rhs# is the same as [code]#DataT# and when the number of elements in the -[code]#rhs# view is equal to [code]#NumElements#. +In addition, overloads (1) and (2) are available only when the element data type +of [code]#lhs# is the same as the element data type of [code]#rhs# and when the +number of elements in the [code]#lhs# view is equal to the number of elements in +the [code]#rhs# view. _Effects:_ These functions operate as follow. -A left hand side value is computed from [code]#lhs#. -If [code]#lhs# is a [code]#+__swizzled_vec__+# view, the swizzle operation is -computed using the underlying [code]#vec# object and the results are used as -the left hand side value. -Otherwise, [code]#lhs# is a [code]#vec# object, and that object is used as the -left hand side value. - -A right hand side value is computed from [code]#rhs# in the same way. +A left hand side value is computed from [code]#lhs# by applying the swizzle +operation on the underlying [code]#vec# object. +If the [code]#rhs# is a [code]#+__writeable_swizzle__+# view, the right hand +side value is computed the same way. +Otherwise, the right hand side value is the same as [code]#rhs#. The non-assignment part of the operation is performed on these two values, producing a result. This result is assigned to [code]#lhs# as follows. -If [code]#lhs# is a [code]#vec# object, each element of the result is assigned -to the corresponding element of [code]#lhs#. -If [code]#lhs# is a [code]#+__swizzled_vec__+# view, the first element of the -result is assigned to the element of the underlying [code]#vec# object that -corresponds to the first element of the swizzle operation, etc. +The first element of the result is assigned to the [code]#vec# element that +corresponds to the first element of the left-hand-side swizzle. +The second element of the result is assigned to the [code]#vec# element that +corresponds to the second element of the left-hand-side swizzle, etc. _Returns:_ A reference to the [code]#lhs#. -For overloads (1) - (3), this is the [code]#+__swizzled_vec__+# view. -For overload (4), this is the [code]#vec# object. a@ [frame=all,grid=none] @@ -18037,11 +18179,14 @@ a@ a! [source] ---- -friend __swizzled_vec__& operatorOP(__swizzled_vec__& sv) +friend const __writeable_swizzle__& operatorOP(const __writeable_swizzle__& sv) ---- !==== Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. +_Availability:_ These are hidden friend functions only in +[code]#+__writeable_swizzle__+#. + _Constraints:_ Available only when [code]#DataT# is not [code]#bool#. _Effects:_ Perform an in-place element-wise [code]#OP# prefix arithmetic @@ -18058,11 +18203,14 @@ a@ a! [source] ---- -friend vec operatorOP(__swizzled_vec__& sv, int) +friend vec operatorOP(const __writeable_swizzle__& sv, int) ---- !==== Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. +_Availability:_ These are hidden friend functions only in +[code]#+__writeable_swizzle__+#. + _Constraints:_ Available only when [code]#DataT# is not [code]#bool#. _Effects:_ Perform an in-place element-wise [code]#OP# postfix arithmetic @@ -18081,15 +18229,20 @@ a@ a! [source] ---- -friend vec operatorOP(const __swizzled_vec__& sv) +friend vec operatorOP(const __writeable_swizzle__& sv) (1) +friend vec operatorOP(const __const_swizzle__& sv) (2) ---- !==== Where [code]#OP# is: [code]#pass:[+]#, [code]#-#. -_Effects:_ These functions behave as though the swizzle operation represented -by the [code]#+__swizzled_vec__+# parameter was first evaluated into a -temporary [code]#vec# object, and then [code]#operatorOP# was applied to the -temporary [code]#vec# object. +_Availability:_ Functions (1) are hidden friends in +[code]#+__writeable_swizzle__+#. +Functions (2) are hidden friends in [code]#+__const_swizzle__+#. + +_Effects:_ These functions behave as though the swizzle operation represented by +the [code]#sv# parameter was first evaluated into a temporary [code]#vec# +object, and then [code]#operatorOP# was applied to the temporary [code]#vec# +object. _Returns:_ A [code]#vec# object that represents the result of the operation. @@ -18100,30 +18253,66 @@ a! [source] ---- template (1) -friend vec operatorOP(const __swizzled_vec__& lhs, - const __swizzled_vec__& rhs) +friend vec +operatorOP(const __writeable_swizzle__& lhs, + const __writeable_swizzle__& rhs) + +template (2) +friend vec +operatorOP(const __writeable_swizzle__& lhs, + const __const_swizzle__& rhs) + +template (3) +friend vec +operatorOP(const __const_swizzle__& lhs, + const __writeable_swizzle__& rhs) + +template (4) +friend vec +operatorOP(const __const_swizzle__& lhs, const __const_swizzle__& rhs) + +friend vec (5) +operatorOP(const vec& lhs, const __writeable_swizzle__& rhs) -friend vec operatorOP(const vec& lhs, (2) - const __swizzled_vec__& rhs) +friend vec (6) +operatorOP(const vec& lhs, const __const_swizzle__& rhs) -friend vec operatorOP(const __swizzled_vec__& lhs, (3) - const vec& rhs) +friend vec (7) +operatorOP(const __writeable_swizzle__& lhs, const vec& rhs) -friend vec operatorOP(const __swizzled_vec__& lhs, const DataT& rhs) (4) -friend vec operatorOP(const DataT& lhs, const __swizzled_vec__& rhs) (5) +friend vec (8) +operatorOP(const __const_swizzle__& lhs, const vec& rhs) + +friend vec (9) +operatorOP(const __writeable_swizzle__& lhs, const DataT& rhs) + +friend vec (10) +operatorOP(const __const_swizzle__& lhs, const DataT& rhs) + +friend vec (11) +operatorOP(const DataT& lhs, const __writeable_swizzle__& rhs) + +friend vec (12) +operatorOP(const DataT& lhs, const __const_swizzle__& rhs) ---- !==== Where [code]#OP# is: [code]#&&#, [code]#||#, [code]#==#, [code]#!=#, [code]#<#, [code]#>#, [code]#+<=+#, [code]#>=#. -_Constraints (1):_ Available only when the element data type of [code]#rhs# is -the same as [code]#DataT# and when the number of elements in the [code]#rhs# -view is equal to [code]#NumElements#. +_Availability:_ Overloads (1), (2), (3), (5), (7), (9), and (11) are hidden +friends of [code]#+__writeable_swizzle__+#. +Overloads (4), (6), (8), (10), and (12) are hidden friends of +[code]#+__const_swizzle__+#. -_Effects:_ These functions behave as though the swizzle operation represented -by each [code]#+__swizzled_vec__+# parameter was first evaluated into a -temporary [code]#vec# object, and then [code]#operatorOP# was called with the -temporary [code]#vec# object. +_Constraints:_ Overloads (1) - (4) are available only when the element data type +of [code]#lhs# is the same as the element data type of [code]#rhs# and when the +number of elements in the [code]#lhs# view is equal to the number of elements in +the [code]#rhs# view. + +_Effects:_ These functions behave as though the swizzle operation represented by +each [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# parameter +was first evaluated into a temporary [code]#vec# object, and then +[code]#operatorOP# was called with the temporary [code]#vec# object. _Returns:_ A [code]#vec# object that represents the result of the operation. @@ -18133,17 +18322,24 @@ a@ a# [source] ---- -friend vec operator~(const __swizzled_vec__& sv) (1) -friend vec operator!(const __swizzled_vec__& sv) (2) +friend vec operator~(const __writeable_swizzle__& sv) (1) +friend vec operator~(const __const_swizzle__& sv) (2) + +friend vec operator!(const __writeable_swizzle__& sv) (3) +friend vec operator!(const __const_swizzle__& sv) (4) ---- !==== -_Constraints (1):_ Available only when: [code]#DataT != float && DataT != -double && DataT != half#. +_Availability:_ Overloads (1) and (3) are hidden friends of +[code]#+__writeable_swizzle__+#. +Overloads (2) and (4) are hidden friends of [code]#+__const_swizzle__+#. + +_Constraints:_ Overloads (1) - (2) are available only when: [code]#DataT != +float && DataT != double && DataT != half#. -_Effects:_ These functions behave as though the swizzle operation represented -by the [code]#+__swizzled_vec__+# parameter was first evaluated into a -temporary [code]#vec# object, and then the bitwise or logical NOT operation was -applied to the temporary [code]#vec# object. +_Effects:_ These functions behave as though the swizzle operation represented by +the [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# parameter was +first evaluated into a temporary [code]#vec# object, and then the bitwise or +logical NOT operation was applied to the temporary [code]#vec# object. _Returns:_ A [code]#vec# object that represents the result of the operation. |==== diff --git a/adoc/headers/swizzled-vec.h b/adoc/headers/swizzled-vec.h index b56d7366..c3a8cf65 100644 --- a/adoc/headers/swizzled-vec.h +++ b/adoc/headers/swizzled-vec.h @@ -4,7 +4,19 @@ namespace /*unspecified*/ { template -class __swizzled_vec__ { +class __writeable_swizzle__ { + private: + // The "DataT" and "NumElements" members are exposition-only + using DataT = /* element type of the underlying vec */; + static constexpr int NumElements = /* number of elements produced by the swizzle */; + + public: + // Public members as defined in the tables below + // Hidden friend functions as defined in the table below +}; + +template +class __const_swizzle__ { private: // The "DataT" and "NumElements" members are exposition-only using DataT = /* element type of the underlying vec */; diff --git a/adoc/headers/vec.h b/adoc/headers/vec.h index 18ffbe3e..60ce2ebb 100644 --- a/adoc/headers/vec.h +++ b/adoc/headers/vec.h @@ -74,37 +74,50 @@ template class vec { template AsT as() const; - template __swizzled_vec__ swizzle() const; + template __writeable_swizzle__ swizzle(); + template __const_swizzle__ swizzle() const; // Available only when NumElements <= 4. // XYZW_ACCESS is: x, y, z, w, subject to NumElements. - __swizzled_vec__ XYZW_ACCESS() const; + __writeable_swizzle__ XYZW_ACCESS(); + __const_swizzle__ XYZW_ACCESS() const; // Available only NumElements == 4. // RGBA_ACCESS is: r, g, b, a. - __swizzled_vec__ RGBA_ACCESS() const; + __writeable_swizzle__ RGBA_ACCESS(); + __const_swizzle__ RGBA_ACCESS() const; // INDEX_ACCESS is: s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, // sE, sF, subject to NumElements. - __swizzled_vec__ INDEX_ACCESS() const; + __writeable_swizzle__ INDEX_ACCESS(); + __const_swizzle__ INDEX_ACCESS() const; #ifdef SYCL_SIMPLE_SWIZZLES // Available only when NumElements <= 4. // XYZW_SWIZZLE is all permutations with repetition of: x, y, z, w, subject to // NumElements. - __swizzled_vec__ XYZW_SWIZZLE() const; + __writeable_swizzle__ XYZW_SWIZZLE(); + __const_swizzle__ XYZW_SWIZZLE() const; // Available only when NumElements == 4. // RGBA_SWIZZLE is all permutations with repetition of: r, g, b, a. - __swizzled_vec__ RGBA_SWIZZLE() const; + __writeable_swizzle__ RGBA_SWIZZLE(); + __const_swizzle__ RGBA_SWIZZLE() const; #endif // #ifdef SYCL_SIMPLE_SWIZZLES // Available only when: NumElements > 1. - __swizzled_vec__ lo() const; - __swizzled_vec__ hi() const; - __swizzled_vec__ odd() const; - __swizzled_vec__ even() const; + __writeable_swizzle__ lo(); + __const_swizzle__ lo() const; + + __writeable_swizzle__ hi(); + __const_swizzle__ hi() const; + + __writeable_swizzle__ odd(); + __const_swizzle__ odd() const; + + __writeable_swizzle__ even(); + __const_swizzle__ even() const; // load and store member functions template From 662d79c9e5d7b84a29c04a72830fd076e2501be1 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 15 Mar 2024 14:00:32 -0400 Subject: [PATCH 07/17] Change builtin functions to use either swizzle Now that we have two swizzle types (`__writeable_swizzle__` and `__const_swizzle__`), change the builtin functions to accept either of them. --- adoc/chapters/programming_interface.adoc | 975 ++++++++++++----------- 1 file changed, 512 insertions(+), 463 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index be3cf93c..d15905cc 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21515,6 +21515,13 @@ to represent the following address spaces: * [code]#access::address_space::private_space# * [code]#access::address_space::generic_space# +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + [[table.math.functions]] .Math functions [separator="@"] @@ -21543,13 +21550,13 @@ _Returns:_ The inverse cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21576,14 +21583,14 @@ _Returns:_ The inverse hyperbolic cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse hyperbolic cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21610,14 +21617,14 @@ _Returns:_ The value [code]#acos(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#acos(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21644,13 +21651,13 @@ _Returns:_ The inverse sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21677,14 +21684,14 @@ _Returns:_ The inverse hyperbolic sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse hyperbolic sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21711,13 +21718,13 @@ _Returns:_ The value [code]#asin(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#asin(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21744,13 +21751,13 @@ _Returns:_ The inverse tangent of the input. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of the input, the inverse tangent of the element. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21780,7 +21787,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -21790,7 +21797,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the arc tangent of [code]#y[i] / x[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21817,14 +21824,14 @@ _Returns:_ The hyperbolic inverse tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic inverse tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21851,13 +21858,13 @@ _Returns:_ The value [code]#atan(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#atan(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21887,7 +21894,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -21897,7 +21904,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#atan2(y[i], x[i]) / {pi}#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21924,13 +21931,13 @@ _Returns:_ The cube-root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the cube-root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21958,14 +21965,14 @@ positive infinity rounding mode. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to positive infinity rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -21996,7 +22003,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22006,7 +22013,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# with its sign changed to match the sign of [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22033,13 +22040,13 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22066,14 +22073,14 @@ _Returns:_ The hyperbolic cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22100,13 +22107,13 @@ _Returns:_ The value [code]#cos({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#cos({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22133,14 +22140,14 @@ _Returns:_ The complementary error function of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the complementary error function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22168,13 +22175,13 @@ normal distribution). _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the error function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22201,14 +22208,14 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22235,14 +22242,14 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22269,14 +22276,14 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22303,13 +22310,13 @@ _Returns:_ The value [code]#e^x^-1.0#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#e^x[i]^-1.0#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22336,13 +22343,13 @@ _Returns:_ The absolute value of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the absolute value of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22372,7 +22379,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22382,7 +22389,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] - y[i]# if [code]#x[i] > y[i]#, otherwise +0. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22410,14 +22417,14 @@ negative infinity rounding mode. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to negative infinity rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22451,7 +22458,7 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# are each [code]#marray#; or ** [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# are any - combination of [code]#vec# and the [code]#+__swizzled_vec__+# type; + combination of [code]#vec# and the [code]#+__swizzle__+# type; * [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# have the same number of elements; * [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# have the same @@ -22466,7 +22473,7 @@ intermediate products shall not occur. Edge case behavior is per the IEEE 754-2008 standard. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22500,7 +22507,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22511,7 +22518,7 @@ if [code]#x[i] < y[i]#, otherwise [code]#x[i]#. If one element is a NaN, the result is the other element. If both elements are NaNs, the result is NaN. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (5):* @@ -22519,7 +22526,7 @@ corresponding [code]#vec#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#y# if @@ -22527,7 +22534,7 @@ _Returns:_ For each element of [code]#x#, the value [code]#y# if the other value. If both value are NaNs, the result is a NaN. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22561,7 +22568,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22572,7 +22579,7 @@ if [code]#y[i] < x[i]#, otherwise [code]#x[i]#. If one element is a NaN, the result is the other element. If both elements are NaNs, the result is NaN. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (5):* @@ -22580,7 +22587,7 @@ corresponding [code]#vec#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#y# if @@ -22588,7 +22595,7 @@ _Returns:_ For each element of [code]#x#, the value [code]#y# if the other value. If both value are NaNs, the result is a NaN. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22618,7 +22625,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22628,7 +22635,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] - y[i] * trunc(x[i]/y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22667,10 +22674,10 @@ where [code]#T# is the type of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type with element type [code]#float#, + [code]#+__swizzle__+# type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is [code]#multi_ptr# with [code]#ElementType# equal to - [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzled_vec__+# + [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case the [code]#ElementType# is the corresponding [code]#vec#; and * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -22683,7 +22690,7 @@ _Returns:_ For each element of [code]#x#, the value [code]#T# is the element type of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22724,13 +22731,13 @@ _Returns:_ The mantissa of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type with element type [code]#float#, + [code]#+__swizzle__+# type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is [code]#multi_ptr# with the following [code]#ElementType#: ** If [code]#NonScalar# is [code]#marray#, [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; -** If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +** If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, [code]#ElementType# is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar#; * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -22745,7 +22752,7 @@ mantissa * 2^exp^ equals [code]#x[i]#. The exponent of each element of _Returns:_ For each element of [code]#x#, the mantissa of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22776,7 +22783,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -22786,7 +22793,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of the square root of +x[i]+^2^ + +y[i]+^2^ without undue overflow or underflow. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22815,7 +22822,7 @@ integer, where r is the value returned by _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, compute the integral part of @@ -22825,7 +22832,7 @@ by [code]#std::numeric_limits::radix#. The return type depends on [code]#NonScalar#. If [code]#NonScalar# is [code]#marray#, the return type is [code]#marray# of [code]#int# with the same number of element as [code]#NonScalar#. If [code]#NonScalar# is [code]#vec# or -the [code]#+__swizzled_vec__+# type, the return type is [code]#vec# of +the [code]#+__swizzle__+# type, the return type is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar#. a@ @@ -22855,20 +22862,20 @@ _Returns:_ The value [code]#x# multiplied by 2^k^. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar1# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; + [code]#+__swizzle__+# type; * The element type of [code]#NonScalar1# is [code]#float#, [code]#double#, or [code]#half#; * If [code]#NonScalar1# is [code]#marray#, [code]#NonScalar2# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; and -* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, - [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzled_vec__+# type of +* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, + [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzle__+# type of [code]#int32_t# with the same number of elements as [code]#NonScalar1#. _Returns:_ For each element of [code]#x# and [code]#k#, the value [code]#x[i]# multiplied by 2^k[i]^. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (5):* @@ -22876,7 +22883,7 @@ corresponding [code]#vec#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type of [code]#NonScalar# is [code]#float#, [code]#double#, or [code]#half#. @@ -22884,7 +22891,7 @@ _Returns:_ For each element of [code]#x#, the value [code]#x[i]# multiplied by 2^k^. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22912,14 +22919,14 @@ _Returns:_ The natural logarithm of the absolute value of the gamma function of _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the natural logarithm of the absolute value of the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -22958,13 +22965,13 @@ _Returns:_ The natural logarithm of the absolute value of the gamma function of _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type with element type [code]#float#, + [code]#+__swizzle__+# type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is [code]#multi_ptr# with the following [code]#ElementType#: ** If [code]#NonScalar# is [code]#marray#, [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; -** If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +** If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, [code]#ElementType# is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar#; * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -22977,7 +22984,7 @@ _Returns:_ For each element of [code]#x#, the natural logarithm of the absolute value of the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23004,14 +23011,14 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23038,13 +23045,13 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23071,14 +23078,14 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23105,13 +23112,13 @@ _Returns:_ The value [code]#log(1.0 + x)#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#log(1.0 + x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23139,7 +23146,7 @@ _Returns:_ The integral part of log~r~|x|, where r is the value returned by _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the integral part of log~r~|x[i]|, @@ -23147,7 +23154,7 @@ where r is the value returned by [code]#std::numeric_limits::radix#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23183,7 +23190,7 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# are each [code]#marray#; or ** [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# are any - combination of [code]#vec# and the [code]#+__swizzled_vec__+# type; + combination of [code]#vec# and the [code]#+__swizzle__+# type; * [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# have the same number of elements; * [code]#NonScalar1#, [code]#NonScalar2#, and [code]#NonScalar3# have the same @@ -23195,7 +23202,7 @@ _Returns:_ For each element of [code]#a#, [code]#b#, and [ode]#c#; the The approximate value of [code]#a[i] * b[i] + c[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23226,7 +23233,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23237,7 +23244,7 @@ if |x[i]| > |y[i]|, [code]#y[i]# if |y[i]| > |x[i]|, otherwise [code]#fmax(x[i], y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23268,7 +23275,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23279,7 +23286,7 @@ if |x[i]| < |y[i]|, [code]#y[i]# if |y[i]| < |x[i]|, otherwise [code]#fmin(x[i], y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23319,10 +23326,10 @@ _Returns:_ The fractional part of the argument [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type with element type [code]#float#, + [code]#+__swizzle__+# type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is [code]#multi_ptr# with [code]#ElementType# equal to - [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzled_vec__+# + [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case the [code]#ElementType# is the corresponding [code]#vec#; and * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -23336,7 +23343,7 @@ pointed to by [code]#iptr#. _Returns:_ The fractional parts of each element of the argument [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23364,7 +23371,7 @@ in the significand of the resulting NaN. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#uint32_t#, [code]#uint64_t#, or [code]#uint16_t#. _Returns:_ A quiet NaN for each element of [code]#nancode#. Each @@ -23379,15 +23386,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -23421,7 +23428,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23432,7 +23439,7 @@ next representable floating-point value following [code]#x[i]# in the direction of [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23462,7 +23469,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23472,7 +23479,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23499,20 +23506,20 @@ _Returns:_ The value of [code]#x# raised to the power [code]#y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar1# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; + [code]#+__swizzle__+# type; * The element type of [code]#NonScalar1# is [code]#float#, [code]#double#, or [code]#half#; * If [code]#NonScalar1# is [code]#marray#, [code]#NonScalar2# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; and -* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, - [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzled_vec__+# type of +* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, + [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzle__+# type of [code]#int32_t# with the same number of elements as [code]#NonScalar1#. _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23544,7 +23551,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23557,7 +23564,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23590,7 +23597,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements; * [code]#NonScalar1# and [code]#NonScalar2# have the same element type; and * The element type of [code]#NonScalar1# and [code]#NonScalar2# is @@ -23603,7 +23610,7 @@ exact value of [code]#x[i]/y[i]#. If there are two integers closest to is given the same sign as [code]#x[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23651,12 +23658,12 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#Ptr# is [code]#multi_ptr# with the following [code]#ElementType#: ** If [code]#NonScalar1# is [code]#marray#, [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; -** If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +** If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, [code]#ElementType# is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar1#; * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -23675,7 +23682,7 @@ It stores these signed values to the object pointed to by [code]#quo#. _Returns:_ The values of [code]#r# defined above. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23705,7 +23712,7 @@ rounding modes. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an @@ -23713,7 +23720,7 @@ integral value (using round to nearest even rounding mode) in floating-point format. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23740,20 +23747,20 @@ _Returns:_ The value of [code]#x# raised to the power [code]#1/y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar1# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; + [code]#+__swizzle__+# type; * The element type of [code]#NonScalar1# is [code]#float#, [code]#double#, or [code]#half#; * If [code]#NonScalar1# is [code]#marray#, [code]#NonScalar2# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; and -* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, - [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzled_vec__+# type of +* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, + [code]#NonScalar2# is [code]#vec# or the [code]#+__swizzle__+# type of [code]#int32_t# with the same number of elements as [code]#NonScalar1#. _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#1/y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23781,7 +23788,7 @@ from zero, regardless of the current rounding direction. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the integral value nearest to @@ -23789,7 +23796,7 @@ _Returns:_ For each element of [code]#x#, the integral value nearest to rounding direction. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23816,14 +23823,14 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23850,13 +23857,13 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23895,10 +23902,10 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type with element type [code]#float#, + [code]#+__swizzle__+# type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is [code]#multi_ptr# with [code]#ElementType# equal to - [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzled_vec__+# + [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case the [code]#ElementType# is the corresponding [code]#vec#; and * [code]#Ptr# is [code]#multi_ptr# with [code]#Space# equal to one of the @@ -23910,7 +23917,7 @@ computed cosine values are written to [code]#cosval#. _Returns:_ The sine of each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23937,13 +23944,13 @@ _Returns:_ The hyperbolic sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -23970,13 +23977,13 @@ _Returns:_ The value [code]#sin({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#sin({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24003,13 +24010,13 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24036,13 +24043,13 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24069,14 +24076,14 @@ _Returns:_ The hyperbolic tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24103,13 +24110,13 @@ _Returns:_ The value [code]#tan({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#tan({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24136,13 +24143,13 @@ _Returns:_ The gamma function of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24170,14 +24177,14 @@ zero rounding mode. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to zero rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -24194,6 +24201,13 @@ The intent is that these functions might make use of native device functionality which has better performance than their counterparts in <>, but they may sacrifice accuracy or limit the set of legal input values. +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + [[table.native.math.functions]] .Native precision math functions [separator="@"] @@ -24220,13 +24234,13 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24251,14 +24265,14 @@ _Returns:_ The value [code]#x / y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] / y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24283,14 +24297,14 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24315,14 +24329,14 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24347,14 +24361,14 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24379,14 +24393,14 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24411,13 +24425,13 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24442,14 +24456,14 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24476,7 +24490,7 @@ _Returns:_ The value of [code]#x# raised to the power [code]#y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Preconditions:_ Each element of [code]#x# must be greater than or equal to @@ -24486,7 +24500,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24511,13 +24525,13 @@ _Returns:_ The reciprocal of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the reciprocal of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24542,14 +24556,14 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24574,13 +24588,13 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24605,13 +24619,13 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24636,13 +24650,13 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -24658,6 +24672,13 @@ specification. The intent is that these functions have higher performance than their counterparts in <>, but they have lower accuracy. +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + [[table.half.math.functions]] .Half precision math functions [separator="@"] @@ -24686,7 +24707,7 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -24695,7 +24716,7 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24720,14 +24741,14 @@ _Returns:_ The value [code]#x / y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] / y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24752,14 +24773,14 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24784,14 +24805,14 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24816,14 +24837,14 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24848,14 +24869,14 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24880,13 +24901,13 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24911,14 +24932,14 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24945,7 +24966,7 @@ _Returns:_ The value of [code]#x# raised to the power [code]#y#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Preconditions:_ Each element of [code]#x# must be greater than or equal to @@ -24955,7 +24976,7 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -24980,13 +25001,13 @@ _Returns:_ The reciprocal of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the reciprocal of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25011,14 +25032,14 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25045,7 +25066,7 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -25054,7 +25075,7 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25079,13 +25100,13 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25112,7 +25133,7 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -25121,7 +25142,7 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -25132,8 +25153,15 @@ corresponding [code]#vec#. <> describes the integer math functions that are available in the [code]#sycl# namespace in both host and device code. -The function descriptions in this section use the term _generic integer type_ to -represent the following types: +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + +The function descriptions in this section also use the term _generic integer +type_ to represent the following types: * [code]#char# * [code]#signed char# @@ -25165,14 +25193,14 @@ represent the following types: * [code]#vec# * [code]#vec# * [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# [[table.integer.functions]] .Integer functions @@ -25197,7 +25225,7 @@ for each element of [code]#x#. The behavior is undefined if the result cannot be represented by the return type. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25214,11 +25242,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns |x - y|. Otherwise, returns @@ -25227,7 +25255,7 @@ done without modulo overflow. The behavior is undefined if the result cannot be represented by the return type. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25244,11 +25272,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#x + y#. Otherwise, @@ -25256,7 +25284,7 @@ returns [code]#x[i] + y[i]# for each element of [code]#x# and [code]#y#. The addition operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25273,11 +25301,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#(x + y) >> 1#. @@ -25285,7 +25313,7 @@ Otherwise, returns [code]#(x[i] + y[i]) >> 1# for each element of [code]#x# and [code]#y#. The intermediate sum does not modulo overflow. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25302,11 +25330,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#(x + y + 1) >> 1#. @@ -25314,7 +25342,7 @@ Otherwise, returns [code]#(x[i] + y[i] + 1) >> 1# for each element of [code]#x# and [code]#y#. The intermediate sum does not modulo overflow. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25337,12 +25365,12 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#minval# must be @@ -25356,13 +25384,13 @@ _Returns:_ When the inputs are scalars, returns [code]#minval#, and [code]#maxval#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic integer +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ as defined above. _Preconditions:_ The value of [code]#minval# must be less than or equal to the @@ -25372,7 +25400,7 @@ _Returns:_ [code]#min(max(x[i], minval), maxval)# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25395,7 +25423,7 @@ the number of leading 0-bits in each element of [code]#x#. When a value is 0, the computed count is the size in bits of that value. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25418,7 +25446,7 @@ _Returns:_ When the input is a scalar, returns the number of trailing 0-bits in value. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25435,12 +25463,12 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#mul_hi(a, b)+c#. @@ -25448,7 +25476,7 @@ Otherwise, returns [code]#mul_hi(a[i], b[i])+c[i]# for each element of [code]#a#, [code]#b#, and [code]#c#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25465,12 +25493,12 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#a * b + c#. Otherwise, @@ -25478,7 +25506,7 @@ returns [code]#a[i] * b[i] + c[i]# for each element of [code]#a#, [code]#b#, and [code]#c#. The operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25500,11 +25528,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#y# if [code]#x < y# @@ -25513,20 +25541,20 @@ otherwise [code]#x#. When the inputs are not scalars, returns [code]#y[i]# if [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic integer +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ as defined above. _Returns:_ [code]#y# if [code]#x[i] < y# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25548,11 +25576,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#y# if [code]#y < x# @@ -25561,20 +25589,20 @@ otherwise [code]#x#. When the inputs are not scalars, returns [code]#y[i]# if [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic integer +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ as defined above. _Returns:_ [code]#y# if [code]#y < x[i]# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25591,11 +25619,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Effects:_ Computes [code]#x * y# and returns the high half of the product of @@ -25606,7 +25634,7 @@ _Returns:_ When the inputs are scalars, returns the high half of the product of [code]#x[i] * y[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25623,11 +25651,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Effects:_ For each element in [code]#v#, the bits are shifted left by the @@ -25642,7 +25670,7 @@ _Returns:_ When the inputs are scalars, the result of rotating [code]#v# by [code]#count#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25659,11 +25687,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must be the same as [code]#GenInt1#; and -* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#x - y#. Otherwise, returns @@ -25671,7 +25699,7 @@ _Returns:_ When the inputs are scalars, returns [code]#x - y#. Otherwise, retur operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25691,7 +25719,7 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt8Bit1# and [code]#UInt8Bit2# are both [code]#marray# with element type [code]#uint8_t# and the same number of elements; or * [code]#UInt8Bit1# and [code]#UInt8Bit2# are any combination of [code]#vec# or - the [code]#+__swizzled_vec__+# type with element type [code]#uint8_t# and the + the [code]#+__swizzle__+# type with element type [code]#uint8_t# and the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25722,9 +25750,9 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int8Bit# is [code]#marray# with element type [code]#int8_t# and [code]#UInt8Bit# is [code]#marray# with element type [code]#uint8_t# and both have the same number of elements; or -* [code]#Int8Bit# is [code]#vec# or the [code]#+__swizzled_vec__+# type with +* [code]#Int8Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element type [code]#int8_t# and [code]#UInt8Bit# is [code]#vec# or the - [code]#+__swizzled_vec__+# type with element type [code]#uint8_t# and both + [code]#+__swizzle__+# type with element type [code]#uint8_t# and both have the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25755,7 +25783,7 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt16Bit1# and [code]#UInt16Bit2# are both [code]#marray# with element type [code]#uint16_t# and the same number of elements; or * [code]#UInt16Bit1# and [code]#UInt16Bit2# are any combination of [code]#vec# - or the [code]#+__swizzled_vec__+# type with element type [code]#uint16_t# and + or the [code]#+__swizzle__+# type with element type [code]#uint16_t# and the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25787,9 +25815,9 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int16Bit# is [code]#marray# with element type [code]#int16_t# and [code]#UInt16Bit# is [code]#marray# with element type [code]#uint16_t# and both have the same number of elements; or -* [code]#Int16Bit# is [code]#vec# or the [code]#+__swizzled_vec__+# type with +* [code]#Int16Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element type [code]#int16_t# and [code]#UInt16Bit# is [code]#vec# or the - [code]#+__swizzled_vec__+# type with element type [code]#uint16_t# and both + [code]#+__swizzle__+# type with element type [code]#uint16_t# and both have the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25820,7 +25848,7 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt32Bit1# and [code]#UInt32Bit2# are both [code]#marray# with element type [code]#uint32_t# and the same number of elements; or * [code]#UInt32Bit1# and [code]#UInt32Bit2# are any combination of [code]#vec# - or the [code]#+__swizzled_vec__+# type with element type [code]#uint32_t# and + or the [code]#+__swizzle__+# type with element type [code]#uint32_t# and the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25852,9 +25880,9 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int32Bit# is [code]#marray# with element type [code]#int32_t# and [code]#UInt32Bit# is [code]#marray# with element type [code]#uint32_t# and both have the same number of elements; or -* [code]#Int32Bit# is [code]#vec# or the [code]#+__swizzled_vec__+# type with +* [code]#Int32Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element type [code]#int32_t# and [code]#UInt32Bit# is [code]#vec# or the - [code]#+__swizzled_vec__+# type with element type [code]#uint32_t# and both + [code]#+__swizzle__+# type with element type [code]#uint32_t# and both have the same number of elements. _Returns:_ When the inputs are scalars, returns @@ -25887,7 +25915,7 @@ _Returns:_ When the input is a scalar, returns the number of non-zero bits in each element of [code]#x#. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25910,14 +25938,14 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#marray# ** [code]#vec# ** [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#Int32Bit2# and [code]#Int32Bit# must be the same as [code]#Int32Bit1#; and -* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#Int32Bit2# and [code]#Int32Bit3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Preconditions:_ If the inputs are signed scalars, the values of [code]#x# and @@ -25931,7 +25959,7 @@ returns [code]#x[i] * y[i] + z[i]# for each element of [code]#x#, [code]#y#, and [code]#z#. The return type is [code]#Int32Bit1# unless [code]#Int32Bit1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -25954,13 +25982,13 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#marray# ** [code]#vec# ** [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#Int32Bit2# must be the same as [code]#Int32Bit1#; and -* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#Int32Bit2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Preconditions:_ If the inputs are signed scalars, the values of [code]#x# and @@ -25973,7 +26001,7 @@ _Returns:_ When the inputs are scalars, returns [code]#x * y#. Otherwise, returns [code]#x[i] * y[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#Int32Bit1# unless [code]#Int32Bit1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -25983,8 +26011,15 @@ corresponding [code]#vec#. <> describes the common functions that are available in the [code]#sycl# namespace in both host and device code. -The function descriptions in this section use the term _generic floating point -type_ to represent the following types: +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + +The function descriptions in this section also use the term _generic floating +point type_ to represent the following types: * [code]#float# * [code]#double# @@ -25995,9 +26030,9 @@ type_ to represent the following types: * [code]#vec# * [code]#vec# * [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# [[table.common.functions]] .Common functions @@ -26023,12 +26058,12 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#minval# must be @@ -26042,13 +26077,13 @@ _Returns:_ When the inputs are scalars, returns [code]#minval#, and [code]#maxval#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Preconditions:_ The value of [code]#minval# must be less than or equal to the @@ -26058,7 +26093,7 @@ _Returns:_ [code]#fmin(fmax(x[i], minval), maxval)# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26082,7 +26117,7 @@ Otherwise, returns [code]#(180 / {pi}) * radians[i]# for each element of [code]#radians#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26104,11 +26139,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Preconditions:_ When the inputs are scalars, [code]#x# and [code]#y# must not @@ -26121,13 +26156,13 @@ otherwise [code]#x#. When the inputs are not scalars, returns [code]#y[i]# if [code]#y#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Preconditions:_ No element of [code]#x# may be infinite or NaN. The value of @@ -26137,7 +26172,7 @@ _Returns:_ [code]#y# if [code]#x[i] < y# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26159,11 +26194,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Preconditions:_ When the inputs are scalars, [code]#x# and [code]#y# must not @@ -26176,13 +26211,13 @@ otherwise [code]#x#. When the inputs are not scalars, returns [code]#y[i]# if [code]#y#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Preconditions:_ No element of [code]#x# may be infinite or NaN. The value of @@ -26192,7 +26227,7 @@ _Returns:_ [code]#y# if [code]#y < x[i]# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26214,12 +26249,12 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#a# must be @@ -26232,13 +26267,13 @@ scalars, returns [code]#x + (y - x) * a#. Otherwise, returns and [code]#a#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Preconditions:_ The value of [code]#a# must be in the range [0.0, 1.0]. @@ -26247,7 +26282,7 @@ _Returns:_ The linear blend of [code]#x# and [code]#y#, computed as [code]#x[i] + (y[i] - x[i]) * a# for each element of [code]#x# and [code]#y#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26271,7 +26306,7 @@ Otherwise, returns [code]#({pi} / 180) * degrees[i]# for each element of [code]#degrees#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26293,11 +26328,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns the value @@ -26306,20 +26341,20 @@ the value [code]#(x[i] < edge[i]) ? 0.0 : 1.0# for each element of [code]#x# and [code]#edge#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Returns:_ The value [code]#(x[i] < edge) ? 0.0 : 1.0# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26338,12 +26373,12 @@ template (1) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Preconditions:_ If the inputs are scalar, [code]#edge0# must be less than @@ -26375,7 +26410,7 @@ return t * t * (3 - 2 * t); ---- The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26393,7 +26428,7 @@ template *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzled_vec__+# type and is a _generic floating +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point type_ as defined above. _Preconditions:_ The value of [code]#edge0# must be less than [code]#edge1# and @@ -26410,7 +26445,7 @@ return t * t * (3 - 2 * t); ---- The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26433,7 +26468,7 @@ _Returns:_ When the input is scalar, returns 1.0 if [code]#x > 0#, -0.0 if each element of [code]#x#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -26444,8 +26479,15 @@ corresponding [code]#vec#. <> describes the geometric functions that are available in the [code]#sycl# namespace in both host and device code. -The function descriptions in this section use two terms that refer to a specific -list of types. +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + +The function descriptions in this section also use two terms that refer to a +specific list of types. The term _generic geometric type_ represents the following types: * [code]#float# @@ -26457,11 +26499,11 @@ The term _generic geometric type_ represents the following types: * [code]#vec#, where [code]#N# is 2, 3, or 4 * [code]#vec#, where [code]#N# is 2, 3, or 4 * [code]#vec#, where [code]#N# is 2, 3, or 4 -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, where +* [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#N# is 2, 3, or 4 -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, - where [code]#N# is 2, 3, or 4 -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, where +* [code]#+__swizzle__+# that is convertible to [code]#vec#, where + [code]#N# is 2, 3, or 4 +* [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#N# is 2, 3, or 4 The term _float geometric type_ represents these types: @@ -26469,7 +26511,7 @@ The term _float geometric type_ represents these types: * [code]#float# * [code]#marray#, where [code]#N# is 2, 3, or 4 * [code]#vec#, where [code]#N# is 2, 3, or 4 -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, where +* [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#N# is 2, 3, or 4 [[table.geometric.functions]] @@ -26502,24 +26544,24 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#vec# ** [code]#vec# ** [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# +** [code]#+__swizzle__+# that is convertible to [code]#vec# * If [code]#Geo3or4Float1# is [code]#marray#, then [code]#Geo3or4Float2# must be the same as [code]#Geo3or4Float1#; and -* If [code]#Geo3or4Float1# is [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#Geo3or4Float1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#Geo3or4Float2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ The cross product of first 3 components of [code]#p0# and [code]#p1#. When the inputs have 4 components, the 4th component of the result is 0.0. The return type is [code]#Geo3or4Float1# unless [code]#Geo3or4Float1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26536,11 +26578,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _generic geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ The dot product of [code]#p0# and [code]#p1#. @@ -26562,11 +26604,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _generic geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type and + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements. _Returns:_ The distance between [code]#p0# and [code]#p1#. This is calculated @@ -26612,7 +26654,7 @@ as defined above. _Returns:_ A vector in the same direction as [code]#p# but with a length of 1. The return type is [code]#GeoFloat# unless [code]#GeoFloat# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -26629,11 +26671,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _float geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same number of + [code]#+__swizzle__+# type, and both must have the same number of elements. _Returns:_ The value [code]#fast_length(p0 - p1)#. @@ -26700,7 +26742,7 @@ with the following exceptions: -- The return type is [code]#GeoFloat# unless [code]#GeoFloat# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== @@ -26719,8 +26761,15 @@ The comparisons performed by [code]#isequal#, [code]#isgreater#, The comparison performed by [code]#isnotequal# is true when one or both operands are NaN. -The function descriptions in this section use two terms that refer to a specific -list of types. +The descriptions in this section use the type name [code]#+__swizzle__+# to +refer to the classes defined in <>. +This type can be any instantiation of the class templates named +[code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# in that section, +so long as the instantiation satisfies the constraints listed in the function's +description. + +The function descriptions in this section also use two terms that refer to a +specific list of types. The term _generic scalar type_ represents the following types: * [code]#char# @@ -26783,14 +26832,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] == y[i])# for each element of [code]#x# and [code]#y#. If -[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((x[i] == y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -26804,15 +26853,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -26843,14 +26892,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] != y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((x[i] != y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -26864,15 +26913,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -26903,14 +26952,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] > y[i])# for each element of [code]#x# and [code]#y#. If -[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((x[i] > y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -26924,15 +26973,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -26963,14 +27012,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] >= y[i])# for each element of [code]#x# and [code]#y#. If -[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((x[i] >= y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -26984,15 +27033,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27023,14 +27072,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] < y[i])# for each element of [code]#x# and [code]#y#. If -[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((x[i] < y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -27044,15 +27093,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27083,14 +27132,14 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#+(x[i] <= y[i])+# for each element of [code]#x# and [code]#y#. If -[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#+((x[i] <= y[i]) ? -1 : 0)+# for each element of [code]#x# and [code]#y#. @@ -27104,15 +27153,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27143,7 +27192,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. @@ -27151,7 +27200,7 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] < y[i] || x[i] > y[i])# for each element of [code]#x# and [code]#y#. If [code]#NonScalar1# is [code]#vec# or the -[code]#+__swizzled_vec__+# type, returns the value +[code]#+__swizzle__+# type, returns the value [code]#((x[i] < y[i] || x[i] > y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -27165,15 +27214,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27201,12 +27250,12 @@ _Returns:_ The value [code]#true# only if [code]#x# has finite value. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# is a finite value. If -[code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns -1 for each element of [code]#x# if [code]#x[i]# is a finite value and returns 0 otherwise. @@ -27220,15 +27269,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27257,12 +27306,12 @@ _Returns:_ The value [code]#true# only if [code]#x# has an infinity value _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has an infinity value. If -[code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns -1 for each element of [code]#x# if [code]#x[i]# has an infinity value and returns 0 otherwise. @@ -27276,15 +27325,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27312,12 +27361,12 @@ _Returns:_ The value [code]#true# only if [code]#x# has a NaN value. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has a NaN value. If -[code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns -1 for each element of [code]#x# if [code]#x[i]# has a NaN value and returns 0 otherwise. @@ -27331,15 +27380,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27367,12 +27416,12 @@ _Returns:_ The value [code]#true# only if [code]#x# has a normal value. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has a normal value. If -[code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns -1 for each element of [code]#x# if [code]#x[i]# has a normal value and returns 0 otherwise. @@ -27386,15 +27435,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27427,7 +27476,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. @@ -27437,7 +27486,7 @@ _Effects:_ Tests if each element of [code]#x# and [code]#y# are ordered. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#isequal(x[i], x[i]) && isequal(y[i], y[i])# for each element of [code]#x# and [code]#y#. If [code]#NonScalar1# is [code]#vec# or the -[code]#+__swizzled_vec__+# type, returns the value +[code]#+__swizzle__+# type, returns the value [code]#((isequal(x[i], x[i]) && isequal(y[i], y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -27451,15 +27500,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27492,7 +27541,7 @@ _Constraints:_ Available only if all of the following conditions are met: [code]#NonScalar2#: ** Both [code]#NonScalar1# and [code]#NonScalar2# are [code]#marray#; or ** [code]#NonScalar1# and [code]#NonScalar2# are any combination of [code]#vec# - and the [code]#+__swizzled_vec__+# type; + and the [code]#+__swizzle__+# type; * [code]#NonScalar1# and [code]#NonScalar2# have the same number of elements and the same element type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. @@ -27501,7 +27550,7 @@ _Effects:_ Tests if each element of [code]#x# and [code]#y# are unordered. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#isnan(x[i]) || isnan(y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((isnan(x[i]) || isnan(y[i]) ? -1 : 0)# for each element of [code]#x# and [code]#y#. @@ -27515,15 +27564,15 @@ The return type depends on [code]#NonScalar1#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27551,12 +27600,12 @@ _Returns:_ The value [code]#true# only if the sign bit of [code]#x# is set. _Constraints:_ Available only if all of the following conditions are met: * [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzled_vec__+# type; and + [code]#+__swizzle__+# type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if the sign bit of [code]#x[i]# is set. If -[code]#NonScalar# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +[code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns -1 for each element of [code]#x# if the sign bit of [code]#x[i]# is set and returns 0 otherwise. @@ -27570,15 +27619,15 @@ The return type depends on [code]#NonScalar#: ![code]#marray# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# ![code]#vec# + - [code]#+__swizzled_vec__+# that is convertible to [code]#vec# + [code]#+__swizzle__+# that is convertible to [code]#vec# ![code]#vec# !==== @@ -27605,14 +27654,14 @@ _Constraints:_ Available only if [code]#GenInt# is one of the following types: * [code]#vec# * [code]#vec# * [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# _Returns:_ When [code]#x# is [code]#marray#, returns a Boolean telling whether any element of [code]#x# is true. When [code]#x# is [code]#vec# or the -[code]#+__swizzled_vec__+# type, returns the value 1 if any element in +[code]#+__swizzle__+# type, returns the value 1 if any element in [code]#x# has its most significant bit set, otherwise returns the value 0. The return type is [code]#bool# if [code]#GenInt# is [code]#marray#. @@ -27663,14 +27712,14 @@ _Constraints:_ Available only if [code]#GenInt# is one of the following types: * [code]#vec# * [code]#vec# * [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# -* [code]#+__swizzled_vec__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# +* [code]#+__swizzle__+# that is convertible to [code]#vec# _Returns:_ When [code]#x# is [code]#marray#, returns a Boolean telling whether all elements of [code]#x# are true. When [code]#x# is [code]#vec# or the -[code]#+__swizzled_vec__+# type, returns the value 1 if all elements in +[code]#+__swizzle__+# type, returns the value 1 if all elements in [code]#x# have their most significant bit set, otherwise returns the value 0. The return type is [code]#bool# if [code]#GenInt# is [code]#marray#. @@ -27716,14 +27765,14 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#marray#, where [code]#T# is one of the _generic scalar types_; ** [code]#vec#, where [code]#T# is one of the _vector element types_ as defined above; or -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, where +** [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#T# is one of the _vector element types_; -* If [code]#GenType1# is not [code]#vec# or the [code]#+__swizzled_vec__+# +* If [code]#GenType1# is not [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenType2# and [code]#GenType3# must be the same as [code]#GenType1#; and -* If [code]#GenType1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#GenType1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenType2# and [code]#GenType3# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and all three must have the same element + [code]#+__swizzle__+# type, and all three must have the same element type and the same number of elements. _Returns:_ When the input parameters are scalars, returns a result where each @@ -27736,7 +27785,7 @@ where each bit of the result for element [code]#i# is the corresponding bit of the corresponding bit of [code]#b[i]#. The return type is [code]#GenType1# unless [code]#GenType1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. a@ @@ -27769,18 +27818,18 @@ _Constraints:_ Available only if all of the following conditions are met: as defined above; ** [code]#vec#, where [code]#T# is one of the _vector element types_ as defined above; or -** [code]#+__swizzled_vec__+# that is convertible to [code]#vec#, where +** [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#T# is one of the _vector element types_; * If [code]#NonScalar1# is [code]#marray#, then: ** [code]#NonScalar2# must be the same as [code]#NonScalar1#; and ** [code]#NonScalar3# must be [code]#marray# with element type [code]#bool# and the same number of elements as [code]#NonScalar1#; -* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, then: ** [code]#NonScalar2# must also be [code]#vec# or the - [code]#+__swizzled_vec__+# type, and both must have the same element type + [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements; and -** [code]#NonScalar3# must be [code]#vec# or the [code]#+__swizzled_vec__+# +** [code]#NonScalar3# must be [code]#vec# or the [code]#+__swizzle__+# type with the same number of elements as [code]#NonScalar1#. The element type of [code]#NonScalar3# must be a signed or unsigned integer with the same number of bits as the element type of [code]#NonScalar1#. @@ -27789,12 +27838,12 @@ _Returns:_ If [code]#NonScalar1# is [code]#marray#, return the value [code]#(c[i] ? b[i] : a[i])# for each element of [code]#a#, [code]#b#, and [code]#c#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzled_vec__+# type, +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns the value [code]#((MSB of c[i] is set) ? b[i] : a[i])# for each element of [code]#a#, [code]#b#, and [code]#c#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzled_vec__+# type, in which case the return type is the +[code]#+__swizzle__+# type, in which case the return type is the corresponding [code]#vec#. |==== From 6bc7f96da1f31062b0fb13ffda44500c2664b89e Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Mon, 18 Mar 2024 15:41:03 -0400 Subject: [PATCH 08/17] Change table style We used to enclose all the member function descriptions in a table, so that the description and synopsis of each function was visually enclosed in a single table cell. This caused a problem with the PDF render, though, because some table rows were too big to fit on a single page, which causes an error when rendering the PDF. Fix this by eliminating the table. Instead, put a horizontal line between the descriptions of the functions to visually separate them. --- adoc/chapters/programming_interface.adoc | 185 ++++++++++++----------- 1 file changed, 94 insertions(+), 91 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index d15905cc..44b5d158 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17712,10 +17712,10 @@ include::{code_dir}/swizzle-example.cpp[lines=4..-1] Synopses of the [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# classes are shown below. -The member type aliases are described in <>, the -constructors are described in <>, the member -functions are described in <>, and the hidden friend -functions are described in <>. +The member type aliases are described in <>, the +constructors are described in <>, the member +functions are described in <>, and the hidden friend +functions are described in <>. The [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+# classes are not user constructible. @@ -17750,46 +17750,43 @@ additional constraints on the member functions. include::{header_dir}/swizzled-vec.h[lines=4..-1] ---- -[[table.types.swizzled-vec]] -.Member type aliases for the swizzled vector class templates -[separator="@"] +[[sec:types.swizzled-vec]] +===== Member type aliases for the swizzled vector class templates + +[frame=all,grid=none,separator="@"] |==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- using element_type = DataT using value_type = DataT ---- -!==== +|==== Each of these type aliases tells the type of an element in the underlying [code]#vec#. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- #ifdef __SYCL_DEVICE_ONLY__ using vector_t = /*unspecified*/ #endif ---- -!==== +|==== This type alias is available only in device code. The [code]#vector_t# type represents a native vector type of [code]#NumElements# elements where each element's type is [code]#DataT#. -[[table.constructors.swizzled-vec]] -.Constructors for the swizzled vector class templates -[separator="@"] +[[sec:constructors.swizzled-vec]] +===== Constructors for the swizzled vector class templates + +[frame=all,grid=none,separator="@"] |==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- __writeable_swizzle__() = delete @@ -17800,20 +17797,17 @@ __const_swizzle__(const __const_swizzle__&) = delete __const_swizzle__& operator=(const __const_swizzle__&) = delete ---- -!==== +|==== The default constructor and copy constructor are deleted. The copy assignment operator for [code]#+__const_swizzle__+# is deleted. -|==== -[[table.members.swizzled-vec]] -.Member functions for the swizzled vector class templates -[separator="@"] +[[sec:members.swizzled-vec]] +===== Member functions for the swizzled vector class templates + +[frame=all,grid=none,separator="@"] |==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- #ifdef __SYCL_DEVICE_ONLY__ @@ -17836,7 +17830,7 @@ template asT as() const template void store(size_t offset, multi_ptr ptr) const ---- -!==== +|==== _Availability:_ These functions are available in both [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+#. @@ -17847,15 +17841,16 @@ _Effects:_ The effect of these functions is the same as if they were applied to a temporary [code]#vec# object that contains the result of the swizzle operation. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- operator vec() const ---- -!==== +|==== _Availability:_ These functions are available in both [code]#+__writeable_swizzle__+# and [code]#+__const_swizzle__+#. @@ -17864,10 +17859,11 @@ _Constraints:_ Available only when [code]#NumElements > 1#. _Returns:_ A new [code]#vec# object that represents the elements of the [code]#vec# object that underlies the view with the swizzle operation applied. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template __writeable_swizzle__ swizzle() const (1) @@ -17903,7 +17899,7 @@ __const_swizzle__ hi() const __const_swizzle__ odd() const (19) __const_swizzle__ even() const (20) ---- -!==== +|==== _Availability:_ Functions (1) - (10) are available only in [code]#+__writeable_swizzle__+#. Functions (11) - (20) are available only in [code]#+__const_swizzle__+#. @@ -17922,16 +17918,17 @@ For example, if the second swizzle references the first element, this means the element of the underlying [code]#vec# that corresponds to the first element produced by the first swizzle. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template void load(size_t offset, multi_ptr ptr) const ---- -!==== +|==== _Availability:_ Available only in [code]#+__writeable_swizzle__+#. _Effects:_ Loads values from memory into elements of the underlying [code]#vec# @@ -17943,16 +17940,17 @@ corresponds to the first element of the swizzle operation. The second value from memory is written to the element in [code]#vec# that corresponds to the second element of the swizzle operation, etc. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- DataT& operator[](int index) const (1) const DataT& operator[](int index) const (2) ---- -!==== +|==== _Availability:_ Functions (1) is available only in [code]#+__writeable_swizzle__+#. Functions (2) is available only in [code]#+__const_swizzle__+#. @@ -17960,10 +17958,11 @@ Functions (2) is available only in [code]#+__const_swizzle__+#. _Returns:_ A reference to the element of the underlying [code]#vec# object that corresponds to the position [code]#index# of the swizzle operation. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template @@ -17972,7 +17971,7 @@ const __writeable_swizzle__& operator=(const __writeable_swizzle__ const __writeable_swizzle__& operator=(const __const_swizzle__& rhs) const ---- -!==== +|==== _Availability:_ Available only in [code]#+__writeable_swizzle__+#. _Constraints:_ Available only when all of the following conditions are met: @@ -17993,15 +17992,16 @@ corresponds to the first element of the left hand side swizzle operation, etc. _Returns:_ A reference to the left hand side [code]#+__writeable_swizzle__+# view. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- const __writeable_swizzle__& operator=(const DataT& rhs) const ---- -!==== +|==== _Availability:_ Available only in [code]#+__writeable_swizzle__+#. _Constraints:_ Available only when the [code]#+__writeable_swizzle__+# view does @@ -18015,15 +18015,16 @@ Elements in the underlying [code]#vec# object that do not have elements in the _Returns:_ A reference to the [code]#+__writeable_swizzle__+# view. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- const __writeable_swizzle__& operator=(const vec& rhs) const ---- -!==== +|==== _Availability:_ Available only in [code]#+__writeable_swizzle__+#. _Constraints:_ Available only when the [code]#+__writeable_swizzle__+# view does @@ -18036,16 +18037,13 @@ The first element of [code]#rhs# is assigned to the element of the underlying operation, etc. _Returns:_ A reference to the [code]#+__writeable_swizzle__+# view. -|==== -[[table.functions.swizzled-vec]] -.Hidden friend functions of the swizzled vector class templates -[separator="@"] +[[sec:functions.swizzled-vec]] +===== Hidden friend functions of the swizzled vector class templates + +[frame=all,grid=none,separator="@"] |==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template (1) @@ -18091,7 +18089,7 @@ operatorOP(const DataT& lhs, const __writeable_swizzle__& rhs) friend vec (12) operatorOP(const DataT& lhs, const __const_swizzle__& rhs) ---- -!==== +|==== Where [code]#OP# is: [code]#pass:[+]#, [code]#-#, [code]#*#, [code]#/#, [code]#%#, [code]#&#, [code]#|#, [code]#^#, [code]#<<#, [code]#>>#. @@ -18116,10 +18114,11 @@ was first evaluated into a temporary [code]#vec# object, and then _Returns:_ A new [code]#vec# object that represents the result of the operation. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template (1) @@ -18138,7 +18137,7 @@ operatorOP(const __writeable_swizzle__& lhs, const vec& rhs) friend const __writeable_swizzle__& (4) operatorOP(const __writeable_swizzle__& lhs, const DataT& rhs) ---- -!==== +|==== Where [code]#OP# is: [code]#pass:[+=]#, [code]#-=#, [code]#*=#, [code]#/=#, [code]#%=#, [code]#&=#, [code]#|=#, [code]#^=#, [code]#+<<=+#, [code]#>>=#. @@ -18173,15 +18172,16 @@ corresponds to the second element of the left-hand-side swizzle, etc. _Returns:_ A reference to the [code]#lhs#. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- friend const __writeable_swizzle__& operatorOP(const __writeable_swizzle__& sv) ---- -!==== +|==== Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. _Availability:_ These are hidden friend functions only in @@ -18197,15 +18197,16 @@ Elements in the underlying [code]#vec# object that do not have elements in the _Returns:_ A reference to the [code]#sv# view. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- friend vec operatorOP(const __writeable_swizzle__& sv, int) ---- -!==== +|==== Where [code]#OP# is: [code]#pass:[++]#, [code]#--#. _Availability:_ These are hidden friend functions only in @@ -18223,16 +18224,17 @@ _Returns:_ A new [code]#vec# object that represents the elements of [code]#sv# after the swizzle operation is applied and before the postfix arithmetic operation is applied. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- friend vec operatorOP(const __writeable_swizzle__& sv) (1) friend vec operatorOP(const __const_swizzle__& sv) (2) ---- -!==== +|==== Where [code]#OP# is: [code]#pass:[+]#, [code]#-#. _Availability:_ Functions (1) are hidden friends in @@ -18246,10 +18248,11 @@ object. _Returns:_ A [code]#vec# object that represents the result of the operation. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none] -!==== -a! [source] ---- template (1) @@ -18295,7 +18298,7 @@ operatorOP(const DataT& lhs, const __writeable_swizzle__& rhs) friend vec (12) operatorOP(const DataT& lhs, const __const_swizzle__& rhs) ---- -!==== +|==== Where [code]#OP# is: [code]#&&#, [code]#||#, [code]#==#, [code]#!=#, [code]#<#, [code]#>#, [code]#+<=+#, [code]#>=#. @@ -18316,10 +18319,11 @@ was first evaluated into a temporary [code]#vec# object, and then _Returns:_ A [code]#vec# object that represents the result of the operation. +''' + +[frame=all,grid=none,separator="@"] +|==== a@ -[frame=all,grid=none,separator="#"] -!==== -a# [source] ---- friend vec operator~(const __writeable_swizzle__& sv) (1) @@ -18328,7 +18332,7 @@ friend vec operator~(const __const_swizzle__& sv) (2) friend vec operator!(const __writeable_swizzle__& sv) (3) friend vec operator!(const __const_swizzle__& sv) (4) ---- -!==== +|==== _Availability:_ Overloads (1) and (3) are hidden friends of [code]#+__writeable_swizzle__+#. Overloads (2) and (4) are hidden friends of [code]#+__const_swizzle__+#. @@ -18342,7 +18346,6 @@ first evaluated into a temporary [code]#vec# object, and then the bitwise or logical NOT operation was applied to the temporary [code]#vec# object. _Returns:_ A [code]#vec# object that represents the result of the operation. -|==== ==== Rounding modes From 3f597d7d36f7d35b6178fd7c5be75f76ea734a3c Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Thu, 4 Apr 2024 07:52:10 -0400 Subject: [PATCH 09/17] Formatting Avoid line wrap in synopsis in PDF render. --- adoc/chapters/programming_interface.adoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 44b5d158..babb8693 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17966,10 +17966,12 @@ a@ [source] ---- template -const __writeable_swizzle__& operator=(const __writeable_swizzle__& rhs) const +const __writeable_swizzle__& +operator=(const __writeable_swizzle__& rhs) const template -const __writeable_swizzle__& operator=(const __const_swizzle__& rhs) const +const __writeable_swizzle__& +operator=(const __const_swizzle__& rhs) const ---- |==== _Availability:_ Available only in [code]#+__writeable_swizzle__+#. From fa17042f02d4b26d14796e94ec5ea71ad1dbb107 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 16:29:21 -0400 Subject: [PATCH 10/17] Add constraint on number of swizzle elements --- adoc/chapters/programming_interface.adoc | 15 +++++++++------ adoc/headers/vec.h | 4 ++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index babb8693..b12f6dae 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17104,12 +17104,15 @@ a@ template __writeable_swizzle__ swizzle() template __const_swizzle__ swizzle() const ---- - a@ Return an instance of the implementation-defined - [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# class - representing a swizzled view of the vector as described in - <>. - The [code]#swizzleIndexes# argument pack specifies the elements in the - swizzle. + a@ Available only when: The number of [code]#swizzleIndexes# template + parameters is 1, 2, 3, 4, 8, or 16. + Available only when: Each of the [code]#swizzleIndexes# template + parameters is greater or equal to 0 and less than [code]#NumElements#. + +Return an instance of the implementation-defined [code]#+__writeable_swizzle__+# +or [code]#+__const_swizzle__+# class representing a swizzled view of the vector +as described in <>. +The [code]#swizzleIndexes# argument pack specifies the elements in the swizzle. a@ [source] diff --git a/adoc/headers/vec.h b/adoc/headers/vec.h index 60ce2ebb..4593e60b 100644 --- a/adoc/headers/vec.h +++ b/adoc/headers/vec.h @@ -74,6 +74,10 @@ template class vec { template AsT as() const; + // Available on when the number of swizzleIndexes template parameters is + // 1, 2, 3, 4, 8, or 16. + // Available only when each of the swizzleIndexes template parameters is + // greater or equal to 0 and less than NumElements. template __writeable_swizzle__ swizzle(); template __const_swizzle__ swizzle() const; From 3581d9aa268a318c3aa841d63a541e27f6b15bab Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 17:05:58 -0400 Subject: [PATCH 11/17] Update adoc/chapters/programming_interface.adoc Co-authored-by: Gordon Brown --- adoc/chapters/programming_interface.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index b12f6dae..79a31698 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17840,7 +17840,7 @@ _Availability:_ These functions are available in both _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. -_Effects:_ The effect of these functions is the same as if they were applied to +_Effects:_ The effect of these functions is the same as if they were called on a temporary [code]#vec# object that contains the result of the swizzle operation. From 6f188ddd2875bb313bc40e102cb945030c7fbd89 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 17:17:46 -0400 Subject: [PATCH 12/17] Apply suggestions from code review Co-authored-by: Gordon Brown --- adoc/chapters/programming_interface.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 79a31698..dbe43b8d 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17841,7 +17841,7 @@ _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. _Effects:_ The effect of these functions is the same as if they were called on -a temporary [code]#vec# object that contains the result of the swizzle +a temporary [code]#vec# object that contains the result of the captured swizzle operation. ''' From 686e19c3c465a6f3ea76fc373be7b85bcbf1d838 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 17:20:16 -0400 Subject: [PATCH 13/17] Fix reflow --- adoc/chapters/programming_interface.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index dbe43b8d..a604f8d5 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17840,8 +17840,8 @@ _Availability:_ These functions are available in both _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. -_Effects:_ The effect of these functions is the same as if they were called on -a temporary [code]#vec# object that contains the result of the captured swizzle +_Effects:_ The effect of these functions is the same as if they were called on a +temporary [code]#vec# object that contains the result of the captured swizzle operation. ''' From ebfda4015d0f076cbfe9ef9c8176f7c612aff046 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 17:28:33 -0400 Subject: [PATCH 14/17] Improved wording from Gordon --- adoc/chapters/programming_interface.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index a604f8d5..f788843a 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17911,7 +17911,7 @@ _Constraints:_ These functions have the same constraints as the equivalent member functions of the [code]#vec# class. _Returns:_ A new view of the underlying [code]#vec# object, where the view -represents the combination of two swizzle operations. +represents the composition of two swizzle operations. The first is the swizzle operation represented by the [code]#+__writeable_swizzle__+# or [code]#+__const_swizzle__+# view. The second is the swizzle operation defined by the member function. From 4e94a2c8b1077a72afa8d88c14d3954e6ece4396 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Fri, 17 May 2024 17:35:33 -0400 Subject: [PATCH 15/17] Improved wording from Gordon --- adoc/chapters/programming_interface.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index f788843a..4bbee08b 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17859,8 +17859,8 @@ _Availability:_ These functions are available in both _Constraints:_ Available only when [code]#NumElements > 1#. -_Returns:_ A new [code]#vec# object that represents the elements of the -[code]#vec# object that underlies the view with the swizzle operation applied. +_Returns:_ A new [code]#vec# object that contains the result of the captured +swizzle operation. ''' From 3514fc2ff9a0405842b9eaea526eea1727ecef3b Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Tue, 25 Jun 2024 15:22:21 -0400 Subject: [PATCH 16/17] Document swizzle destructors Add a section documenting the destructors for the `__writeable_swizzle__` and `__const_swizzle__` classes. I debated whether we should require them to be trivial. I think they probably will be trivial in a typical implementation, but I wasn't certain enough to put this in the spec. For now, I just said that they have no visible effect. This allows an implementation to contain some internal state that is destroyed by the destructor, but I suspect most implementations won't require this. --- adoc/chapters/programming_interface.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 4bbee08b..f6fcfaa3 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17805,6 +17805,19 @@ The default constructor and copy constructor are deleted. The copy assignment operator for [code]#+__const_swizzle__+# is deleted. +===== Destructors for the swizzled vector class templates + +[frame=all,grid=none,separator="@"] +|==== +a@ +[source] +---- +~__writeable_swizzle__() +~__const_swizzle__() +---- +|==== +The destructors have no visible effect. + [[sec:members.swizzled-vec]] ===== Member functions for the swizzled vector class templates From ef571ed94bcb927e6243681cb9e638ab7c241e20 Mon Sep 17 00:00:00 2001 From: Greg Lueck Date: Tue, 25 Jun 2024 16:44:57 -0400 Subject: [PATCH 17/17] Reflow --- adoc/chapters/programming_interface.adoc | 1354 +++++++++++----------- 1 file changed, 664 insertions(+), 690 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index dffec2fe..fa486fa5 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -21580,15 +21580,15 @@ _Returns:_ The inverse cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21611,16 +21611,16 @@ _Returns:_ The inverse hyperbolic cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse hyperbolic cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21643,15 +21643,15 @@ _Returns:_ The value [code]#acos(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#acos(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21674,15 +21674,15 @@ _Returns:_ The inverse sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21705,16 +21705,16 @@ _Returns:_ The inverse hyperbolic sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse hyperbolic sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21737,15 +21737,15 @@ _Returns:_ The value [code]#asin(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#asin(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21768,15 +21768,15 @@ _Returns:_ The inverse tangent of the input. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of the input, the inverse tangent of the element. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21813,8 +21813,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the arc tangent of [code]#y[i] / x[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21837,16 +21837,16 @@ _Returns:_ The hyperbolic inverse tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic inverse tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21869,15 +21869,15 @@ _Returns:_ The value [code]#atan(x) / {pi}#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#atan(x[i]) / {pi}#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21914,8 +21914,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#atan2(y[i], x[i]) / {pi}#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21938,15 +21938,15 @@ _Returns:_ The cube-root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the cube-root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -21970,16 +21970,16 @@ positive infinity rounding mode. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to positive infinity rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22017,8 +22017,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# with its sign changed to match the sign of [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22041,15 +22041,15 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22072,15 +22072,15 @@ _Returns:_ The hyperbolic cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22103,15 +22103,15 @@ _Returns:_ The value [code]#cos({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#cos({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22134,16 +22134,16 @@ _Returns:_ The complementary error function of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the complementary error function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22167,15 +22167,15 @@ normal distribution). _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the error function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22198,16 +22198,16 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22230,16 +22230,16 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22262,16 +22262,16 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22294,15 +22294,15 @@ _Returns:_ The value [code]#e^x^-1.0#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#e^x[i]^-1.0#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22325,15 +22325,15 @@ _Returns:_ The absolute value of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the absolute value of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22370,8 +22370,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] - y[i]# if [code]#x[i] > y[i]#, otherwise +0. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22395,16 +22395,16 @@ negative infinity rounding mode. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to negative infinity rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22450,8 +22450,8 @@ Rounding of intermediate products shall not occur. Edge case behavior is per the IEEE 754-2008 standard. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22495,15 +22495,15 @@ If one element is a NaN, the result is the other element. If both elements are NaNs, the result is NaN. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (5):* _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#y# if [code]#x[i] < @@ -22512,8 +22512,8 @@ If one value is a NaN, the result is the other value. If both value are NaNs, the result is a NaN. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22557,15 +22557,15 @@ If one element is a NaN, the result is the other element. If both elements are NaNs, the result is NaN. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (5):* _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#y# if [code]#y < @@ -22574,8 +22574,8 @@ If one value is a NaN, the result is the other value. If both value are NaNs, the result is a NaN. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22612,8 +22612,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] - y[i] * trunc(x[i]/y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22651,9 +22651,8 @@ where [code]#T# is the type of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type with element type [code]#float#, - [code]#double#, or [code]#half#; +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is one of the following: ** A {cpp} cv-unqualified pointer to [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case it is a cv-unqualified @@ -22672,8 +22671,8 @@ floor(x[i]), nextafter(T{1.0}, T{0.0}) )#, where [code]#T# is the element type of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22714,22 +22713,21 @@ _Returns:_ The mantissa of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type with element type [code]#float#, - [code]#double#, or [code]#half#; +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is one of the following: ** (If [code]#NonScalar# is [code]#marray#): A {cpp} cv-unqualified pointer to [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; or -** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): - A {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with the - same number of elements as [code]#NonScalar#; or +** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): A + {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with the same + number of elements as [code]#NonScalar#; or ** (If [code]#NonScalar# is [code]#marray#): A [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable address spaces_ as defined above and whose [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; or -** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): - A [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable +** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): A + [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable address spaces_ as defined above and whose [code]#ElementType# is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar#. @@ -22743,8 +22741,8 @@ The exponent of each element of [code]#x# is written to [code]#exp#. _Returns:_ For each element of [code]#x#, the mantissa of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22782,8 +22780,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of the square root of +x[i]+^2^ + +y[i]+^2^ without undue overflow or underflow. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22808,8 +22806,8 @@ integer, where r is the value returned by _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, compute the integral part of @@ -22861,15 +22859,15 @@ _Returns:_ For each element of [code]#x# and [code]#k#, the value [code]#x[i]# multiplied by 2^k[i]^. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (5):* _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type of [code]#NonScalar# is [code]#float#, [code]#double#, or [code]#half#. @@ -22877,8 +22875,8 @@ _Returns:_ For each element of [code]#x#, the value [code]#x[i]# multiplied by 2^k^. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22902,16 +22900,16 @@ _Returns:_ The natural logarithm of the absolute value of the gamma function of _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the natural logarithm of the absolute value of the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22948,22 +22946,21 @@ _Returns:_ The natural logarithm of the absolute value of the gamma function of _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type with element type [code]#float#, - [code]#double#, or [code]#half#; +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is one of the following: ** (If [code]#NonScalar# is [code]#marray#): A {cpp} cv-unqualified pointer to [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; or -** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): - A {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with the - same number of elements as [code]#NonScalar#; or +** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): A + {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with the same + number of elements as [code]#NonScalar#; or ** (If [code]#NonScalar# is [code]#marray#): A [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable address spaces_ as defined above and whose [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar#; or -** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): - A [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable +** (If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type): A + [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable address spaces_ as defined above and whose [code]#ElementType# is [code]#vec# of [code]#int32_t# with the same number of elements as [code]#NonScalar#. @@ -22974,8 +22971,8 @@ _Returns:_ For each element of [code]#x#, the natural logarithm of the absolute value of the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -22998,15 +22995,15 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23029,15 +23026,15 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23060,15 +23057,15 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23091,15 +23088,15 @@ _Returns:_ The value [code]#log(1.0 + x)#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#log(1.0 + x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23123,8 +23120,8 @@ _Returns:_ The integral part of log~r~|x|, where r is the value returned by _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the integral part of log~r~|x[i]|, @@ -23132,8 +23129,8 @@ where r is the value returned by [code]#std::numeric_limits::radix#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23179,8 +23176,8 @@ _Returns:_ For each element of [code]#a#, [code]#b#, and [ode]#c#; the The approximate value of [code]#a[i] * b[i] + c[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23219,8 +23216,8 @@ if |x[i]| > |y[i]|, [code]#y[i]# if |y[i]| > |x[i]|, otherwise [code]#fmax(x[i], y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23259,8 +23256,8 @@ if |x[i]| < |y[i]|, [code]#y[i]# if |y[i]| < |x[i]|, otherwise [code]#fmin(x[i], y[i])#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23299,9 +23296,8 @@ _Returns:_ The fractional part of the argument [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type with element type [code]#float#, - [code]#double#, or [code]#half#; +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is one of the following: ** A {cpp} cv-unqualified pointer to [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case it is a cv-unqualified @@ -23322,8 +23318,8 @@ It stores the integral parts of each element to the object pointed to by _Returns:_ The fractional parts of each element of the argument [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23347,8 +23343,8 @@ The [code]#nancode# may be placed in the significand of the resulting NaN. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#uint32_t#, [code]#uint64_t#, or [code]#uint16_t#. _Returns:_ A quiet NaN for each element of [code]#nancode#. @@ -23414,8 +23410,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the next representable floating-point value following [code]#x[i]# in the direction of [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23452,8 +23448,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23490,8 +23486,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23533,8 +23529,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23579,8 +23575,8 @@ even one. If [code]#r# is zero, it is given the same sign as [code]#x[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23633,18 +23629,17 @@ _Constraints:_ Available only if all of the following conditions are met: ** (If [code]#NonScalar1# is [code]#marray#): A {cpp} cv-unqualified pointer to [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; or -** (If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# - type): A {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with - the same number of elements as [code]#NonScalar1#; or +** (If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type): A + {cpp} cv-unqualified pointer to [code]#vec# of [code]#int32_t# with the same + number of elements as [code]#NonScalar1#; or ** (If [code]#NonScalar1# is [code]#marray#): A [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable address spaces_ as defined above and whose [code]#ElementType# is [code]#marray# of [code]#int# with the same number of elements as [code]#NonScalar1#; or -** (If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# - type): A [code]#multi_ptr# whose [code]#Space# is equal to one of the - _writeable address spaces_ as defined above and whose [code]#ElementType# is - [code]#vec# of [code]#int32_t# with the same number of elements as - [code]#NonScalar1#. +** (If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type): A + [code]#multi_ptr# whose [code]#Space# is equal to one of the _writeable + address spaces_ as defined above and whose [code]#ElementType# is [code]#vec# + of [code]#int32_t# with the same number of elements as [code]#NonScalar1#. _Effects:_ Computes the value [code]#r# for each element of [code]#x# and [code]#y# such that [code]#r = x[i] - k*y[i]#, where [code]#k# is the integer @@ -23661,8 +23656,8 @@ It stores these signed values to the object pointed to by [code]#quo#. _Returns:_ The values of [code]#r# defined above. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23688,8 +23683,8 @@ a description of the rounding modes. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an @@ -23697,8 +23692,8 @@ integral value (using round to nearest even rounding mode) in floating-point format. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23735,8 +23730,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#1/y[i]#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23760,8 +23755,8 @@ from zero, regardless of the current rounding direction. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the integral value nearest to @@ -23769,8 +23764,8 @@ _Returns:_ For each element of [code]#x#, the integral value nearest to rounding direction. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23793,16 +23788,16 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23825,15 +23820,15 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23871,9 +23866,8 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type with element type [code]#float#, - [code]#double#, or [code]#half#; +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type with element type [code]#float#, [code]#double#, or [code]#half#; * [code]#Ptr# is one of the following: ** A {cpp} cv-unqualified pointer to [code]#NonScalar#, unless [code]#NonScalar# is the [code]#+__swizzle__+# type, in which case it is a cv-unqualified @@ -23891,8 +23885,8 @@ The computed cosine values are written to [code]#cosval#. _Returns:_ The sine of each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23915,15 +23909,15 @@ _Returns:_ The hyperbolic sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23946,15 +23940,15 @@ _Returns:_ The value [code]#sin({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#sin({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -23977,15 +23971,15 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24008,15 +24002,15 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24039,16 +24033,16 @@ _Returns:_ The hyperbolic tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the hyperbolic tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24071,15 +24065,15 @@ _Returns:_ The value [code]#tan({pi} * x)#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#tan({pi} * x[i])#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24102,15 +24096,15 @@ _Returns:_ The gamma function of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the gamma function of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24134,16 +24128,16 @@ zero rounding mode. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ For each element of [code]#x#, the value [code]#x[i]# rounded to an integral value using the round to zero rounding mode. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24185,15 +24179,15 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24214,16 +24208,16 @@ _Returns:_ The value [code]#x / y#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] / y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24244,16 +24238,16 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24274,16 +24268,16 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24304,16 +24298,16 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24334,15 +24328,15 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24363,15 +24357,15 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24392,15 +24386,15 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24423,8 +24417,8 @@ _Returns:_ The value of [code]#x# raised to the power [code]#y#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Preconditions:_ Each element of [code]#x# must be greater than or equal to @@ -24434,8 +24428,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24456,15 +24450,15 @@ _Returns:_ The reciprocal of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the reciprocal of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24485,16 +24479,16 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24515,15 +24509,15 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24544,15 +24538,15 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24573,15 +24567,15 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24624,8 +24618,8 @@ _Returns:_ The cosine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -24634,8 +24628,8 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the cosine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24656,16 +24650,16 @@ _Returns:_ The value [code]#x / y#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x# and [code]#y#, the value [code]#x[i] / y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24686,16 +24680,16 @@ _Returns:_ The base-_e_ exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-_e_ exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24716,16 +24710,16 @@ _Returns:_ The base-2 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-2 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24746,16 +24740,16 @@ _Returns:_ The base-10 exponential of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base-10 exponential of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24776,15 +24770,15 @@ _Returns:_ The natural logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the natural logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24805,15 +24799,15 @@ _Returns:_ The base 2 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 2 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24834,15 +24828,15 @@ _Returns:_ The base 10 logarithm of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the base 10 logarithm of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24865,8 +24859,8 @@ _Returns:_ The value of [code]#x# raised to the power [code]#y#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Preconditions:_ Each element of [code]#x# must be greater than or equal to @@ -24876,8 +24870,8 @@ _Returns:_ For each element of [code]#x# and [code]#y#, the value of [code]#x[i]# raised to the power [code]#y[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24898,15 +24892,15 @@ _Returns:_ The reciprocal of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the reciprocal of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24927,16 +24921,16 @@ _Returns:_ The inverse square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the inverse square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24959,8 +24953,8 @@ _Returns:_ The sine of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -24969,8 +24963,8 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the sine of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -24991,15 +24985,15 @@ _Returns:_ The square root of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Returns:_ For each element of [code]#x#, the square root of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25022,8 +25016,8 @@ _Returns:_ The tangent of [code]#x#. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#. _Preconditions:_ The value of each element of [code]#x# must be in the range @@ -25032,8 +25026,8 @@ _Preconditions:_ The value of each element of [code]#x# must be in the range _Returns:_ For each element of [code]#x#, the tangent of [code]#x[i]#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25111,8 +25105,8 @@ The behavior is undefined if the result cannot be represented by the return type. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25126,12 +25120,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns |x - y|. Otherwise, returns |x[i] - y[i]| for each element of [code]#x# and [code]#y#. @@ -25140,8 +25133,8 @@ The behavior is undefined if the result cannot be represented by the return type. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25155,12 +25148,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#x + y#. Otherwise, returns [code]#x[i] + y[i]# for each element of [code]#x# and @@ -25168,8 +25160,8 @@ Otherwise, returns [code]#x[i] + y[i]# for each element of [code]#x# and The addition operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25183,12 +25175,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#(x + y) >> 1#. Otherwise, returns [code]#(x[i] + y[i]) >> 1# for each element of [code]#x# and @@ -25196,8 +25187,8 @@ Otherwise, returns [code]#(x[i] + y[i]) >> 1# for each element of [code]#x# and The intermediate sum does not modulo overflow. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25211,12 +25202,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#(x + y + 1) >> 1#. Otherwise, returns [code]#(x[i] + y[i] + 1) >> 1# for each element of [code]#x# @@ -25224,8 +25214,8 @@ and [code]#y#. The intermediate sum does not modulo overflow. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25245,13 +25235,12 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; - and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#minval# must be less than or equal to the value of [code]#maxval#. @@ -25264,14 +25253,14 @@ Otherwise, returns [code]#min(max(x[i], minval[i]), maxval[i])# for each element of [code]#x#, [code]#minval#, and [code]#maxval#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer -type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ +as defined above. _Preconditions:_ The value of [code]#minval# must be less than or equal to the value of [code]#maxval#. @@ -25279,8 +25268,8 @@ value of [code]#maxval#. _Returns:_ [code]#min(max(x[i], minval), maxval)# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25300,8 +25289,8 @@ Otherwise, returns the number of leading 0-bits in each element of [code]#x#. When a value is 0, the computed count is the size in bits of that value. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25321,8 +25310,8 @@ Otherwise, returns the number of trailing 0-bits in each element of [code]#x#. When a value is 0, the computed count is the size in bits of that value. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25336,21 +25325,20 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; - and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#mul_hi(a, b)+c#. Otherwise, returns [code]#mul_hi(a[i], b[i])+c[i]# for each element of [code]#a#, [code]#b#, and [code]#c#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25364,13 +25352,12 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; - and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# and [code]#GenInt3# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then [code]#GenInt2# and [code]#GenInt3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#a * b + c#. Otherwise, returns [code]#a[i] * b[i] + c[i]# for each element of [code]#a#, @@ -25378,8 +25365,8 @@ Otherwise, returns [code]#a[i] * b[i] + c[i]# for each element of [code]#a#, The operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25398,12 +25385,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#y# if [code]#x < y# otherwise [code]#x#. @@ -25411,21 +25397,21 @@ When the inputs are not scalars, returns [code]#y[i]# if [code]#x[i] < y[i]# otherwise [code]#x[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer -type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ +as defined above. _Returns:_ [code]#y# if [code]#x[i] < y# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25444,12 +25430,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#y# if [code]#y < x# otherwise [code]#x#. @@ -25457,21 +25442,21 @@ When the inputs are not scalars, returns [code]#y[i]# if [code]#y[i] < x[i]# otherwise [code]#x[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer -type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic integer type_ +as defined above. _Returns:_ [code]#y# if [code]#y < x[i]# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25485,12 +25470,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Effects:_ Computes [code]#x * y# and returns the high half of the product of [code]#x# and [code]#y#. @@ -25501,8 +25485,8 @@ Otherwise, returns the high half of the product of [code]#x[i] * y[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25516,12 +25500,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Effects:_ For each element in [code]#v#, the bits are shifted left by the number of bits given by the corresponding element in [code]#count# (subject to @@ -25536,8 +25519,8 @@ Otherwise, the result of rotating [code]#v[i]# by [code]#count[i]# for each element of [code]#v# and [code]#count#. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25551,12 +25534,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenInt1# is a _generic integer type_ as defined above; -* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenInt2# must be the same as [code]#GenInt1#; and +* If [code]#GenInt1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenInt2# must be the same as [code]#GenInt1#; and * If [code]#GenInt1# is [code]#vec# or the [code]#+__swizzle__+# type, then - [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# - type, and both must have the same element type and the same number of - elements. + [code]#GenInt2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#x - y#. Otherwise, returns [code]#x[i] - y[i]# for each element of [code]#x# and @@ -25564,8 +25546,8 @@ Otherwise, returns [code]#x[i] - y[i]# for each element of [code]#x# and The subtraction operation saturates the result. The return type is [code]#GenInt1# unless [code]#GenInt1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25582,8 +25564,8 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt8Bit1# and [code]#UInt8Bit2# are both [code]#marray# with element type [code]#uint8_t# and the same number of elements; or * [code]#UInt8Bit1# and [code]#UInt8Bit2# are any combination of [code]#vec# or - the [code]#+__swizzle__+# type with element type [code]#uint8_t# and the - same number of elements. + the [code]#+__swizzle__+# type with element type [code]#uint8_t# and the same + number of elements. _Returns:_ When the inputs are scalars, returns [code]#((uint16_t)hi << 8) | lo#. @@ -25611,10 +25593,10 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int8Bit# is [code]#marray# with element type [code]#int8_t# and [code]#UInt8Bit# is [code]#marray# with element type [code]#uint8_t# and both have the same number of elements; or -* [code]#Int8Bit# is [code]#vec# or the [code]#+__swizzle__+# type with - element type [code]#int8_t# and [code]#UInt8Bit# is [code]#vec# or the - [code]#+__swizzle__+# type with element type [code]#uint8_t# and both - have the same number of elements. +* [code]#Int8Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element + type [code]#int8_t# and [code]#UInt8Bit# is [code]#vec# or the + [code]#+__swizzle__+# type with element type [code]#uint8_t# and both have the + same number of elements. _Returns:_ When the inputs are scalars, returns [code]#((int16_t)hi << 8) | lo#. Otherwise, returns [code]#((int16_t)hi[i] << 8) | lo[i]# for each element of @@ -25641,8 +25623,8 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt16Bit1# and [code]#UInt16Bit2# are both [code]#marray# with element type [code]#uint16_t# and the same number of elements; or * [code]#UInt16Bit1# and [code]#UInt16Bit2# are any combination of [code]#vec# - or the [code]#+__swizzle__+# type with element type [code]#uint16_t# and - the same number of elements. + or the [code]#+__swizzle__+# type with element type [code]#uint16_t# and the + same number of elements. _Returns:_ When the inputs are scalars, returns [code]#((uint32_t)hi << 16) | lo#. @@ -25670,10 +25652,10 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int16Bit# is [code]#marray# with element type [code]#int16_t# and [code]#UInt16Bit# is [code]#marray# with element type [code]#uint16_t# and both have the same number of elements; or -* [code]#Int16Bit# is [code]#vec# or the [code]#+__swizzle__+# type with - element type [code]#int16_t# and [code]#UInt16Bit# is [code]#vec# or the - [code]#+__swizzle__+# type with element type [code]#uint16_t# and both - have the same number of elements. +* [code]#Int16Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element + type [code]#int16_t# and [code]#UInt16Bit# is [code]#vec# or the + [code]#+__swizzle__+# type with element type [code]#uint16_t# and both have + the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#((int32_t)hi << 16) | lo#. @@ -25701,8 +25683,8 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#UInt32Bit1# and [code]#UInt32Bit2# are both [code]#marray# with element type [code]#uint32_t# and the same number of elements; or * [code]#UInt32Bit1# and [code]#UInt32Bit2# are any combination of [code]#vec# - or the [code]#+__swizzle__+# type with element type [code]#uint32_t# and - the same number of elements. + or the [code]#+__swizzle__+# type with element type [code]#uint32_t# and the + same number of elements. _Returns:_ When the inputs are scalars, returns [code]#((uint64_t)hi << 32) | lo#. @@ -25730,10 +25712,10 @@ _Constraints:_ Available only if one of the following conditions is met: * [code]#Int32Bit# is [code]#marray# with element type [code]#int32_t# and [code]#UInt32Bit# is [code]#marray# with element type [code]#uint32_t# and both have the same number of elements; or -* [code]#Int32Bit# is [code]#vec# or the [code]#+__swizzle__+# type with - element type [code]#int32_t# and [code]#UInt32Bit# is [code]#vec# or the - [code]#+__swizzle__+# type with element type [code]#uint32_t# and both - have the same number of elements. +* [code]#Int32Bit# is [code]#vec# or the [code]#+__swizzle__+# type with element + type [code]#int32_t# and [code]#UInt32Bit# is [code]#vec# or the + [code]#+__swizzle__+# type with element type [code]#uint32_t# and both have + the same number of elements. _Returns:_ When the inputs are scalars, returns [code]#((int64_t)hi << 32) | lo#. @@ -25764,8 +25746,8 @@ Otherwise, returns the number of non-zero bits in [code]#x[i]# for each element of [code]#x#. The return type is [code]#GenInt# unless [code]#GenInt# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25787,13 +25769,13 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#vec# ** [code]#+__swizzle__+# that is convertible to [code]#vec# ** [code]#+__swizzle__+# that is convertible to [code]#vec# -* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#Int32Bit2# and [code]#Int32Bit# must be the same as +* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#Int32Bit2# and [code]#Int32Bit# must be the same as [code]#Int32Bit1#; and -* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#Int32Bit2# and [code]#Int32Bit3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. +* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#Int32Bit2# and [code]#Int32Bit3# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Preconditions:_ If the inputs are signed scalars, the values of [code]#x# and [code]#y# must be in the range [-2^23^, 2^23^-1]. @@ -25807,8 +25789,8 @@ Otherwise, returns [code]#x[i] * y[i] + z[i]# for each element of [code]#x#, [code]#y#, and [code]#z#. The return type is [code]#Int32Bit1# unless [code]#Int32Bit1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25830,12 +25812,11 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#vec# ** [code]#+__swizzle__+# that is convertible to [code]#vec# ** [code]#+__swizzle__+# that is convertible to [code]#vec# -* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#Int32Bit2# must be the same as [code]#Int32Bit1#; and -* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#Int32Bit2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#Int32Bit1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#Int32Bit2# must be the same as [code]#Int32Bit1#; and +* If [code]#Int32Bit1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#Int32Bit2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Preconditions:_ If the inputs are signed scalars, the values of [code]#x# and [code]#y# must be in the range [-2^23^, 2^23^-1]. @@ -25849,8 +25830,8 @@ Otherwise, returns [code]#x[i] * y[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#Int32Bit1# unless [code]#Int32Bit1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25901,13 +25882,13 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#minval# must be less than or equal to the value of [code]#maxval#. @@ -25920,14 +25901,14 @@ Otherwise, returns [code]#fmin(fmax(x[i], minval[i]), maxval[i])# for each element of [code]#x#, [code]#minval#, and [code]#maxval#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Preconditions:_ The value of [code]#minval# must be less than or equal to the value of [code]#maxval#. @@ -25936,8 +25917,8 @@ _Returns:_ [code]#fmin(fmax(x[i], minval), maxval)# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25958,8 +25939,8 @@ Otherwise, returns [code]#(180 / {pi}) * radians[i]# for each element of [code]#radians#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -25978,12 +25959,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Preconditions:_ When the inputs are scalars, [code]#x# and [code]#y# must not be infinite or NaN. @@ -25996,14 +25976,14 @@ When the inputs are not scalars, returns [code]#y[i]# if [code]#x[i] < y[i]# otherwise [code]#x[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Preconditions:_ No element of [code]#x# may be infinite or NaN. The value of [code]#y# must not be infinite or NaN. @@ -26012,8 +25992,8 @@ _Returns:_ [code]#y# if [code]#x[i] < y# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26032,12 +26012,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Preconditions:_ When the inputs are scalars, [code]#x# and [code]#y# must not be infinite or NaN. @@ -26050,14 +26029,14 @@ When the inputs are not scalars, returns [code]#y[i]# if [code]#y[i] < x[i]# otherwise [code]#x[i]# for each element of [code]#x# and [code]#y#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Preconditions:_ No element of [code]#x# may be infinite or NaN. The value of [code]#y# must not be infinite or NaN. @@ -26066,8 +26045,8 @@ _Returns:_ [code]#y# if [code]#y < x[i]# otherwise [code]#x[i]# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26086,13 +26065,13 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Preconditions:_ If the inputs are scalars, the value of [code]#a# must be in the range [0.0, 1.0]. @@ -26105,14 +26084,14 @@ Otherwise, returns [code]#x[i] + (y[i] - x[i]) * a[i]# for each element of [code]#x#, [code]#y#, and [code]#a#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Preconditions:_ The value of [code]#a# must be in the range [0.0, 1.0]. @@ -26120,8 +26099,8 @@ _Returns:_ The linear blend of [code]#x# and [code]#y#, computed as [code]#x[i] + (y[i] - x[i]) * a# for each element of [code]#x# and [code]#y#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26142,8 +26121,8 @@ Otherwise, returns [code]#({pi} / 180) * degrees[i]# for each element of [code]#degrees#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26162,12 +26141,11 @@ template (2) _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# must be the same as [code]#GenFloat1#; and +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ When the inputs are scalars, returns the value [code]#(x < edge) ? 0.0 : 1.0#. @@ -26175,21 +26153,21 @@ When the inputs are not scalars, returns the value [code]#(x[i] < edge[i]) ? 0.0 : 1.0# for each element of [code]#x# and [code]#edge#. The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Returns:_ The value [code]#(x[i] < edge) ? 0.0 : 1.0# for each element of [code]#x#. The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26209,13 +26187,13 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GenFloat1# is a _generic floating point type_ as defined above; -* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GenFloat2# and [code]#GenFloat3# must be the same as +* If [code]#GenFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GenFloat2# and [code]#GenFloat3# must be the same as [code]#GenFloat1#; and -* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. +* If [code]#GenFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenFloat2# and [code]#GenFloat3# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Preconditions:_ If the inputs are scalar, [code]#edge0# must be less than [code]#edge1# and none of [code]#edge0#, [code]#edge1#, or [code]#x# may be NaN. @@ -26248,14 +26226,14 @@ return t * t * (3 - 2 * t); ---- The return type is [code]#GenFloat1# unless [code]#GenFloat1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. *Overload (2):* _Constraints:_ Available only if [code]#NonScalar# is [code]#marray#, -[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating -point type_ as defined above. +[code]#vec#, or the [code]#+__swizzle__+# type and is a _generic floating point +type_ as defined above. _Preconditions:_ The value of [code]#edge0# must be less than [code]#edge1# and neither [code]#edge0# nor [code]#edge1# may be NaN. @@ -26271,8 +26249,8 @@ return t * t * (3 - 2 * t); ---- The return type is [code]#NonScalar# unless [code]#NonScalar# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26293,8 +26271,8 @@ When the input is not scalar, returns these values for each element of [code]#x#. The return type is [code]#GenFloat# unless [code]#GenFloat# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26372,17 +26350,17 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#+__swizzle__+# that is convertible to [code]#vec# * If [code]#Geo3or4Float1# is [code]#marray#, then [code]#Geo3or4Float2# must be the same as [code]#Geo3or4Float1#; and -* If [code]#Geo3or4Float1# is [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#Geo3or4Float2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#Geo3or4Float1# is [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#Geo3or4Float2# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and both must have the same element type and the + same number of elements. _Returns:_ The cross product of first 3 components of [code]#p0# and [code]#p1#. When the inputs have 4 components, the 4th component of the result is 0.0. The return type is [code]#Geo3or4Float1# unless [code]#Geo3or4Float1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26396,12 +26374,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _generic geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GeoFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ The dot product of [code]#p0# and [code]#p1#. @@ -26420,12 +26397,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _generic geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same element type and - the same number of elements. +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GeoFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same element type and the same number of elements. _Returns:_ The distance between [code]#p0# and [code]#p1#. This is calculated as [code]#length(p0 - p1)#. @@ -26466,8 +26442,8 @@ as defined above. _Returns:_ A vector in the same direction as [code]#p# but with a length of 1. The return type is [code]#GeoFloat# unless [code]#GeoFloat# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26481,12 +26457,11 @@ template _Constraints:_ Available only if all of the following conditions are met: * [code]#GeoFloat1# is a _float geometric type_ as defined above; -* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# - type, then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and -* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GeoFloat2# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and both must have the same number of - elements. +* If [code]#GeoFloat1# is not [code]#vec# or the [code]#+__swizzle__+# type, + then [code]#GeoFloat2# must be the same as [code]#GeoFloat1#; and +* If [code]#GeoFloat1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GeoFloat2# must also be [code]#vec# or the [code]#+__swizzle__+# type, + and both must have the same number of elements. _Returns:_ The value [code]#fast_length(p0 - p1)#. @@ -26547,8 +26522,8 @@ with the following exceptions: -- The return type is [code]#GeoFloat# unless [code]#GeoFloat# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -26639,9 +26614,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] == y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] == y[i]) ? -1 : 0)# for each element of -[code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] == y[i]) ? -1 : 0)# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26698,9 +26673,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] != y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] != y[i]) ? -1 : 0)# for each element of -[code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] != y[i]) ? -1 : 0)# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26757,9 +26732,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] > y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] > y[i]) ? -1 : 0)# for each element of [code]#x# -and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] > y[i]) ? -1 : 0)# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26816,9 +26791,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] >= y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] >= y[i]) ? -1 : 0)# for each element of -[code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] >= y[i]) ? -1 : 0)# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26875,9 +26850,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] < y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] < y[i]) ? -1 : 0)# for each element of [code]#x# -and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] < y[i]) ? -1 : 0)# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26934,9 +26909,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#+(x[i] <= y[i])+# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#+((x[i] <= y[i]) ? -1 : 0)+# for each element of -[code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#+((x[i] <= y[i]) ? -1 : 0)+# for each element of [code]#x# and +[code]#y#. The return type depends on [code]#NonScalar1#: @@ -26993,9 +26968,9 @@ _Constraints:_ Available only if all of the following conditions are met: _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#(x[i] < y[i] || x[i] > y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((x[i] < y[i] || x[i] > y[i]) ? -1 : 0)# for each -element of [code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((x[i] < y[i] || x[i] > y[i]) ? -1 : 0)# for each element of +[code]#x# and [code]#y#. The return type depends on [code]#NonScalar1#: @@ -27041,15 +27016,15 @@ _Returns:_ The value [code]#true# only if [code]#x# has finite value. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# is a finite value. -If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, -returns -1 for each element of [code]#x# if [code]#x[i]# is a finite value and -returns 0 otherwise. +If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns +-1 for each element of [code]#x# if [code]#x[i]# is a finite value and returns 0 +otherwise. The return type depends on [code]#NonScalar#: @@ -27096,15 +27071,15 @@ _Returns:_ The value [code]#true# only if [code]#x# has an infinity value _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has an infinity value. -If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, -returns -1 for each element of [code]#x# if [code]#x[i]# has an infinity value -and returns 0 otherwise. +If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns +-1 for each element of [code]#x# if [code]#x[i]# has an infinity value and +returns 0 otherwise. The return type depends on [code]#NonScalar#: @@ -27150,15 +27125,15 @@ _Returns:_ The value [code]#true# only if [code]#x# has a NaN value. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has a NaN value. -If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, -returns -1 for each element of [code]#x# if [code]#x[i]# has a NaN value and -returns 0 otherwise. +If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns +-1 for each element of [code]#x# if [code]#x[i]# has a NaN value and returns 0 +otherwise. The return type depends on [code]#NonScalar#: @@ -27204,15 +27179,15 @@ _Returns:_ The value [code]#true# only if [code]#x# has a normal value. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if [code]#x[i]# has a normal value. -If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, -returns -1 for each element of [code]#x# if [code]#x[i]# has a normal value and -returns 0 otherwise. +If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns +-1 for each element of [code]#x# if [code]#x[i]# has a normal value and returns +0 otherwise. The return type depends on [code]#NonScalar#: @@ -27274,9 +27249,9 @@ _Effects:_ Tests if each element of [code]#x# and [code]#y# are ordered. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#isequal(x[i], x[i]) && isequal(y[i], y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((isequal(x[i], x[i]) && isequal(y[i], y[i]) ? -1 : 0)# -for each element of [code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((isequal(x[i], x[i]) && isequal(y[i], y[i]) ? -1 : 0)# for +each element of [code]#x# and [code]#y#. The return type depends on [code]#NonScalar1#: @@ -27337,9 +27312,9 @@ _Effects:_ Tests if each element of [code]#x# and [code]#y# are unordered. _Returns:_ If [code]#NonScalar1# is [code]#marray#, the value [code]#isnan(x[i]) || isnan(y[i])# for each element of [code]#x# and [code]#y#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((isnan(x[i]) || isnan(y[i]) ? -1 : 0)# for each -element of [code]#x# and [code]#y#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((isnan(x[i]) || isnan(y[i]) ? -1 : 0)# for each element of +[code]#x# and [code]#y#. The return type depends on [code]#NonScalar1#: @@ -27385,15 +27360,15 @@ _Returns:_ The value [code]#true# only if the sign bit of [code]#x# is set. _Constraints:_ Available only if all of the following conditions are met: -* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the - [code]#+__swizzle__+# type; and +* [code]#NonScalar# is [code]#marray#, [code]#vec#, or the [code]#+__swizzle__+# + type; and * The element type is [code]#float#, [code]#double#, or [code]#half#. _Returns:_ If [code]#NonScalar# is [code]#marray#, returns true for each element of [code]#x# only if the sign bit of [code]#x[i]# is set. -If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, -returns -1 for each element of [code]#x# if the sign bit of [code]#x[i]# is set -and returns 0 otherwise. +If [code]#NonScalar# is [code]#vec# or the [code]#+__swizzle__+# type, returns +-1 for each element of [code]#x# if the sign bit of [code]#x[i]# is set and +returns 0 otherwise. The return type depends on [code]#NonScalar#: @@ -27446,9 +27421,9 @@ _Constraints:_ Available only if [code]#GenInt# is one of the following types: _Returns:_ When [code]#x# is [code]#marray#, returns a Boolean telling whether any element of [code]#x# is true. -When [code]#x# is [code]#vec# or the [code]#+__swizzle__+# type, returns -the value 1 if any element in [code]#x# has its most significant bit set, -otherwise returns the value 0. +When [code]#x# is [code]#vec# or the [code]#+__swizzle__+# type, returns the +value 1 if any element in [code]#x# has its most significant bit set, otherwise +returns the value 0. The return type is [code]#bool# if [code]#GenInt# is [code]#marray#. Otherwise, the return type is [code]#int#. @@ -27503,8 +27478,8 @@ _Constraints:_ Available only if [code]#GenInt# is one of the following types: _Returns:_ When [code]#x# is [code]#marray#, returns a Boolean telling whether all elements of [code]#x# are true. -When [code]#x# is [code]#vec# or the [code]#+__swizzle__+# type, returns -the value 1 if all elements in [code]#x# have their most significant bit set, +When [code]#x# is [code]#vec# or the [code]#+__swizzle__+# type, returns the +value 1 if all elements in [code]#x# have their most significant bit set, otherwise returns the value 0. The return type is [code]#bool# if [code]#GenInt# is [code]#marray#. @@ -27550,13 +27525,13 @@ _Constraints:_ Available only if all of the following conditions are met: defined above; or ** [code]#+__swizzle__+# that is convertible to [code]#vec#, where [code]#T# is one of the _vector element types_; -* If [code]#GenType1# is not [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenType2# and [code]#GenType3# must be the same as - [code]#GenType1#; and -* If [code]#GenType1# is [code]#vec# or the [code]#+__swizzle__+# type, - then [code]#GenType2# and [code]#GenType3# must also be [code]#vec# or the - [code]#+__swizzle__+# type, and all three must have the same element type - and the same number of elements. +* If [code]#GenType1# is not [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenType2# and [code]#GenType3# must be the same as [code]#GenType1#; + and +* If [code]#GenType1# is [code]#vec# or the [code]#+__swizzle__+# type, then + [code]#GenType2# and [code]#GenType3# must also be [code]#vec# or the + [code]#+__swizzle__+# type, and all three must have the same element type and + the same number of elements. _Returns:_ When the input parameters are scalars, returns a result where each bit of the result is the corresponding bit of [code]#a# if the corresponding bit @@ -27569,8 +27544,8 @@ where each bit of the result for element [code]#i# is the corresponding bit of Otherwise it is the corresponding bit of [code]#b[i]#. The return type is [code]#GenType1# unless [code]#GenType1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. ''' @@ -27606,13 +27581,12 @@ _Constraints:_ Available only if all of the following conditions are met: ** [code]#NonScalar2# must be the same as [code]#NonScalar1#; and ** [code]#NonScalar3# must be [code]#marray# with element type [code]#bool# and the same number of elements as [code]#NonScalar1#; -* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, - then: +* If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, then: ** [code]#NonScalar2# must also be [code]#vec# or the [code]#+__swizzle__+# type, and both must have the same element type and the same number of elements; and -** [code]#NonScalar3# must be [code]#vec# or the [code]#+__swizzle__+# type - with the same number of elements as [code]#NonScalar1#. +** [code]#NonScalar3# must be [code]#vec# or the [code]#+__swizzle__+# type with + the same number of elements as [code]#NonScalar1#. The element type of [code]#NonScalar3# must be a signed or unsigned integer with the same number of bits as the element type of [code]#NonScalar1#. @@ -27620,13 +27594,13 @@ _Returns:_ If [code]#NonScalar1# is [code]#marray#, return the value [code]#(c[i] ? b[i] : a[i])# for each element of [code]#a#, [code]#b#, and [code]#c#. -If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, -returns the value [code]#((MSB of c[i] is set) ? b[i] : a[i])# for each element -of [code]#a#, [code]#b#, and [code]#c#. +If [code]#NonScalar1# is [code]#vec# or the [code]#+__swizzle__+# type, returns +the value [code]#((MSB of c[i] is set) ? b[i] : a[i])# for each element of +[code]#a#, [code]#b#, and [code]#c#. The return type is [code]#NonScalar1# unless [code]#NonScalar1# is the -[code]#+__swizzle__+# type, in which case the return type is the -corresponding [code]#vec#. +[code]#+__swizzle__+# type, in which case the return type is the corresponding +[code]#vec#. '''