# _mm256_sign_epi8/16/32

Changes the sign of elements in one source vector depending on the sign of corresponding element in other source vector. The corresponding Intel® AVX2 instruction is VPSIGNB, VPSIGNW, or VPSIGND.

## Syntax

extern __m256i _mm256_sign_epi8(__m256i s1, __m256i s2);

extern __m256i _mm256_sign_epi16(__m256i s1, __m256i s2);

extern __m256i _mm256_sign_epi32(__m256i s1, __m256i s2);

## Arguments

s1 | integer source vector used for the operation
s2 | integer source vector used for the operation

## Description

Modifies the sign of data elements in the source vector s1 depending on the sign of corresponding element in vector s2 as follows:

- If sign of data element in s2 vector is < 0 then the sign of corresponding data element in vector s1 is made negative.

- If sign of data element in s2 vector is > 0 then the sign of corresponding data element in vector s1 is left unchanged.

- If the data element in s2 vector is = 0 then the corresponding data element in vector s1 is set to 0.

The _mm256_sign_epi8 intrinsic operates on 8-bit signed bytes. The _mm256_sign_epi16 intrinsic operates on 16-bit signed words. The _mm256_sign_epi32 intrinsic operates on 32-bit signed integers.

## Returns

Result of the operation.

Parent topic: Intrinsics for Arithmetic Operations