; SSE42-NEXT: pand %xmm1, %xmm0
; SSE42-NEXT: retq
;
-; AVX1-LABEL: not_signbit_mask_v2i64:
-; AVX1: # %bb.0:
-; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
-; AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
-; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX1-NEXT: retq
-;
-; AVX2-LABEL: not_signbit_mask_v2i64:
-; AVX2: # %bb.0:
-; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
-; AVX2-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
-; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
-; AVX2-NEXT: retq
-;
-; AVX512-LABEL: not_signbit_mask_v2i64:
-; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
-; AVX512-NEXT: retq
+; AVX-LABEL: not_signbit_mask_v2i64:
+; AVX: # %bb.0:
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
+; AVX-NEXT: retq
%sh = ashr <2 x i64> %x, <i64 63, i64 63>
%not = xor <2 x i64> %sh, <i64 -1, i64 -1>
%and = and <2 x i64> %y, %not
define <4 x i32> @not_signbit_mask_v4i32(<4 x i32> %x, <4 x i32> %y) {
; SSE-LABEL: not_signbit_mask_v4i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtd %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: not_signbit_mask_v4i32:
; AVX: # %bb.0:
-; AVX-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
%sh = ashr <4 x i32> %x, <i32 31, i32 31, i32 31, i32 31>
%not = xor <4 x i32> %sh, <i32 -1, i32 -1, i32 -1, i32 -1>
define <8 x i16> @not_signbit_mask_v8i16(<8 x i16> %x, <8 x i16> %y) {
; SSE-LABEL: not_signbit_mask_v8i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: not_signbit_mask_v8i16:
; AVX: # %bb.0:
-; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
; AVX-NEXT: retq
%sh = ashr <8 x i16> %x, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
%not = xor <8 x i16> %sh, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
;
; AVX512-LABEL: not_signbit_mask_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm0, %ymm1, %ymm0
; AVX512-NEXT: retq
%sh = ashr <4 x i64> %x, <i64 63, i64 63, i64 63, i64 63>
%not = xor <4 x i64> %sh, <i64 -1, i64 -1, i64 -1, i64 -1>
define <8 x i32> @not_signbit_mask_v8i32(<8 x i32> %x, <8 x i32> %y) {
; SSE-LABEL: not_signbit_mask_v8i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psrad $31, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtd %xmm4, %xmm1
+; SSE-NEXT: pcmpgtd %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: not_signbit_mask_v8i32:
;
; AVX2-LABEL: not_signbit_mask_v8i32:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%sh = ashr <8 x i32> %x, <i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31>
%not = xor <8 x i32> %sh, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
define <16 x i16> @not_signbit_mask_v16i16(<16 x i16> %x, <16 x i16> %y) {
; SSE-LABEL: not_signbit_mask_v16i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psraw $15, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtw %xmm4, %xmm1
+; SSE-NEXT: pcmpgtw %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: not_signbit_mask_v16i16:
;
; AVX2-LABEL: not_signbit_mask_v16i16:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm0, %ymm1, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v16i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm0, %ymm1, %ymm0
; AVX512-NEXT: retq
%sh = ashr <16 x i16> %x, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
%not = xor <16 x i16> %sh, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
; SSE42-NEXT: pand %xmm1, %xmm0
; SSE42-NEXT: retq
;
-; AVX1-LABEL: ispositive_mask_v2i64:
-; AVX1: # %bb.0:
-; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
-; AVX1-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
-; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: retq
-;
-; AVX2-LABEL: ispositive_mask_v2i64:
-; AVX2: # %bb.0:
-; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
-; AVX2-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
-; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
-; AVX2-NEXT: retq
-;
-; AVX512-LABEL: ispositive_mask_v2i64:
-; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
-; AVX512-NEXT: retq
+; AVX-LABEL: ispositive_mask_v2i64:
+; AVX: # %bb.0:
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
+; AVX-NEXT: retq
%cmp = icmp sgt <2 x i64> %x, <i64 -1, i64 -1>
%mask = sext <2 x i1> %cmp to <2 x i64>
%and = and <2 x i64> %mask, %y
define <4 x i32> @is_positive_mask_v4i32(<4 x i32> %x, <4 x i32> %y) {
; SSE-LABEL: is_positive_mask_v4i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtd %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: is_positive_mask_v4i32:
; AVX: # %bb.0:
-; AVX-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm0, %xmm1, %xmm0
; AVX-NEXT: retq
%cmp = icmp sgt <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
%mask = sext <4 x i1> %cmp to <4 x i32>
define <8 x i16> @is_positive_mask_v8i16(<8 x i16> %x, <8 x i16> %y) {
; SSE-LABEL: is_positive_mask_v8i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: is_positive_mask_v8i16:
; AVX: # %bb.0:
-; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
%cmp = icmp sgt <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%mask = sext <8 x i1> %cmp to <8 x i16>
;
; AVX512-LABEL: is_positive_mask_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <4 x i64> %x, <i64 -1, i64 -1, i64 -1, i64 -1>
%mask = sext <4 x i1> %cmp to <4 x i64>
define <8 x i32> @is_positive_mask_v8i32(<8 x i32> %x, <8 x i32> %y) {
; SSE-LABEL: is_positive_mask_v8i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psrad $31, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtd %xmm4, %xmm1
+; SSE-NEXT: pcmpgtd %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_v8i32:
;
; AVX2-LABEL: is_positive_mask_v8i32:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm0, %ymm1, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: is_positive_mask_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm0, %ymm1, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <8 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%mask = sext <8 x i1> %cmp to <8 x i32>
define <16 x i16> @is_positive_mask_v16i16(<16 x i16> %x, <16 x i16> %y) {
; SSE-LABEL: is_positive_mask_v16i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psraw $15, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtw %xmm4, %xmm1
+; SSE-NEXT: pcmpgtw %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_v16i16:
;
; AVX2-LABEL: is_positive_mask_v16i16:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: is_positive_mask_v16i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <16 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%mask = sext <16 x i1> %cmp to <16 x i16>
; SSE42-NEXT: pand (%rdi), %xmm0
; SSE42-NEXT: retq
;
-; AVX1-LABEL: ispositive_mask_load_v2i64:
-; AVX1: # %bb.0:
-; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX1-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
-; AVX1-NEXT: vpand (%rdi), %xmm0, %xmm0
-; AVX1-NEXT: retq
-;
-; AVX2-LABEL: ispositive_mask_load_v2i64:
-; AVX2: # %bb.0:
-; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX2-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
-; AVX2-NEXT: vpand (%rdi), %xmm0, %xmm0
-; AVX2-NEXT: retq
-;
-; AVX512-LABEL: ispositive_mask_load_v2i64:
-; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %xmm0, %xmm0
-; AVX512-NEXT: vpandn (%rdi), %xmm0, %xmm0
-; AVX512-NEXT: retq
+; AVX-LABEL: ispositive_mask_load_v2i64:
+; AVX: # %bb.0:
+; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
+; AVX-NEXT: vpcmpgtq %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpand (%rdi), %xmm0, %xmm0
+; AVX-NEXT: retq
%cmp = icmp sgt <2 x i64> %x, <i64 -1, i64 -1>
%mask = sext <2 x i1> %cmp to <2 x i64>
%y = load <2 x i64>, <2 x i64>* %p
define <4 x i32> @is_positive_mask_load_v4i32(<4 x i32> %x, <4 x i32>* %p) {
; SSE-LABEL: is_positive_mask_load_v4i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn (%rdi), %xmm0
+; SSE-NEXT: pcmpeqd %xmm1, %xmm1
+; SSE-NEXT: pcmpgtd %xmm1, %xmm0
+; SSE-NEXT: pand (%rdi), %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: is_positive_mask_load_v4i32:
; AVX: # %bb.0:
-; AVX-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX-NEXT: vpandn (%rdi), %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
+; AVX-NEXT: vpcmpgtd %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpand (%rdi), %xmm0, %xmm0
; AVX-NEXT: retq
%cmp = icmp sgt <4 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1>
%mask = sext <4 x i1> %cmp to <4 x i32>
define <8 x i16> @is_positive_mask_load_v8i16(<8 x i16> %x, <8 x i16>* %p) {
; SSE-LABEL: is_positive_mask_load_v8i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn (%rdi), %xmm0
+; SSE-NEXT: pcmpeqd %xmm1, %xmm1
+; SSE-NEXT: pcmpgtw %xmm1, %xmm0
+; SSE-NEXT: pand (%rdi), %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: is_positive_mask_load_v8i16:
; AVX: # %bb.0:
-; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX-NEXT: vpandn (%rdi), %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
+; AVX-NEXT: vpcmpgtw %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpand (%rdi), %xmm0, %xmm0
; AVX-NEXT: retq
%cmp = icmp sgt <8 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%mask = sext <8 x i1> %cmp to <8 x i16>
;
; AVX512-LABEL: is_positive_mask_load_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %ymm0, %ymm0
-; AVX512-NEXT: vpandn (%rdi), %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
+; AVX512-NEXT: vpcmpgtq %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpand (%rdi), %ymm0, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <4 x i64> %x, <i64 -1, i64 -1, i64 -1, i64 -1>
%mask = sext <4 x i1> %cmp to <4 x i64>
define <8 x i32> @is_positive_mask_load_v8i32(<8 x i32> %x, <8 x i32>* %p) {
; SSE-LABEL: is_positive_mask_load_v8i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn (%rdi), %xmm0
-; SSE-NEXT: psrad $31, %xmm1
-; SSE-NEXT: pandn 16(%rdi), %xmm1
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtd %xmm2, %xmm1
+; SSE-NEXT: pcmpgtd %xmm2, %xmm0
+; SSE-NEXT: pand (%rdi), %xmm0
+; SSE-NEXT: pand 16(%rdi), %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_load_v8i32:
;
; AVX2-LABEL: is_positive_mask_load_v8i32:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX2-NEXT: vpandn (%rdi), %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
+; AVX2-NEXT: vpcmpgtd %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpand (%rdi), %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: is_positive_mask_load_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX512-NEXT: vpandn (%rdi), %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
+; AVX512-NEXT: vpcmpgtd %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpand (%rdi), %ymm0, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <8 x i32> %x, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%mask = sext <8 x i1> %cmp to <8 x i32>
define <16 x i16> @is_positive_mask_load_v16i16(<16 x i16> %x, <16 x i16>* %p) {
; SSE-LABEL: is_positive_mask_load_v16i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn (%rdi), %xmm0
-; SSE-NEXT: psraw $15, %xmm1
-; SSE-NEXT: pandn 16(%rdi), %xmm1
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm1
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand (%rdi), %xmm0
+; SSE-NEXT: pand 16(%rdi), %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_load_v16i16:
;
; AVX2-LABEL: is_positive_mask_load_v16i16:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX2-NEXT: vpandn (%rdi), %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
+; AVX2-NEXT: vpcmpgtw %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpand (%rdi), %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: is_positive_mask_load_v16i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX512-NEXT: vpandn (%rdi), %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1
+; AVX512-NEXT: vpcmpgtw %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpand (%rdi), %ymm0, %ymm0
; AVX512-NEXT: retq
%cmp = icmp sgt <16 x i16> %x, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%mask = sext <16 x i1> %cmp to <16 x i16>
define <4 x i1> @is_positive_mask_v4i32_v4i1(<4 x i32> %x, <4 x i1> %y) {
; SSE-LABEL: is_positive_mask_v4i32_v4i1:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtd %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_v4i32_v4i1:
; AVX1: # %bb.0:
-; AVX1-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX1-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX1-NEXT: vpand %xmm0, %xmm1, %xmm0
; AVX1-NEXT: retq
;
; AVX2-LABEL: is_positive_mask_v4i32_v4i1:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX2-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX2-NEXT: vpand %xmm0, %xmm1, %xmm0
; AVX2-NEXT: retq
;
; AVX512F-LABEL: is_positive_mask_v4i32_v4i1:
define <8 x i1> @is_positive_mask_v8i16_v8i1(<8 x i16> %x, <8 x i1> %y) {
; SSE-LABEL: is_positive_mask_v8i16_v8i1:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX1-LABEL: is_positive_mask_v8i16_v8i1:
; AVX1: # %bb.0:
-; AVX1-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX1-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX1-NEXT: retq
;
; AVX2-LABEL: is_positive_mask_v8i16_v8i1:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX2-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX2-NEXT: retq
;
; AVX512F-LABEL: is_positive_mask_v8i16_v8i1:
; AVX512F: # %bb.0:
-; AVX512F-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX512F-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX512F-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX512F-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX512F-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX512F-NEXT: retq
;
; AVX512DQBW-LABEL: is_positive_mask_v8i16_v8i1:
; SSE2-LABEL: is_positive_mask_v4i64_v4i1:
; SSE2: # %bb.0:
; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,3],xmm1[1,3]
-; SSE2-NEXT: psrad $31, %xmm0
-; SSE2-NEXT: pandn %xmm2, %xmm0
+; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
+; SSE2-NEXT: pcmpgtd %xmm1, %xmm0
+; SSE2-NEXT: pand %xmm2, %xmm0
; SSE2-NEXT: retq
;
; SSE42-LABEL: is_positive_mask_v4i64_v4i1:
define <8 x i16> @not_signbit_mask_v8i16(<8 x i16> %a, <8 x i16> %b) {
; SSE-LABEL: not_signbit_mask_v8i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: not_signbit_mask_v8i16:
; AVX: # %bb.0:
-; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v8i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX512-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX512-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX512-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX512-NEXT: retq
%cond = icmp sgt <8 x i16> %a, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%r = select <8 x i1> %cond, <8 x i16> %b, <8 x i16> zeroinitializer
define <8 x i16> @not_signbit_mask_swap_v8i16(<8 x i16> %a, <8 x i16> %b) {
; SSE-LABEL: not_signbit_mask_swap_v8i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtw %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: not_signbit_mask_swap_v8i16:
; AVX: # %bb.0:
-; AVX-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_swap_v8i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX512-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX512-NEXT: vpcmpgtw %xmm2, %xmm0, %xmm0
+; AVX512-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX512-NEXT: retq
%cond = icmp slt <8 x i16> %a, zeroinitializer
%r = select <8 x i1> %cond, <8 x i16> zeroinitializer, <8 x i16> %b
define <4 x i32> @not_signbit_mask_v4i32(<4 x i32> %a, <4 x i32> %b) {
; SSE-LABEL: not_signbit_mask_v4i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm1, %xmm0
+; SSE-NEXT: pcmpeqd %xmm2, %xmm2
+; SSE-NEXT: pcmpgtd %xmm2, %xmm0
+; SSE-NEXT: pand %xmm1, %xmm0
; SSE-NEXT: retq
;
; AVX-LABEL: not_signbit_mask_v4i32:
; AVX: # %bb.0:
-; AVX-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v4i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX512-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX512-NEXT: vpcmpgtd %xmm2, %xmm0, %xmm0
+; AVX512-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX512-NEXT: retq
%cond = icmp sgt <4 x i32> %a, <i32 -1, i32 -1, i32 -1, i32 -1>
%r = select <4 x i1> %cond, <4 x i32> %b, <4 x i32> zeroinitializer
;
; AVX512-LABEL: not_signbit_mask_v2i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %xmm0, %xmm0
-; AVX512-NEXT: vpandn %xmm1, %xmm0, %xmm0
+; AVX512-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
+; AVX512-NEXT: vpcmpgtq %xmm2, %xmm0, %xmm0
+; AVX512-NEXT: vpand %xmm1, %xmm0, %xmm0
; AVX512-NEXT: retq
%cond = icmp sgt <2 x i64> %a, <i64 -1, i64 -1>
%r = select <2 x i1> %cond, <2 x i64> %b, <2 x i64> zeroinitializer
define <16 x i16> @not_signbit_mask_v16i16(<16 x i16> %a, <16 x i16> %b) {
; SSE-LABEL: not_signbit_mask_v16i16:
; SSE: # %bb.0:
-; SSE-NEXT: psraw $15, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psraw $15, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtw %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pcmpgtw %xmm4, %xmm1
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: not_signbit_mask_v16i16:
;
; AVX2-LABEL: not_signbit_mask_v16i16:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v16i16:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraw $15, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtw %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cond = icmp sgt <16 x i16> %a, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1>
%r = select <16 x i1> %cond, <16 x i16> %b, <16 x i16> zeroinitializer
define <8 x i32> @not_signbit_mask_v8i32(<8 x i32> %a, <8 x i32> %b) {
; SSE-LABEL: not_signbit_mask_v8i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psrad $31, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtd %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pcmpgtd %xmm4, %xmm1
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: not_signbit_mask_v8i32:
;
; AVX2-LABEL: not_signbit_mask_v8i32:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cond = icmp sgt <8 x i32> %a, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
%r = select <8 x i1> %cond, <8 x i32> %b, <8 x i32> zeroinitializer
define <8 x i32> @not_signbit_mask_swap_v8i32(<8 x i32> %a, <8 x i32> %b) {
; SSE-LABEL: not_signbit_mask_swap_v8i32:
; SSE: # %bb.0:
-; SSE-NEXT: psrad $31, %xmm0
-; SSE-NEXT: pandn %xmm2, %xmm0
-; SSE-NEXT: psrad $31, %xmm1
-; SSE-NEXT: pandn %xmm3, %xmm1
+; SSE-NEXT: pcmpeqd %xmm4, %xmm4
+; SSE-NEXT: pcmpgtd %xmm4, %xmm0
+; SSE-NEXT: pand %xmm2, %xmm0
+; SSE-NEXT: pcmpgtd %xmm4, %xmm1
+; SSE-NEXT: pand %xmm3, %xmm1
; SSE-NEXT: retq
;
; AVX1-LABEL: not_signbit_mask_swap_v8i32:
;
; AVX2-LABEL: not_signbit_mask_swap_v8i32:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX2-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX2-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX2-NEXT: retq
;
; AVX512-LABEL: not_signbit_mask_swap_v8i32:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsrad $31, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtd %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cond = icmp slt <8 x i32> %a, zeroinitializer
%r = select <8 x i1> %cond, <8 x i32> zeroinitializer, <8 x i32> %b
;
; AVX512-LABEL: not_signbit_mask_v4i64:
; AVX512: # %bb.0:
-; AVX512-NEXT: vpsraq $63, %ymm0, %ymm0
-; AVX512-NEXT: vpandn %ymm1, %ymm0, %ymm0
+; AVX512-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
+; AVX512-NEXT: vpcmpgtq %ymm2, %ymm0, %ymm0
+; AVX512-NEXT: vpand %ymm1, %ymm0, %ymm0
; AVX512-NEXT: retq
%cond = icmp sgt <4 x i64> %a, <i64 -1, i64 -1, i64 -1, i64 -1>
%r = select <4 x i1> %cond, <4 x i64> %b, <4 x i64> zeroinitializer