@@ -2636,27 +2636,31 @@ fma :: intrinsics.fused_mul_add
26362636/*
26372637Convert pointer to SIMD vector to an array pointer.
26382638*/
2639+ @(require_results)
26392640to_array_ptr :: #force_inline proc " contextless" (v: ^#simd [$LANES ]$E ) -> ^[LANES]E {
26402641 return (^[LANES]E)(v)
26412642}
26422643
26432644/*
26442645Convert SIMD vector to an array.
26452646*/
2647+ @(require_results)
26462648to_array :: #force_inline proc " contextless" (v: #simd [$LANES ]$E ) -> [LANES]E {
26472649 return transmute ([LANES]E)(v)
26482650}
26492651
26502652/*
26512653Convert array to SIMD vector.
26522654*/
2655+ @(require_results)
26532656from_array :: #force_inline proc " contextless" (v: $A /[$LANES ]$E ) -> #simd [LANES]E {
26542657 return transmute (#simd [LANES]E)v
26552658}
26562659
26572660/*
26582661Convert slice to SIMD vector.
26592662*/
2663+ @(require_results)
26602664from_slice :: proc ($T : typeid /#simd [$LANES ]$E , slice: []E) -> T {
26612665 assert (len (slice) >= LANES, " slice length must be a least the number of lanes" )
26622666 array: [LANES]E
@@ -2689,13 +2693,15 @@ Example:
26892693 | 0xff | 0xaf | 0x7f | 0x00 |
26902694 +------+------+------+------+
26912695*/
2696+ @(require_results)
26922697bit_not :: #force_inline proc " contextless" (v: $T /#simd [$LANES ]$E ) -> T where intrinsics.type_is_integer (E) {
26932698 return bit_xor (v, T (~E (0 )))
26942699}
26952700
26962701/*
26972702Copy the signs from lanes of one SIMD vector into another SIMD vector.
26982703*/
2704+ @(require_results)
26992705copysign :: #force_inline proc " contextless" (v, sign: $T /#simd [$LANES ]$E ) -> T where intrinsics.type_is_float (E) {
27002706 neg_zero := to_bits (T (-0.0 ))
27012707 sign_bit := to_bits (sign) & neg_zero
@@ -2711,6 +2717,7 @@ This procedure returns a vector, each lane of which contains either +1.0 or
27112717input vector. If the lane of the input vector has NaN, then the result vector
27122718will contain this NaN value as-is.
27132719*/
2720+ @(require_results)
27142721signum :: #force_inline proc " contextless" (v: $T /#simd [$LANES ]$E ) -> T where intrinsics.type_is_float (E) {
27152722 is_nan := lanes_ne (v, v)
27162723 return select (is_nan, v, copysign (T (1 ), v))
@@ -2745,6 +2752,7 @@ Example:
27452752 | 0.5 | 1 | 0.33 | 0.2 |
27462753 +------+------+------+------+
27472754*/
2755+ @(require_results)
27482756recip :: #force_inline proc " contextless" (v: $T /#simd [$LANES ]$E ) -> T where intrinsics.type_is_float (E) {
27492757 return T (1 ) / v
27502758}
0 commit comments