# Conditional Select Operators for Fvec Classes

Each conditional function compares single-precision floating-point values of A and B. The C and D parameters are used for return value. Comparison between objects of any Fvec class returns the same class.

## Conditional Select Operators for Fvec Classes

Conditional Select for: | Operators | Syntax
--- | --- | ---
Equality | select_eq | `R = select_eq(A, B)`
Inequality | select_neq | `R = select_neq(A, B)`
Greater Than | select_gt | `R = select_gt(A, B)`
Greater Than or Equal To | select_ge | `R = select_ge(A, B)`
Not Greater Than | select_gt | `R = select_gt(A, B)`
Not Greater Than or Equal To | select_ge | `R = select_ge(A, B)`
Less Than | select_lt | `R = select_lt(A, B)`
Less Than or Equal To | select_le | `R = select_le(A, B)`
Not Less Than | select_nlt | `R = select_nlt(A, B)`
Not Less Than or Equal To | select_nle | `R = select_nle(A, B)`

## Conditional Select Operator Usage

For conditional select operators, the return value is stored in C if the comparison is true or in D if false. The following table shows the return values for each class of the conditional select operators, using the Return Value Notation described earlier.

Compare Operator Return Value Mapping

R | A0 | Operators | B | C | D | F32vec4 | F64vec2 | F32vec1
--- | --- | --- | --- | --- | --- | --- | --- | ---
`R0:=` | ``(A1`` `!(A1` | `select_[eq | lt | le | gt | ge]` `select_[ne | nlt | nle | ngt | nge]` | `B0)` `B0)` | `C0` `C0` | `D0` `D0` | `X` | `X` | `X`
`R1:=` | `(A2` `!(A2` | `select_[eq | lt | le | gt | ge]` `select_[ne | nlt | nle | ngt | nge]` | `B1)` `B1)` | `C1` `C1` | `D1` `D1` | `X` | `X` | `N/A`
`R2:=` | `(A2` `!(A2` | `select_[eq | lt | le | gt | ge]` `select_[ne | nlt | nle | ngt | nge]` | `B2)` `B2)` | `C2` `C2` | `D2` `D2` | `X` | `N/A` | `N/A`
`R3:=` | `(A3` `!(A3` | `select_[eq | lt | le | gt | ge]` `select_[ne | nlt | nle | ngt | nge]` | `B3)` `B3)` | `C3` `C3` | `D3` `D3` | `X` | `N/A` | `N/A`

The following table shows examples for conditional select operations and corresponding intrinsics.

Conditional Select Operations for Fvec Classes

Returns | Example Syntax Usage | Intrinsic
--- | --- | ---
Compare for Equality
4 floats | `F32vec4 R = select_eq(F32vec4 A);` | _mm_cmpeq_ps
2 doubles | `F64vec2 R = select_eq(F64vec2 A);` | _mm_cmpeq_pd
1 float | `F32vec1 R = select_eq(F32vec1 A);` | _mm_cmpeq_ss

Compare for Inequality
4 floats | `F32vec4 R = select_neq(F32vec4 A);` | _mm_cmpneq_ps
2 doubles | `F64vec2 R = select_neq(F64vec2 A);` | _mm_cmpneq_pd
1 float | `F32vec1 R = select_neq(F32vec1 A);` | _mm_cmpneq_ss

Compare for Less Than
4 floats | `F32vec4 R = select_lt(F32vec4 A);` | _mm_cmplt_ps
2 doubles | `F64vec2 R = select_lt(F64vec2 A);` | _mm_cmplt_pd
1 float | `F32vec1 R = select_lt(F32vec1 A);` | _mm_cmplt_ss

Compare for Less Than or Equal
4 floats | `F32vec4 R = select_le(F32vec4 A);` | _mm_cmple_ps
2 doubles | `F64vec2 R = select_le(F64vec2 A);` | _mm_cmple_pd
1 float | `F32vec1 R = select_le(F32vec1 A);` | _mm_cmple_ps

Compare for Greater Than
4 floats | `F32vec4 R = select_gt(F32vec4 A);` | _mm_cmpgt_ps
2 doubles | `F64vec2 R = select_gt(F64vec2 A);` | _mm_cmpgt_pd
1 float | `F32vec1 R = select_gt(F32vec1 A);` | _mm_cmpgt_ss

Compare for Greater Than or Equal To
4 floats | `F32vec1 R = select_ge(F32vec4 A);` | _mm_cmpge_ps
2 doubles | `F64vec2 R = select_ge(F64vec2 A);` | _mm_cmpge_pd
1 float | `F32vec1 R = select_ge(F32vec1 A);` | _mm_cmpge_ss

Compare for Not Less Than
4 floats | `F32vec1 R = select_nlt(F32vec4 A);` | _mm_cmpnlt_ps
2 doubles | `F64vec2 R = select_nlt(F64vec2 A);` | _mm_cmpnlt_pd
1 float | `F32vec1 R = select_nlt(F32vec1 A);` | _mm_cmpnlt_ss

Compare for Not Less Than or Equal
4 floats | `F32vec1 R = select_nle(F32vec4 A);` | _mm_cmpnle_ps
2 doubles | `F64vec2 R = select_nle(F64vec2 A);` | _mm_cmpnle_pd
1 float | `F32vec1 R = select_nle(F32vec1 A);` | _mm_cmpnle_ss

Compare for Not Greater Than
4 floats | `F32vec1 R = select_ngt(F32vec4 A);` | _mm_cmpngt_ps
2 doubles | `F64vec2 R = select_ngt(F64vec2 A);` | _mm_cmpngt_pd
1 float | `F32vec1 R = select_ngt(F32vec1 A);` | _mm_cmpngt_ss

Compare for Not Greater Than or Equal
4 floats | `F32vec1 R = select_nge(F32vec4 A);` | _mm_cmpnge_ps
2 doubles | `F64vec2 R = select_nge(F64vec2 A);` | _mm_cmpnge_pd
1 float | `F32vec1 R = select_nge(F32vec1 A);` | _mm_cmpnge_ss

Parent topic: Floating-point Vector Classes