forked from OSchip/llvm-project
913 lines
44 KiB
LLVM
913 lines
44 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+sse2 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-SSE,CHECK-SSE2
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+sse4.1 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-SSE,CHECK-SSE41
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+avx < %s | FileCheck %s --check-prefixes=CHECK,CHECK-AVX,CHECK-AVX1
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+avx2 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-AVX,CHECK-AVX2
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f,+avx512vl < %s | FileCheck %s --check-prefixes=CHECK,CHECK-AVX,CHECK-AVX512VL
|
|
|
|
; At the moment, BuildUREMEqFold does not handle nonsplat vectors.
|
|
|
|
define <4 x i32> @test_urem_odd_div(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_odd_div:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,613566757,954437177]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm1
|
|
; CHECK-SSE2-NEXT: psubd %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: pmuludq {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE2-NEXT: psrlq $32, %xmm1
|
|
; CHECK-SSE2-NEXT: paddd %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: movdqa %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: psrld $1, %xmm2
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE2-NEXT: movdqa %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1],xmm2[3,3]
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [3,5,7,9]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm3, %xmm5
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,3],xmm1[1,2]
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2,3,1]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_odd_div:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,613566757,954437177]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm3
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-SSE41-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm2
|
|
; CHECK-SSE41-NEXT: pmuludq {{.*}}(%rip), %xmm2
|
|
; CHECK-SSE41-NEXT: psrlq $32, %xmm2
|
|
; CHECK-SSE41-NEXT: paddd %xmm1, %xmm2
|
|
; CHECK-SSE41-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: psrld $1, %xmm2
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,3,4,5],xmm2[6,7]
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm2
|
|
; CHECK-SSE41-NEXT: psubd %xmm2, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_odd_div:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,613566757,954437177]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq {{.*}}(%rip), %xmm2, %xmm2
|
|
; CHECK-AVX1-NEXT: vpsrlq $32, %xmm2, %xmm2
|
|
; CHECK-AVX1-NEXT: vpaddd %xmm1, %xmm2, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm2
|
|
; CHECK-AVX1-NEXT: vpsrld $1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3,4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_odd_div:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,613566757,954437177]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq {{.*}}(%rip), %xmm2, %xmm2
|
|
; CHECK-AVX2-NEXT: vpsrlq $32, %xmm2, %xmm2
|
|
; CHECK-AVX2-NEXT: vpaddd %xmm1, %xmm2, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_odd_div:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,613566757,954437177]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq {{.*}}(%rip), %xmm2, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm3, %xmm3, %xmm3
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm2 = xmm2[0],xmm3[1],xmm2[2],xmm3[3]
|
|
; CHECK-AVX512VL-NEXT: vpaddd %xmm1, %xmm2, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm3, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 3, i32 5, i32 7, i32 9>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_even_div(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_even_div:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,2454267027]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm3
|
|
; CHECK-SSE2-NEXT: psrld $1, %xmm3
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm4
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm4 = xmm4[1,1],xmm3[3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE2-NEXT: psrld $3, %xmm2
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm3
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1],xmm1[3,3]
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [6,10,12,14]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm3, %xmm5
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,3],xmm2[1,2]
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2,3,1]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_even_div:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: psrld $1, %xmm1
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm0[0,1,2,3,4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm3 = [2863311531,3435973837,2863311531,2454267027]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm4
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm3, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm4[2,3],xmm1[4,5],xmm4[6,7]
|
|
; CHECK-SSE41-NEXT: movdqa %xmm1, %xmm2
|
|
; CHECK-SSE41-NEXT: psrld $3, %xmm2
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3,4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_even_div:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vpsrld $1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm0[0,1,2,3,4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [2863311531,3435973837,2863311531,2454267027]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm4, %xmm2, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm3, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $3, %xmm1, %xmm2
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3,4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_even_div:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,2454267027]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm0, %xmm3
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm4, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm3, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_even_div:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,2454267027]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm0, %xmm3
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm4, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm3, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 6, i32 10, i32 12, i32 14>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_pow2(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_pow2:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,268435456]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: psrld $3, %xmm1
|
|
; CHECK-SSE2-NEXT: movdqa %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,1],xmm2[3,3]
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [6,10,12,16]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm4[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm3, %xmm5
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm5[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,3],xmm1[2,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_pow2:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,268435456]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm3
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-SSE41-NEXT: movdqa %xmm1, %xmm2
|
|
; CHECK-SSE41-NEXT: psrld $3, %xmm2
|
|
; CHECK-SSE41-NEXT: movdqa %xmm2, %xmm3
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm3 = xmm3[0,1,2,3],xmm1[4,5,6,7]
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5,6,7]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_pow2:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,268435456]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $3, %xmm1, %xmm2
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm3 = xmm2[0,1,2,3],xmm1[4,5,6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5,6,7]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_pow2:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,268435456]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_pow2:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,268435456]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 6, i32 10, i32 12, i32 16>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_one(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_one:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,0,2863311531,2454267027]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm3
|
|
; CHECK-SSE2-NEXT: psrld $1, %xmm3
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm4
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm4 = xmm4[1,1],xmm3[3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm3
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm3 = xmm3[1,0],xmm1[0,0]
|
|
; CHECK-SSE2-NEXT: psrld $3, %xmm2
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm3 = xmm3[2,0],xmm2[2,3]
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm2 = [6,1,12,14]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm2, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm4
|
|
; CHECK-SSE2-NEXT: shufps {{.*#+}} xmm4 = xmm4[1,1],xmm1[3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm4, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm3, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_one:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: psrld $1, %xmm1
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm0[0,1,2,3,4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm3 = [2863311531,0,2863311531,2454267027]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm4
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm3, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm4[2,3],xmm1[4,5],xmm4[6,7]
|
|
; CHECK-SSE41-NEXT: movdqa %xmm1, %xmm2
|
|
; CHECK-SSE41-NEXT: psrld $3, %xmm2
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,3],xmm1[4,5,6,7]
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_one:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vpsrld $1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm0[0,1,2,3,4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [2863311531,0,2863311531,2454267027]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm4, %xmm2, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm3, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $3, %xmm1, %xmm2
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,3],xmm1[4,5,6,7]
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_one:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,0,2863311531,2454267027]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm0, %xmm3
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm4, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm3, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm0[1],xmm1[2,3]
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_one:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [2863311531,0,2863311531,2454267027]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm0, %xmm3
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm4 = xmm3[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm4, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm3, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrlvd {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm0[1],xmm1[2,3]
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 6, i32 1, i32 12, i32 14>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_comp(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_comp:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: pslld $2, %xmm1
|
|
; CHECK-SSE2-NEXT: paddd %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: pcmpeqd {{.*}}(%rip), %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_comp:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm1
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm2
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm2
|
|
; CHECK-SSE41-NEXT: psubd %xmm2, %xmm0
|
|
; CHECK-SSE41-NEXT: pcmpeqd {{.*}}(%rip), %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_comp:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm2[0,1],xmm1[2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_comp:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm2[0],xmm1[1],xmm2[2],xmm1[3]
|
|
; CHECK-AVX2-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm2 = [5,5,5,5]
|
|
; CHECK-AVX2-NEXT: vpmulld %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_comp:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpbroadcastd {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm2[0],xmm1[1],xmm2[2],xmm1[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip){1to4}, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 5, i32 5, i32 5, i32 5>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 1, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_both(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_both:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,3435973837]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [6,5,6,5]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm3, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm2, %xmm0
|
|
; CHECK-SSE2-NEXT: pcmpeqd {{.*}}(%rip), %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_both:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm1 = [2863311531,3435973837,2863311531,3435973837]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm3
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: pcmpeqd {{.*}}(%rip), %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_both:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [-9.255967385052751E+61,-9.255967385052751E+61]
|
|
; CHECK-AVX1-NEXT: # xmm1 = mem[0,0]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq {{.*}}(%rip), %xmm2, %xmm2
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_both:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [14757395262689946283,14757395262689946283]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_both:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [14757395262689946283,14757395262689946283]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd {{.*}}(%rip), %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 6, i32 5, i32 6, i32 5>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 1, i32 0, i32 1, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_div_undef(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE-LABEL: test_urem_div_undef:
|
|
; CHECK-SSE: # %bb.0:
|
|
; CHECK-SSE-NEXT: pxor %xmm0, %xmm0
|
|
; CHECK-SSE-NEXT: pcmpeqd %xmm0, %xmm0
|
|
; CHECK-SSE-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE-NEXT: retq
|
|
;
|
|
; CHECK-AVX-LABEL: test_urem_div_undef:
|
|
; CHECK-AVX: # %bb.0:
|
|
; CHECK-AVX-NEXT: vpxor %xmm0, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 5, i32 5, i32 undef, i32 5>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_comp_undef(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_comp_undef:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE2-NEXT: movdqa %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: pslld $2, %xmm1
|
|
; CHECK-SSE2-NEXT: paddd %xmm2, %xmm1
|
|
; CHECK-SSE2-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_comp_undef:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm1
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm2
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm2
|
|
; CHECK-SSE41-NEXT: psubd %xmm2, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_comp_undef:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm2[0,1],xmm1[2,3],xmm2[4,5],xmm1[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_comp_undef:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm2[0],xmm1[1],xmm2[2],xmm1[3]
|
|
; CHECK-AVX2-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm2 = [5,5,5,5]
|
|
; CHECK-AVX2-NEXT: vpmulld %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_comp_undef:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpbroadcastd {{.*#+}} xmm2 = [3435973837,3435973837,3435973837,3435973837]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm0, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm2[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm2[0],xmm1[1],xmm2[2],xmm1[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip){1to4}, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 5, i32 5, i32 5, i32 5>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 undef, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_both_undef(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE-LABEL: test_urem_both_undef:
|
|
; CHECK-SSE: # %bb.0:
|
|
; CHECK-SSE-NEXT: pxor %xmm0, %xmm0
|
|
; CHECK-SSE-NEXT: pcmpeqd %xmm0, %xmm0
|
|
; CHECK-SSE-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE-NEXT: retq
|
|
;
|
|
; CHECK-AVX-LABEL: test_urem_both_undef:
|
|
; CHECK-AVX: # %bb.0:
|
|
; CHECK-AVX-NEXT: vpxor %xmm0, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 5, i32 5, i32 undef, i32 5>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 undef, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|
|
|
|
define <4 x i32> @test_urem_div_even_odd(<4 x i32> %X) nounwind readnone {
|
|
; CHECK-SSE2-LABEL: test_urem_div_even_odd:
|
|
; CHECK-SSE2: # %bb.0:
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [3435973837,3435973837,2863311531,2863311531]
|
|
; CHECK-SSE2-NEXT: movdqa %xmm0, %xmm2
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm3
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm3[1,3,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psrld $2, %xmm2
|
|
; CHECK-SSE2-NEXT: movdqa {{.*#+}} xmm1 = [5,5,6,6]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm1, %xmm2
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE2-NEXT: pmuludq %xmm3, %xmm1
|
|
; CHECK-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
|
|
; CHECK-SSE2-NEXT: punpckldq {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
|
|
; CHECK-SSE2-NEXT: psubd %xmm2, %xmm0
|
|
; CHECK-SSE2-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE2-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE2-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE2-NEXT: retq
|
|
;
|
|
; CHECK-SSE41-LABEL: test_urem_div_even_odd:
|
|
; CHECK-SSE41: # %bb.0:
|
|
; CHECK-SSE41-NEXT: movdqa {{.*#+}} xmm1 = [3435973837,3435973837,2863311531,2863311531]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm2, %xmm3
|
|
; CHECK-SSE41-NEXT: pmuludq %xmm0, %xmm1
|
|
; CHECK-SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1],xmm3[2,3],xmm1[4,5],xmm3[6,7]
|
|
; CHECK-SSE41-NEXT: psrld $2, %xmm1
|
|
; CHECK-SSE41-NEXT: pmulld {{.*}}(%rip), %xmm1
|
|
; CHECK-SSE41-NEXT: psubd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: pxor %xmm1, %xmm1
|
|
; CHECK-SSE41-NEXT: pcmpeqd %xmm1, %xmm0
|
|
; CHECK-SSE41-NEXT: psrld $31, %xmm0
|
|
; CHECK-SSE41-NEXT: retq
|
|
;
|
|
; CHECK-AVX1-LABEL: test_urem_div_even_odd:
|
|
; CHECK-AVX1: # %bb.0:
|
|
; CHECK-AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [3435973837,3435973837,2863311531,2863311531]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX1-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
|
|
; CHECK-AVX1-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX1-NEXT: retq
|
|
;
|
|
; CHECK-AVX2-LABEL: test_urem_div_even_odd:
|
|
; CHECK-AVX2: # %bb.0:
|
|
; CHECK-AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [3435973837,3435973837,2863311531,2863311531]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX2-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX2-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX2-NEXT: retq
|
|
;
|
|
; CHECK-AVX512VL-LABEL: test_urem_div_even_odd:
|
|
; CHECK-AVX512VL: # %bb.0:
|
|
; CHECK-AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [3435973837,3435973837,2863311531,2863311531]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm2 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm3 = xmm0[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm2, %xmm3, %xmm2
|
|
; CHECK-AVX512VL-NEXT: vpmuludq %xmm1, %xmm0, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
|
|
; CHECK-AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
|
|
; CHECK-AVX512VL-NEXT: vpsrld $2, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpmulld {{.*}}(%rip), %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpsubd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpxor %xmm1, %xmm1, %xmm1
|
|
; CHECK-AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: vpsrld $31, %xmm0, %xmm0
|
|
; CHECK-AVX512VL-NEXT: retq
|
|
%urem = urem <4 x i32> %X, <i32 5, i32 5, i32 6, i32 6>
|
|
%cmp = icmp eq <4 x i32> %urem, <i32 0, i32 0, i32 0, i32 0>
|
|
%ret = zext <4 x i1> %cmp to <4 x i32>
|
|
ret <4 x i32> %ret
|
|
}
|