blob: bc9e6f761f4e477cbb86e79e0b201272a267ab0a [file] [log] [blame]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=x86-64 -mattr=+avx512f,+avx512dq,+avx512bw,+avx512vl | FileCheck %s --check-prefix=GENERIC
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=skx | FileCheck %s --check-prefix=SKX
; This test is an assembly of avx512 instructions to check their scheduling
define <8 x double> @addpd512(<8 x double> %y, <8 x double> %x) {
; GENERIC-LABEL: addpd512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vaddpd %zmm0, %zmm1, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: addpd512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vaddpd %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%add.i = fadd <8 x double> %x, %y
ret <8 x double> %add.i
}
define <8 x double> @addpd512fold(<8 x double> %y) {
; GENERIC-LABEL: addpd512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vaddpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: addpd512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vaddpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%add.i = fadd <8 x double> %y, <double 4.500000e+00, double 3.400000e+00, double 2.300000e+00, double 1.200000e+00, double 4.500000e+00, double 3.800000e+00, double 2.300000e+00, double 1.200000e+00>
ret <8 x double> %add.i
}
define <16 x float> @addps512(<16 x float> %y, <16 x float> %x) {
; GENERIC-LABEL: addps512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vaddps %zmm0, %zmm1, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: addps512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vaddps %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%add.i = fadd <16 x float> %x, %y
ret <16 x float> %add.i
}
define <16 x float> @addps512fold(<16 x float> %y) {
; GENERIC-LABEL: addps512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vaddps {{.*}}(%rip), %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: addps512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vaddps {{.*}}(%rip), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%add.i = fadd <16 x float> %y, <float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 4.500000e+00, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000>
ret <16 x float> %add.i
}
define <8 x double> @subpd512(<8 x double> %y, <8 x double> %x) {
; GENERIC-LABEL: subpd512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsubpd %zmm0, %zmm1, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: subpd512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsubpd %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%sub.i = fsub <8 x double> %x, %y
ret <8 x double> %sub.i
}
define <8 x double> @subpd512fold(<8 x double> %y, <8 x double>* %x) {
; GENERIC-LABEL: subpd512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsubpd (%rdi), %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: subpd512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsubpd (%rdi), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp2 = load <8 x double>, <8 x double>* %x, align 8
%sub.i = fsub <8 x double> %y, %tmp2
ret <8 x double> %sub.i
}
define <16 x float> @subps512(<16 x float> %y, <16 x float> %x) {
; GENERIC-LABEL: subps512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsubps %zmm0, %zmm1, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: subps512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsubps %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%sub.i = fsub <16 x float> %x, %y
ret <16 x float> %sub.i
}
define <16 x float> @subps512fold(<16 x float> %y, <16 x float>* %x) {
; GENERIC-LABEL: subps512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsubps (%rdi), %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: subps512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsubps (%rdi), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp2 = load <16 x float>, <16 x float>* %x, align 4
%sub.i = fsub <16 x float> %y, %tmp2
ret <16 x float> %sub.i
}
define <8 x i64> @imulq512(<8 x i64> %y, <8 x i64> %x) {
; GENERIC-LABEL: imulq512:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmullq %zmm0, %zmm1, %zmm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: imulq512:
; SKX: # %bb.0:
; SKX-NEXT: vpmullq %zmm0, %zmm1, %zmm0 # sched: [12:1.50]
; SKX-NEXT: retq # sched: [7:1.00]
%z = mul <8 x i64>%x, %y
ret <8 x i64>%z
}
define <4 x i64> @imulq256(<4 x i64> %y, <4 x i64> %x) {
; GENERIC-LABEL: imulq256:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmullq %ymm0, %ymm1, %ymm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: imulq256:
; SKX: # %bb.0:
; SKX-NEXT: vpmullq %ymm0, %ymm1, %ymm0 # sched: [12:1.50]
; SKX-NEXT: retq # sched: [7:1.00]
%z = mul <4 x i64>%x, %y
ret <4 x i64>%z
}
define <2 x i64> @imulq128(<2 x i64> %y, <2 x i64> %x) {
; GENERIC-LABEL: imulq128:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmullq %xmm0, %xmm1, %xmm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: imulq128:
; SKX: # %bb.0:
; SKX-NEXT: vpmullq %xmm0, %xmm1, %xmm0 # sched: [12:1.50]
; SKX-NEXT: retq # sched: [7:1.00]
%z = mul <2 x i64>%x, %y
ret <2 x i64>%z
}
define <8 x double> @mulpd512(<8 x double> %y, <8 x double> %x) {
; GENERIC-LABEL: mulpd512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmulpd %zmm0, %zmm1, %zmm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mulpd512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmulpd %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%mul.i = fmul <8 x double> %x, %y
ret <8 x double> %mul.i
}
define <8 x double> @mulpd512fold(<8 x double> %y) {
; GENERIC-LABEL: mulpd512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmulpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [12:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mulpd512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmulpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%mul.i = fmul <8 x double> %y, <double 4.500000e+00, double 3.400000e+00, double 2.300000e+00, double 1.200000e+00, double 4.500000e+00, double 3.400000e+00, double 2.300000e+00, double 1.200000e+00>
ret <8 x double> %mul.i
}
define <16 x float> @mulps512(<16 x float> %y, <16 x float> %x) {
; GENERIC-LABEL: mulps512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmulps %zmm0, %zmm1, %zmm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mulps512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmulps %zmm0, %zmm1, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%mul.i = fmul <16 x float> %x, %y
ret <16 x float> %mul.i
}
define <16 x float> @mulps512fold(<16 x float> %y) {
; GENERIC-LABEL: mulps512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmulps {{.*}}(%rip), %zmm0, %zmm0 # sched: [12:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: mulps512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmulps {{.*}}(%rip), %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%mul.i = fmul <16 x float> %y, <float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000>
ret <16 x float> %mul.i
}
define <8 x double> @divpd512(<8 x double> %y, <8 x double> %x) {
; GENERIC-LABEL: divpd512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vdivpd %zmm0, %zmm1, %zmm0 # sched: [45:44.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: divpd512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vdivpd %zmm0, %zmm1, %zmm0 # sched: [23:16.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%div.i = fdiv <8 x double> %x, %y
ret <8 x double> %div.i
}
define <8 x double> @divpd512fold(<8 x double> %y) {
; GENERIC-LABEL: divpd512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vdivpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [52:44.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: divpd512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vdivpd {{.*}}(%rip), %zmm0, %zmm0 # sched: [30:16.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%div.i = fdiv <8 x double> %y, <double 4.500000e+00, double 3.400000e+00, double 2.300000e+00, double 1.200000e+00, double 4.500000e+00, double 3.400000e+00, double 2.300000e+00, double 1.200000e+00>
ret <8 x double> %div.i
}
define <16 x float> @divps512(<16 x float> %y, <16 x float> %x) {
; GENERIC-LABEL: divps512:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vdivps %zmm0, %zmm1, %zmm0 # sched: [29:28.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: divps512:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vdivps %zmm0, %zmm1, %zmm0 # sched: [18:10.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%div.i = fdiv <16 x float> %x, %y
ret <16 x float> %div.i
}
define <16 x float> @divps512fold(<16 x float> %y) {
; GENERIC-LABEL: divps512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vdivps {{.*}}(%rip), %zmm0, %zmm0 # sched: [36:28.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: divps512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vdivps {{.*}}(%rip), %zmm0, %zmm0 # sched: [25:10.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%div.i = fdiv <16 x float> %y, <float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 4.500000e+00, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 0x400B333340000000, float 0x4002666660000000, float 0x3FF3333340000000, float 4.500000e+00, float 4.500000e+00, float 0x4002666660000000, float 0x3FF3333340000000>
ret <16 x float> %div.i
}
define <8 x i64> @vpaddq_test(<8 x i64> %i, <8 x i64> %j) nounwind readnone {
; GENERIC-LABEL: vpaddq_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddq %zmm1, %zmm0, %zmm0 # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddq_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddq %zmm1, %zmm0, %zmm0 # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%x = add <8 x i64> %i, %j
ret <8 x i64> %x
}
define <8 x i64> @vpaddq_fold_test(<8 x i64> %i, <8 x i64>* %j) nounwind {
; GENERIC-LABEL: vpaddq_fold_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddq (%rdi), %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddq_fold_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddq (%rdi), %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tmp = load <8 x i64>, <8 x i64>* %j, align 4
%x = add <8 x i64> %i, %tmp
ret <8 x i64> %x
}
define <8 x i64> @vpaddq_broadcast_test(<8 x i64> %i) nounwind {
; GENERIC-LABEL: vpaddq_broadcast_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddq {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddq_broadcast_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddq {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%x = add <8 x i64> %i, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
ret <8 x i64> %x
}
define <8 x i64> @vpaddq_broadcast2_test(<8 x i64> %i, i64* %j) nounwind {
; GENERIC-LABEL: vpaddq_broadcast2_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddq (%rdi){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddq_broadcast2_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddq (%rdi){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tmp = load i64, i64* %j
%j.0 = insertelement <8 x i64> undef, i64 %tmp, i32 0
%j.1 = insertelement <8 x i64> %j.0, i64 %tmp, i32 1
%j.2 = insertelement <8 x i64> %j.1, i64 %tmp, i32 2
%j.3 = insertelement <8 x i64> %j.2, i64 %tmp, i32 3
%j.4 = insertelement <8 x i64> %j.3, i64 %tmp, i32 4
%j.5 = insertelement <8 x i64> %j.4, i64 %tmp, i32 5
%j.6 = insertelement <8 x i64> %j.5, i64 %tmp, i32 6
%j.7 = insertelement <8 x i64> %j.6, i64 %tmp, i32 7
%x = add <8 x i64> %i, %j.7
ret <8 x i64> %x
}
define <16 x i32> @vpaddd_test(<16 x i32> %i, <16 x i32> %j) nounwind readnone {
; GENERIC-LABEL: vpaddd_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddd %zmm1, %zmm0, %zmm0 # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddd %zmm1, %zmm0, %zmm0 # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%x = add <16 x i32> %i, %j
ret <16 x i32> %x
}
define <16 x i32> @vpaddd_fold_test(<16 x i32> %i, <16 x i32>* %j) nounwind {
; GENERIC-LABEL: vpaddd_fold_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddd (%rdi), %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_fold_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddd (%rdi), %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tmp = load <16 x i32>, <16 x i32>* %j, align 4
%x = add <16 x i32> %i, %tmp
ret <16 x i32> %x
}
define <16 x i32> @vpaddd_broadcast_test(<16 x i32> %i) nounwind {
; GENERIC-LABEL: vpaddd_broadcast_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_broadcast_test:
; SKX: # %bb.0:
; SKX-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%x = add <16 x i32> %i, <i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3>
ret <16 x i32> %x
}
define <16 x i32> @vpaddd_mask_test(<16 x i32> %i, <16 x i32> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_mask_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd %zmm1, %zmm0, %zmm0 {%k1} # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_mask_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd %zmm1, %zmm0, %zmm0 {%k1} # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = add <16 x i32> %i, %j
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %i
ret <16 x i32> %r
}
define <16 x i32> @vpaddd_maskz_test(<16 x i32> %i, <16 x i32> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_maskz_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd %zmm1, %zmm0, %zmm0 {%k1} {z} # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_maskz_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd %zmm1, %zmm0, %zmm0 {%k1} {z} # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = add <16 x i32> %i, %j
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> zeroinitializer
ret <16 x i32> %r
}
define <16 x i32> @vpaddd_mask_fold_test(<16 x i32> %i, <16 x i32>* %j.ptr, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_mask_fold_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd (%rdi), %zmm0, %zmm0 {%k1} # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_mask_fold_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd (%rdi), %zmm0, %zmm0 {%k1} # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%j = load <16 x i32>, <16 x i32>* %j.ptr
%x = add <16 x i32> %i, %j
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %i
ret <16 x i32> %r
}
define <16 x i32> @vpaddd_mask_broadcast_test(<16 x i32> %i, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_mask_broadcast_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 {%k1} # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_mask_broadcast_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 {%k1} # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = add <16 x i32> %i, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> %i
ret <16 x i32> %r
}
define <16 x i32> @vpaddd_maskz_fold_test(<16 x i32> %i, <16 x i32>* %j.ptr, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_maskz_fold_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd (%rdi), %zmm0, %zmm0 {%k1} {z} # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_maskz_fold_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd (%rdi), %zmm0, %zmm0 {%k1} {z} # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%j = load <16 x i32>, <16 x i32>* %j.ptr
%x = add <16 x i32> %i, %j
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> zeroinitializer
ret <16 x i32> %r
}
define <16 x i32> @vpaddd_maskz_broadcast_test(<16 x i32> %i, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: vpaddd_maskz_broadcast_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 {%k1} {z} # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpaddd_maskz_broadcast_test:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vpaddd {{.*}}(%rip){1to16}, %zmm0, %zmm0 {%k1} {z} # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = add <16 x i32> %i, <i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5, i32 5>
%r = select <16 x i1> %mask, <16 x i32> %x, <16 x i32> zeroinitializer
ret <16 x i32> %r
}
define <8 x i64> @vpsubq_test(<8 x i64> %i, <8 x i64> %j) nounwind readnone {
; GENERIC-LABEL: vpsubq_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpsubq %zmm1, %zmm0, %zmm0 # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpsubq_test:
; SKX: # %bb.0:
; SKX-NEXT: vpsubq %zmm1, %zmm0, %zmm0 # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%x = sub <8 x i64> %i, %j
ret <8 x i64> %x
}
define <16 x i32> @vpsubd_test(<16 x i32> %i, <16 x i32> %j) nounwind readnone {
; GENERIC-LABEL: vpsubd_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpsubd %zmm1, %zmm0, %zmm0 # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpsubd_test:
; SKX: # %bb.0:
; SKX-NEXT: vpsubd %zmm1, %zmm0, %zmm0 # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%x = sub <16 x i32> %i, %j
ret <16 x i32> %x
}
define <16 x i32> @vpmulld_test(<16 x i32> %i, <16 x i32> %j) {
; GENERIC-LABEL: vpmulld_test:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmulld %zmm1, %zmm0, %zmm0 # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: vpmulld_test:
; SKX: # %bb.0:
; SKX-NEXT: vpmulld %zmm1, %zmm0, %zmm0 # sched: [10:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%x = mul <16 x i32> %i, %j
ret <16 x i32> %x
}
declare float @sqrtf(float) readnone
define float @sqrtA(float %a) nounwind uwtable readnone ssp {
; GENERIC-LABEL: sqrtA:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsqrtss %xmm0, %xmm0, %xmm0 # sched: [14:14.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sqrtA:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsqrtss %xmm0, %xmm0, %xmm0 # sched: [12:3.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%conv1 = tail call float @sqrtf(float %a) nounwind readnone
ret float %conv1
}
declare double @sqrt(double) readnone
define double @sqrtB(double %a) nounwind uwtable readnone ssp {
; GENERIC-LABEL: sqrtB:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 # sched: [21:21.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sqrtB:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vsqrtsd %xmm0, %xmm0, %xmm0 # sched: [18:6.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%call = tail call double @sqrt(double %a) nounwind readnone
ret double %call
}
declare float @llvm.sqrt.f32(float)
define float @sqrtC(float %a) nounwind {
; GENERIC-LABEL: sqrtC:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vsqrtss %xmm0, %xmm0, %xmm0 # sched: [14:14.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sqrtC:
; SKX: # %bb.0:
; SKX-NEXT: vsqrtss %xmm0, %xmm0, %xmm0 # sched: [12:3.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = call float @llvm.sqrt.f32(float %a)
ret float %b
}
declare <16 x float> @llvm.sqrt.v16f32(<16 x float>)
define <16 x float> @sqrtD(<16 x float> %a) nounwind {
; GENERIC-LABEL: sqrtD:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vsqrtps %zmm0, %zmm0 # sched: [29:28.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sqrtD:
; SKX: # %bb.0:
; SKX-NEXT: vsqrtps %zmm0, %zmm0 # sched: [20:12.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = call <16 x float> @llvm.sqrt.v16f32(<16 x float> %a)
ret <16 x float> %b
}
declare <8 x double> @llvm.sqrt.v8f64(<8 x double>)
define <8 x double> @sqrtE(<8 x double> %a) nounwind {
; GENERIC-LABEL: sqrtE:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vsqrtpd %zmm0, %zmm0 # sched: [45:44.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sqrtE:
; SKX: # %bb.0:
; SKX-NEXT: vsqrtpd %zmm0, %zmm0 # sched: [32:24.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = call <8 x double> @llvm.sqrt.v8f64(<8 x double> %a)
ret <8 x double> %b
}
define <16 x float> @fadd_broadcast(<16 x float> %a) nounwind {
; GENERIC-LABEL: fadd_broadcast:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: fadd_broadcast:
; SKX: # %bb.0:
; SKX-NEXT: vaddps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fadd <16 x float> %a, <float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000>
ret <16 x float> %b
}
define <8 x i64> @addq_broadcast(<8 x i64> %a) nounwind {
; GENERIC-LABEL: addq_broadcast:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpaddq {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: addq_broadcast:
; SKX: # %bb.0:
; SKX-NEXT: vpaddq {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = add <8 x i64> %a, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
ret <8 x i64> %b
}
define <8 x i64> @orq_broadcast(<8 x i64> %a) nounwind {
; GENERIC-LABEL: orq_broadcast:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vorpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: orq_broadcast:
; SKX: # %bb.0:
; SKX-NEXT: vorpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = or <8 x i64> %a, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
ret <8 x i64> %b
}
define <16 x i32> @andd512fold(<16 x i32> %y, <16 x i32>* %x) {
; GENERIC-LABEL: andd512fold:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vandps (%rdi), %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: andd512fold:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vandps (%rdi), %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%a = load <16 x i32>, <16 x i32>* %x, align 4
%b = and <16 x i32> %y, %a
ret <16 x i32> %b
}
define <8 x i64> @andqbrst(<8 x i64> %p1, i64* %ap) {
; GENERIC-LABEL: andqbrst:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vandpd (%rdi){1to8}, %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: andqbrst:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vandpd (%rdi){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%a = load i64, i64* %ap, align 8
%b = insertelement <8 x i64> undef, i64 %a, i32 0
%c = shufflevector <8 x i64> %b, <8 x i64> undef, <8 x i32> zeroinitializer
%d = and <8 x i64> %p1, %c
ret <8 x i64>%d
}
define <16 x float> @test_mask_vaddps(<16 x float> %dst, <16 x float> %i,
; GENERIC-LABEL: test_mask_vaddps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddps %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vaddps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddps %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
<16 x float> %j, <16 x i32> %mask1)
nounwind readnone {
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = fadd <16 x float> %i, %j
%r = select <16 x i1> %mask, <16 x float> %x, <16 x float> %dst
ret <16 x float> %r
}
define <16 x float> @test_mask_vmulps(<16 x float> %dst, <16 x float> %i, <16 x float> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vmulps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vmulps %zmm2, %zmm1, %zmm0 {%k1} # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vmulps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vmulps %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = fmul <16 x float> %i, %j
%r = select <16 x i1> %mask, <16 x float> %x, <16 x float> %dst
ret <16 x float> %r
}
define <16 x float> @test_mask_vminps(<16 x float> %dst, <16 x float> %i, <16 x float> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vminps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vminps %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vminps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vminps %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%cmp_res = fcmp olt <16 x float> %i, %j
%min = select <16 x i1> %cmp_res, <16 x float> %i, <16 x float> %j
%r = select <16 x i1> %mask, <16 x float> %min, <16 x float> %dst
ret <16 x float> %r
}
define <8 x double> @test_mask_vminpd(<8 x double> %dst, <8 x double> %i, <8 x double> %j, <8 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vminpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %ymm3, %ymm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vminpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vminpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %ymm3, %ymm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vminpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i32> %mask1, zeroinitializer
%cmp_res = fcmp olt <8 x double> %i, %j
%min = select <8 x i1> %cmp_res, <8 x double> %i, <8 x double> %j
%r = select <8 x i1> %mask, <8 x double> %min, <8 x double> %dst
ret <8 x double> %r
}
define <16 x float> @test_mask_vmaxps(<16 x float> %dst, <16 x float> %i, <16 x float> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vmaxps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vmaxps %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vmaxps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vmaxps %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%cmp_res = fcmp ogt <16 x float> %i, %j
%max = select <16 x i1> %cmp_res, <16 x float> %i, <16 x float> %j
%r = select <16 x i1> %mask, <16 x float> %max, <16 x float> %dst
ret <16 x float> %r
}
define <8 x double> @test_mask_vmaxpd(<8 x double> %dst, <8 x double> %i, <8 x double> %j, <8 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vmaxpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %ymm3, %ymm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vmaxpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vmaxpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %ymm3, %ymm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vmaxpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i32> %mask1, zeroinitializer
%cmp_res = fcmp ogt <8 x double> %i, %j
%max = select <8 x i1> %cmp_res, <8 x double> %i, <8 x double> %j
%r = select <8 x i1> %mask, <8 x double> %max, <8 x double> %dst
ret <8 x double> %r
}
define <16 x float> @test_mask_vsubps(<16 x float> %dst, <16 x float> %i, <16 x float> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vsubps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vsubps %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vsubps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vsubps %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = fsub <16 x float> %i, %j
%r = select <16 x i1> %mask, <16 x float> %x, <16 x float> %dst
ret <16 x float> %r
}
define <16 x float> @test_mask_vdivps(<16 x float> %dst, <16 x float> %i, <16 x float> %j, <16 x i32> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vdivps:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vdivps %zmm2, %zmm1, %zmm0 {%k1} # sched: [29:28.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vdivps:
; SKX: # %bb.0:
; SKX-NEXT: vptestmd %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vdivps %zmm2, %zmm1, %zmm0 {%k1} # sched: [18:10.00]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <16 x i32> %mask1, zeroinitializer
%x = fdiv <16 x float> %i, %j
%r = select <16 x i1> %mask, <16 x float> %x, <16 x float> %dst
ret <16 x float> %r
}
define <8 x double> @test_mask_vaddpd(<8 x double> %dst, <8 x double> %i, <8 x double> %j, <8 x i64> %mask1) nounwind readnone {
; GENERIC-LABEL: test_mask_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm3, %zmm3, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm3, %zmm3, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd %zmm2, %zmm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%x = fadd <8 x double> %i, %j
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> %dst
ret <8 x double> %r
}
define <8 x double> @test_maskz_vaddpd(<8 x double> %i, <8 x double> %j, <8 x i64> %mask1) nounwind readnone {
; GENERIC-LABEL: test_maskz_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd %zmm1, %zmm0, %zmm0 {%k1} {z} # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_maskz_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd %zmm1, %zmm0, %zmm0 {%k1} {z} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%x = fadd <8 x double> %i, %j
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> zeroinitializer
ret <8 x double> %r
}
define <8 x double> @test_mask_fold_vaddpd(<8 x double> %dst, <8 x double> %i, <8 x double>* %j, <8 x i64> %mask1) nounwind {
; GENERIC-LABEL: test_mask_fold_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi), %zmm1, %zmm0 {%k1} # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_fold_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi), %zmm1, %zmm0 {%k1} # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%tmp = load <8 x double>, <8 x double>* %j, align 8
%x = fadd <8 x double> %i, %tmp
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> %dst
ret <8 x double> %r
}
define <8 x double> @test_maskz_fold_vaddpd(<8 x double> %i, <8 x double>* %j, <8 x i64> %mask1) nounwind {
; GENERIC-LABEL: test_maskz_fold_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi), %zmm0, %zmm0 {%k1} {z} # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_maskz_fold_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi), %zmm0, %zmm0 {%k1} {z} # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%tmp = load <8 x double>, <8 x double>* %j, align 8
%x = fadd <8 x double> %i, %tmp
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> zeroinitializer
ret <8 x double> %r
}
define <8 x double> @test_broadcast_vaddpd(<8 x double> %i, double* %j) nounwind {
; GENERIC-LABEL: test_broadcast_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vaddpd (%rdi){1to8}, %zmm0, %zmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_broadcast_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vaddpd (%rdi){1to8}, %zmm0, %zmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tmp = load double, double* %j
%b = insertelement <8 x double> undef, double %tmp, i32 0
%c = shufflevector <8 x double> %b, <8 x double> undef,
<8 x i32> zeroinitializer
%x = fadd <8 x double> %c, %i
ret <8 x double> %x
}
define <8 x double> @test_mask_broadcast_vaddpd(<8 x double> %dst, <8 x double> %i, double* %j, <8 x i64> %mask1) nounwind {
; GENERIC-LABEL: test_mask_broadcast_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vmovapd %zmm1, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm0 {%k1} # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_mask_broadcast_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vmovapd %zmm1, %zmm0 # sched: [1:0.33]
; SKX-NEXT: vptestmq %zmm2, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi){1to8}, %zmm1, %zmm0 {%k1} # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%tmp = load double, double* %j
%b = insertelement <8 x double> undef, double %tmp, i32 0
%c = shufflevector <8 x double> %b, <8 x double> undef,
<8 x i32> zeroinitializer
%x = fadd <8 x double> %c, %i
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> %i
ret <8 x double> %r
}
define <8 x double> @test_maskz_broadcast_vaddpd(<8 x double> %i, double* %j,
; GENERIC-LABEL: test_maskz_broadcast_vaddpd:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vptestmq %zmm1, %zmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vaddpd (%rdi){1to8}, %zmm0, %zmm0 {%k1} {z} # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_maskz_broadcast_vaddpd:
; SKX: # %bb.0:
; SKX-NEXT: vptestmq %zmm1, %zmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vaddpd (%rdi){1to8}, %zmm0, %zmm0 {%k1} {z} # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
<8 x i64> %mask1) nounwind {
%mask = icmp ne <8 x i64> %mask1, zeroinitializer
%tmp = load double, double* %j
%b = insertelement <8 x double> undef, double %tmp, i32 0
%c = shufflevector <8 x double> %b, <8 x double> undef,
<8 x i32> zeroinitializer
%x = fadd <8 x double> %c, %i
%r = select <8 x i1> %mask, <8 x double> %x, <8 x double> zeroinitializer
ret <8 x double> %r
}
define <16 x float> @test_fxor(<16 x float> %a) {
; GENERIC-LABEL: test_fxor:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_fxor:
; SKX: # %bb.0:
; SKX-NEXT: vxorps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fsub <16 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %a
ret <16 x float>%res
}
define <8 x float> @test_fxor_8f32(<8 x float> %a) {
; GENERIC-LABEL: test_fxor_8f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorps {{.*}}(%rip){1to8}, %ymm0, %ymm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test_fxor_8f32:
; SKX: # %bb.0:
; SKX-NEXT: vxorps {{.*}}(%rip){1to8}, %ymm0, %ymm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %a
ret <8 x float>%res
}
define <8 x double> @fabs_v8f64(<8 x double> %p)
; GENERIC-LABEL: fabs_v8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vandpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: fabs_v8f64:
; SKX: # %bb.0:
; SKX-NEXT: vandpd {{.*}}(%rip){1to8}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
{
%t = call <8 x double> @llvm.fabs.v8f64(<8 x double> %p)
ret <8 x double> %t
}
declare <8 x double> @llvm.fabs.v8f64(<8 x double> %p)
define <16 x float> @fabs_v16f32(<16 x float> %p)
; GENERIC-LABEL: fabs_v16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vandps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: fabs_v16f32:
; SKX: # %bb.0:
; SKX-NEXT: vandps {{.*}}(%rip){1to16}, %zmm0, %zmm0 # sched: [8:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
{
%t = call <16 x float> @llvm.fabs.v16f32(<16 x float> %p)
ret <16 x float> %t
}
declare <16 x float> @llvm.fabs.v16f32(<16 x float> %p)
define double @test1(double %a, double %b) nounwind {
; GENERIC-LABEL: test1:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vucomisd %xmm1, %xmm0 # sched: [2:1.00]
; GENERIC-NEXT: jne .LBB64_1 # sched: [1:1.00]
; GENERIC-NEXT: jnp .LBB64_2 # sched: [1:1.00]
; GENERIC-NEXT: .LBB64_1: # %l1
; GENERIC-NEXT: vsubsd %xmm1, %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
; GENERIC-NEXT: .LBB64_2: # %l2
; GENERIC-NEXT: vaddsd %xmm1, %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test1:
; SKX: # %bb.0:
; SKX-NEXT: vucomisd %xmm1, %xmm0 # sched: [2:1.00]
; SKX-NEXT: jne .LBB64_1 # sched: [1:0.50]
; SKX-NEXT: jnp .LBB64_2 # sched: [1:0.50]
; SKX-NEXT: .LBB64_1: # %l1
; SKX-NEXT: vsubsd %xmm1, %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
; SKX-NEXT: .LBB64_2: # %l2
; SKX-NEXT: vaddsd %xmm1, %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tobool = fcmp une double %a, %b
br i1 %tobool, label %l1, label %l2
l1:
%c = fsub double %a, %b
ret double %c
l2:
%c1 = fadd double %a, %b
ret double %c1
}
define float @test2(float %a, float %b) nounwind {
; GENERIC-LABEL: test2:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vucomiss %xmm0, %xmm1 # sched: [2:1.00]
; GENERIC-NEXT: jbe .LBB65_2 # sched: [1:1.00]
; GENERIC-NEXT: # %bb.1: # %l1
; GENERIC-NEXT: vsubss %xmm1, %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
; GENERIC-NEXT: .LBB65_2: # %l2
; GENERIC-NEXT: vaddss %xmm1, %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test2:
; SKX: # %bb.0:
; SKX-NEXT: vucomiss %xmm0, %xmm1 # sched: [2:1.00]
; SKX-NEXT: jbe .LBB65_2 # sched: [1:0.50]
; SKX-NEXT: # %bb.1: # %l1
; SKX-NEXT: vsubss %xmm1, %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
; SKX-NEXT: .LBB65_2: # %l2
; SKX-NEXT: vaddss %xmm1, %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tobool = fcmp olt float %a, %b
br i1 %tobool, label %l1, label %l2
l1:
%c = fsub float %a, %b
ret float %c
l2:
%c1 = fadd float %a, %b
ret float %c1
}
define i32 @test3(float %a, float %b) {
; GENERIC-LABEL: test3:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcmpeqss %xmm1, %xmm0, %k0 # sched: [3:1.00]
; GENERIC-NEXT: kmovw %k0, %eax # sched: [1:0.33]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test3:
; SKX: # %bb.0:
; SKX-NEXT: vcmpeqss %xmm1, %xmm0, %k0 # sched: [3:1.00]
; SKX-NEXT: kmovw %k0, %eax # sched: [3:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%cmp10.i = fcmp oeq float %a, %b
%conv11.i = zext i1 %cmp10.i to i32
ret i32 %conv11.i
}
define float @test5(float %p) #0 {
; GENERIC-LABEL: test5:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vucomiss %xmm1, %xmm0 # sched: [2:1.00]
; GENERIC-NEXT: jne .LBB67_1 # sched: [1:1.00]
; GENERIC-NEXT: jp .LBB67_1 # sched: [1:1.00]
; GENERIC-NEXT: # %bb.2: # %return
; GENERIC-NEXT: retq # sched: [1:1.00]
; GENERIC-NEXT: .LBB67_1: # %if.end
; GENERIC-NEXT: vcmpltss %xmm0, %xmm1, %k1 # sched: [3:1.00]
; GENERIC-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero sched: [6:0.50]
; GENERIC-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero sched: [6:0.50]
; GENERIC-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1} # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test5:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vucomiss %xmm1, %xmm0 # sched: [2:1.00]
; SKX-NEXT: jne .LBB67_1 # sched: [1:0.50]
; SKX-NEXT: jp .LBB67_1 # sched: [1:0.50]
; SKX-NEXT: # %bb.2: # %return
; SKX-NEXT: retq # sched: [7:1.00]
; SKX-NEXT: .LBB67_1: # %if.end
; SKX-NEXT: vcmpltss %xmm0, %xmm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero sched: [5:0.50]
; SKX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero sched: [5:0.50]
; SKX-NEXT: vmovss %xmm1, %xmm0, %xmm0 {%k1} # sched: [1:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%cmp = fcmp oeq float %p, 0.000000e+00
br i1 %cmp, label %return, label %if.end
if.end: ; preds = %entry
%cmp1 = fcmp ogt float %p, 0.000000e+00
%cond = select i1 %cmp1, float 1.000000e+00, float -1.000000e+00
br label %return
return: ; preds = %if.end, %entry
%retval.0 = phi float [ %cond, %if.end ], [ %p, %entry ]
ret float %retval.0
}
define i32 @test6(i32 %a, i32 %b) {
; GENERIC-LABEL: test6:
; GENERIC: # %bb.0:
; GENERIC-NEXT: xorl %eax, %eax # sched: [0:0.25]
; GENERIC-NEXT: cmpl %esi, %edi # sched: [1:0.33]
; GENERIC-NEXT: sete %al # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test6:
; SKX: # %bb.0:
; SKX-NEXT: xorl %eax, %eax # sched: [1:0.25]
; SKX-NEXT: cmpl %esi, %edi # sched: [1:0.25]
; SKX-NEXT: sete %al # sched: [1:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%cmp = icmp eq i32 %a, %b
%res = zext i1 %cmp to i32
ret i32 %res
}
define i32 @test7(double %x, double %y) #2 {
; GENERIC-LABEL: test7:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: xorl %eax, %eax # sched: [0:0.25]
; GENERIC-NEXT: vucomisd %xmm1, %xmm0 # sched: [2:1.00]
; GENERIC-NEXT: setne %al # sched: [1:0.50]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test7:
; SKX: # %bb.0: # %entry
; SKX-NEXT: xorl %eax, %eax # sched: [1:0.25]
; SKX-NEXT: vucomisd %xmm1, %xmm0 # sched: [2:1.00]
; SKX-NEXT: setne %al # sched: [1:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%0 = fcmp one double %x, %y
%or = zext i1 %0 to i32
ret i32 %or
}
define i32 @test8(i32 %a1, i32 %a2, i32 %a3) {
; GENERIC-LABEL: test8:
; GENERIC: # %bb.0:
; GENERIC-NEXT: xorl $-2147483648, %esi # imm = 0x80000000
; GENERIC-NEXT: # sched: [1:0.33]
; GENERIC-NEXT: testl %edx, %edx # sched: [1:0.33]
; GENERIC-NEXT: movl $1, %eax # sched: [1:0.33]
; GENERIC-NEXT: cmovel %eax, %edx # sched: [2:0.67]
; GENERIC-NEXT: notl %edi # sched: [1:0.33]
; GENERIC-NEXT: orl %edi, %esi # sched: [1:0.33]
; GENERIC-NEXT: cmovnel %edx, %eax # sched: [2:0.67]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test8:
; SKX: # %bb.0:
; SKX-NEXT: notl %edi # sched: [1:0.25]
; SKX-NEXT: xorl $-2147483648, %esi # imm = 0x80000000
; SKX-NEXT: # sched: [1:0.25]
; SKX-NEXT: testl %edx, %edx # sched: [1:0.25]
; SKX-NEXT: movl $1, %eax # sched: [1:0.25]
; SKX-NEXT: cmovel %eax, %edx # sched: [1:0.50]
; SKX-NEXT: orl %edi, %esi # sched: [1:0.25]
; SKX-NEXT: cmovnel %edx, %eax # sched: [1:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%tmp1 = icmp eq i32 %a1, -1
%tmp2 = icmp eq i32 %a2, -2147483648
%tmp3 = and i1 %tmp1, %tmp2
%tmp4 = icmp eq i32 %a3, 0
%tmp5 = or i1 %tmp3, %tmp4
%res = select i1 %tmp5, i32 1, i32 %a3
ret i32 %res
}
define i32 @test9(i64 %a) {
; GENERIC-LABEL: test9:
; GENERIC: # %bb.0:
; GENERIC-NEXT: testb $1, %dil # sched: [1:0.33]
; GENERIC-NEXT: jne .LBB71_2 # sched: [1:1.00]
; GENERIC-NEXT: # %bb.1: # %A
; GENERIC-NEXT: movl $6, %eax # sched: [1:0.33]
; GENERIC-NEXT: retq # sched: [1:1.00]
; GENERIC-NEXT: .LBB71_2: # %B
; GENERIC-NEXT: movl $7, %eax # sched: [1:0.33]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test9:
; SKX: # %bb.0:
; SKX-NEXT: testb $1, %dil # sched: [1:0.25]
; SKX-NEXT: jne .LBB71_2 # sched: [1:0.50]
; SKX-NEXT: # %bb.1: # %A
; SKX-NEXT: movl $6, %eax # sched: [1:0.25]
; SKX-NEXT: retq # sched: [7:1.00]
; SKX-NEXT: .LBB71_2: # %B
; SKX-NEXT: movl $7, %eax # sched: [1:0.25]
; SKX-NEXT: retq # sched: [7:1.00]
%b = and i64 %a, 1
%cmp10.i = icmp eq i64 %b, 0
br i1 %cmp10.i, label %A, label %B
A:
ret i32 6
B:
ret i32 7
}
define i32 @test10(i64 %b, i64 %c, i1 %d) {
; GENERIC-LABEL: test10:
; GENERIC: # %bb.0:
; GENERIC-NEXT: movl %edx, %eax # sched: [1:0.33]
; GENERIC-NEXT: andb $1, %al # sched: [1:0.33]
; GENERIC-NEXT: cmpq %rsi, %rdi # sched: [1:0.33]
; GENERIC-NEXT: sete %cl # sched: [1:0.50]
; GENERIC-NEXT: orb %dl, %cl # sched: [1:0.33]
; GENERIC-NEXT: andb $1, %cl # sched: [1:0.33]
; GENERIC-NEXT: cmpb %cl, %al # sched: [1:0.33]
; GENERIC-NEXT: je .LBB72_1 # sched: [1:1.00]
; GENERIC-NEXT: # %bb.2: # %if.end.i
; GENERIC-NEXT: movl $6, %eax # sched: [1:0.33]
; GENERIC-NEXT: retq # sched: [1:1.00]
; GENERIC-NEXT: .LBB72_1: # %if.then.i
; GENERIC-NEXT: movl $5, %eax # sched: [1:0.33]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: test10:
; SKX: # %bb.0:
; SKX-NEXT: movl %edx, %eax # sched: [1:0.25]
; SKX-NEXT: andb $1, %al # sched: [1:0.25]
; SKX-NEXT: cmpq %rsi, %rdi # sched: [1:0.25]
; SKX-NEXT: sete %cl # sched: [1:0.50]
; SKX-NEXT: orb %dl, %cl # sched: [1:0.25]
; SKX-NEXT: andb $1, %cl # sched: [1:0.25]
; SKX-NEXT: cmpb %cl, %al # sched: [1:0.25]
; SKX-NEXT: je .LBB72_1 # sched: [1:0.50]
; SKX-NEXT: # %bb.2: # %if.end.i
; SKX-NEXT: movl $6, %eax # sched: [1:0.25]
; SKX-NEXT: retq # sched: [7:1.00]
; SKX-NEXT: .LBB72_1: # %if.then.i
; SKX-NEXT: movl $5, %eax # sched: [1:0.25]
; SKX-NEXT: retq # sched: [7:1.00]
%cmp8.i = icmp eq i64 %b, %c
%or1 = or i1 %d, %cmp8.i
%xor1 = xor i1 %d, %or1
br i1 %xor1, label %if.end.i, label %if.then.i
if.then.i:
ret i32 5
if.end.i:
ret i32 6
}
define <16 x float> @sitof32(<16 x i32> %a) nounwind {
; GENERIC-LABEL: sitof32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sitof32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <16 x i32> %a to <16 x float>
ret <16 x float> %b
}
define <8 x double> @sltof864(<8 x i64> %a) {
; GENERIC-LABEL: sltof864:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sltof864:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <8 x i64> %a to <8 x double>
ret <8 x double> %b
}
define <4 x double> @slto4f64(<4 x i64> %a) {
; GENERIC-LABEL: slto4f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2pd %ymm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto4f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2pd %ymm0, %ymm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <4 x i64> %a to <4 x double>
ret <4 x double> %b
}
define <2 x double> @slto2f64(<2 x i64> %a) {
; GENERIC-LABEL: slto2f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2pd %xmm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto2f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2pd %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <2 x i64> %a to <2 x double>
ret <2 x double> %b
}
define <2 x float> @sltof2f32(<2 x i64> %a) {
; GENERIC-LABEL: sltof2f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2ps %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sltof2f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2ps %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <2 x i64> %a to <2 x float>
ret <2 x float>%b
}
define <4 x float> @slto4f32_mem(<4 x i64>* %a) {
; GENERIC-LABEL: slto4f32_mem:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2psy (%rdi), %xmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto4f32_mem:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2psy (%rdi), %xmm0 # sched: [11:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%a1 = load <4 x i64>, <4 x i64>* %a, align 8
%b = sitofp <4 x i64> %a1 to <4 x float>
ret <4 x float>%b
}
define <4 x i64> @f64to4sl(<4 x double> %a) {
; GENERIC-LABEL: f64to4sl:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2qq %ymm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to4sl:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2qq %ymm0, %ymm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi <4 x double> %a to <4 x i64>
ret <4 x i64> %b
}
define <4 x i64> @f32to4sl(<4 x float> %a) {
; GENERIC-LABEL: f32to4sl:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2qq %xmm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to4sl:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2qq %xmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi <4 x float> %a to <4 x i64>
ret <4 x i64> %b
}
define <4 x float> @slto4f32(<4 x i64> %a) {
; GENERIC-LABEL: slto4f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2ps %ymm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto4f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2ps %ymm0, %xmm0 # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <4 x i64> %a to <4 x float>
ret <4 x float> %b
}
define <4 x float> @ulto4f32(<4 x i64> %a) {
; GENERIC-LABEL: ulto4f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtuqq2ps %ymm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ulto4f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtuqq2ps %ymm0, %xmm0 # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <4 x i64> %a to <4 x float>
ret <4 x float> %b
}
define <8 x double> @ulto8f64(<8 x i64> %a) {
; GENERIC-LABEL: ulto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtuqq2pd %zmm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ulto8f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtuqq2pd %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <8 x i64> %a to <8 x double>
ret <8 x double> %b
}
define <16 x double> @ulto16f64(<16 x i64> %a) {
; GENERIC-LABEL: ulto16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtuqq2pd %zmm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: vcvtuqq2pd %zmm1, %zmm1 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ulto16f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtuqq2pd %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: vcvtuqq2pd %zmm1, %zmm1 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <16 x i64> %a to <16 x double>
ret <16 x double> %b
}
define <16 x i32> @f64to16si(<16 x float> %a) nounwind {
; GENERIC-LABEL: f64to16si:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to16si:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi <16 x float> %a to <16 x i32>
ret <16 x i32> %b
}
define <16 x i32> @f32to16ui(<16 x float> %a) nounwind {
; GENERIC-LABEL: f32to16ui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2udq %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to16ui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2udq %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui <16 x float> %a to <16 x i32>
ret <16 x i32> %b
}
define <16 x i8> @f32to16uc(<16 x float> %f) {
; GENERIC-LABEL: f32to16uc:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: vpmovdb %zmm0, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to16uc:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: vpmovdb %zmm0, %xmm0 # sched: [4:2.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fptoui <16 x float> %f to <16 x i8>
ret <16 x i8> %res
}
define <16 x i16> @f32to16us(<16 x float> %f) {
; GENERIC-LABEL: f32to16us:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: vpmovdw %zmm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to16us:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2dq %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: vpmovdw %zmm0, %ymm0 # sched: [4:2.00]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fptoui <16 x float> %f to <16 x i16>
ret <16 x i16> %res
}
define <8 x i32> @f32to8ui(<8 x float> %a) nounwind {
; GENERIC-LABEL: f32to8ui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2udq %ymm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to8ui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2udq %ymm0, %ymm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui <8 x float> %a to <8 x i32>
ret <8 x i32> %b
}
define <4 x i32> @f32to4ui(<4 x float> %a) nounwind {
; GENERIC-LABEL: f32to4ui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttps2udq %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to4ui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttps2udq %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui <4 x float> %a to <4 x i32>
ret <4 x i32> %b
}
define <8 x i32> @f64to8ui(<8 x double> %a) nounwind {
; GENERIC-LABEL: f64to8ui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2udq %zmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to8ui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2udq %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui <8 x double> %a to <8 x i32>
ret <8 x i32> %b
}
define <8 x i16> @f64to8us(<8 x double> %f) {
; GENERIC-LABEL: f64to8us:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: vpmovdw %ymm0, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to8us:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: vpmovdw %ymm0, %xmm0 # sched: [4:2.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fptoui <8 x double> %f to <8 x i16>
ret <8 x i16> %res
}
define <8 x i8> @f64to8uc(<8 x double> %f) {
; GENERIC-LABEL: f64to8uc:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: vpmovdw %ymm0, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to8uc:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: vpmovdw %ymm0, %xmm0 # sched: [4:2.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%res = fptoui <8 x double> %f to <8 x i8>
ret <8 x i8> %res
}
define <4 x i32> @f64to4ui(<4 x double> %a) nounwind {
; GENERIC-LABEL: f64to4ui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2udq %ymm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to4ui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2udq %ymm0, %xmm0 # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui <4 x double> %a to <4 x i32>
ret <4 x i32> %b
}
define <8 x double> @sito8f64(<8 x i32> %a) {
; GENERIC-LABEL: sito8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sito8f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <8 x i32> %a to <8 x double>
ret <8 x double> %b
}
define <8 x double> @i32to8f64_mask(<8 x double> %a, <8 x i32> %b, i8 %c) nounwind {
; GENERIC-LABEL: i32to8f64_mask:
; GENERIC: # %bb.0:
; GENERIC-NEXT: kmovd %edi, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2pd %ymm1, %zmm0 {%k1} # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: i32to8f64_mask:
; SKX: # %bb.0:
; SKX-NEXT: kmovd %edi, %k1 # sched: [1:1.00]
; SKX-NEXT: vcvtdq2pd %ymm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
; VLNOBW-LABEL: i32to8f64_mask:
; VLNOBW: # %bb.0:
; VLNOBW-NEXT: kmovw %edi, %k1
; VLNOBW-NEXT: vcvtdq2pd %ymm1, %zmm0 {%k1}
; VLNOBW-NEXT: ret{{[l|q]}}
%1 = bitcast i8 %c to <8 x i1>
%2 = sitofp <8 x i32> %b to <8 x double>
%3 = select <8 x i1> %1, <8 x double> %2, <8 x double> %a
ret <8 x double> %3
}
define <8 x double> @sito8f64_maskz(<8 x i32> %a, i8 %b) nounwind {
; GENERIC-LABEL: sito8f64_maskz:
; GENERIC: # %bb.0:
; GENERIC-NEXT: kmovd %edi, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 {%k1} {z} # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sito8f64_maskz:
; SKX: # %bb.0:
; SKX-NEXT: kmovd %edi, %k1 # sched: [1:1.00]
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 {%k1} {z} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
; VLNOBW-LABEL: sito8f64_maskz:
; VLNOBW: # %bb.0:
; VLNOBW-NEXT: kmovw %edi, %k1
; VLNOBW-NEXT: vcvtdq2pd %ymm0, %zmm0 {%k1} {z}
; VLNOBW-NEXT: ret{{[l|q]}}
%1 = bitcast i8 %b to <8 x i1>
%2 = sitofp <8 x i32> %a to <8 x double>
%3 = select <8 x i1> %1, <8 x double> %2, <8 x double> zeroinitializer
ret <8 x double> %3
}
define <8 x i32> @f64to8si(<8 x double> %a) {
; GENERIC-LABEL: f64to8si:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to8si:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2dq %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi <8 x double> %a to <8 x i32>
ret <8 x i32> %b
}
define <4 x i32> @f64to4si(<4 x double> %a) {
; GENERIC-LABEL: f64to4si:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttpd2dq %ymm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to4si:
; SKX: # %bb.0:
; SKX-NEXT: vcvttpd2dq %ymm0, %xmm0 # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi <4 x double> %a to <4 x i32>
ret <4 x i32> %b
}
define <16 x float> @f64to16f32(<16 x double> %b) nounwind {
; GENERIC-LABEL: f64to16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtpd2ps %zmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: vcvtpd2ps %zmm1, %ymm1 # sched: [4:1.00]
; GENERIC-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to16f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtpd2ps %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: vcvtpd2ps %zmm1, %ymm1 # sched: [7:1.00]
; SKX-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%a = fptrunc <16 x double> %b to <16 x float>
ret <16 x float> %a
}
define <4 x float> @f64to4f32(<4 x double> %b) {
; GENERIC-LABEL: f64to4f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtpd2ps %ymm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to4f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtpd2ps %ymm0, %xmm0 # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%a = fptrunc <4 x double> %b to <4 x float>
ret <4 x float> %a
}
define <4 x float> @f64to4f32_mask(<4 x double> %b, <4 x i1> %mask) {
; GENERIC-LABEL: f64to4f32_mask:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpslld $31, %xmm1, %xmm1 # sched: [1:1.00]
; GENERIC-NEXT: vpmovd2m %xmm1, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtpd2ps %ymm0, %xmm0 {%k1} {z} # sched: [4:1.00]
; GENERIC-NEXT: vzeroupper # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64to4f32_mask:
; SKX: # %bb.0:
; SKX-NEXT: vpslld $31, %xmm1, %xmm1 # sched: [1:0.50]
; SKX-NEXT: vpmovd2m %xmm1, %k1 # sched: [1:1.00]
; SKX-NEXT: vcvtpd2ps %ymm0, %xmm0 {%k1} {z} # sched: [7:1.00]
; SKX-NEXT: vzeroupper # sched: [0:0.67]
; SKX-NEXT: retq # sched: [7:1.00]
%a = fptrunc <4 x double> %b to <4 x float>
%c = select <4 x i1>%mask, <4 x float>%a, <4 x float> zeroinitializer
ret <4 x float> %c
}
define <4 x float> @f64tof32_inreg(<2 x double> %a0, <4 x float> %a1) nounwind {
; GENERIC-LABEL: f64tof32_inreg:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtsd2ss %xmm0, %xmm1, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64tof32_inreg:
; SKX: # %bb.0:
; SKX-NEXT: vcvtsd2ss %xmm0, %xmm1, %xmm0 # sched: [5:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%ext = extractelement <2 x double> %a0, i32 0
%cvt = fptrunc double %ext to float
%res = insertelement <4 x float> %a1, float %cvt, i32 0
ret <4 x float> %res
}
define <8 x double> @f32to8f64(<8 x float> %b) nounwind {
; GENERIC-LABEL: f32to8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtps2pd %ymm0, %zmm0 # sched: [2:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to8f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtps2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%a = fpext <8 x float> %b to <8 x double>
ret <8 x double> %a
}
define <4 x double> @f32to4f64_mask(<4 x float> %b, <4 x double> %b1, <4 x double> %a1) {
; GENERIC-LABEL: f32to4f64_mask:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcmpltpd %ymm2, %ymm1, %k1 # sched: [3:1.00]
; GENERIC-NEXT: vcvtps2pd %xmm0, %ymm0 {%k1} {z} # sched: [2:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32to4f64_mask:
; SKX: # %bb.0:
; SKX-NEXT: vcmpltpd %ymm2, %ymm1, %k1 # sched: [3:1.00]
; SKX-NEXT: vcvtps2pd %xmm0, %ymm0 {%k1} {z} # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%a = fpext <4 x float> %b to <4 x double>
%mask = fcmp ogt <4 x double> %a1, %b1
%c = select <4 x i1> %mask, <4 x double> %a, <4 x double> zeroinitializer
ret <4 x double> %c
}
define <2 x double> @f32tof64_inreg(<2 x double> %a0, <4 x float> %a1) nounwind {
; GENERIC-LABEL: f32tof64_inreg:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtss2sd %xmm1, %xmm0, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32tof64_inreg:
; SKX: # %bb.0:
; SKX-NEXT: vcvtss2sd %xmm1, %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%ext = extractelement <4 x float> %a1, i32 0
%cvt = fpext float %ext to double
%res = insertelement <2 x double> %a0, double %cvt, i32 0
ret <2 x double> %res
}
define double @sltof64_load(i64* nocapture %e) {
; GENERIC-LABEL: sltof64_load:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vcvtsi2sdq (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sltof64_load:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vcvtsi2sdq (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp1 = load i64, i64* %e, align 8
%conv = sitofp i64 %tmp1 to double
ret double %conv
}
define double @sitof64_load(i32* %e) {
; GENERIC-LABEL: sitof64_load:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vcvtsi2sdl (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sitof64_load:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vcvtsi2sdl (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp1 = load i32, i32* %e, align 4
%conv = sitofp i32 %tmp1 to double
ret double %conv
}
define float @sitof32_load(i32* %e) {
; GENERIC-LABEL: sitof32_load:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vcvtsi2ssl (%rdi), %xmm0, %xmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sitof32_load:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vcvtsi2ssl (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp1 = load i32, i32* %e, align 4
%conv = sitofp i32 %tmp1 to float
ret float %conv
}
define float @sltof32_load(i64* %e) {
; GENERIC-LABEL: sltof32_load:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vcvtsi2ssq (%rdi), %xmm0, %xmm0 # sched: [10:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sltof32_load:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vcvtsi2ssq (%rdi), %xmm0, %xmm0 # sched: [9:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%tmp1 = load i64, i64* %e, align 8
%conv = sitofp i64 %tmp1 to float
ret float %conv
}
define void @f32tof64_loadstore() {
; GENERIC-LABEL: f32tof64_loadstore:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero sched: [6:0.50]
; GENERIC-NEXT: vcvtss2sd %xmm0, %xmm0, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: vmovsd %xmm0, -{{[0-9]+}}(%rsp) # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f32tof64_loadstore:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero sched: [5:0.50]
; SKX-NEXT: vcvtss2sd %xmm0, %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: vmovsd %xmm0, -{{[0-9]+}}(%rsp) # sched: [1:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%f = alloca float, align 4
%d = alloca double, align 8
%tmp = load float, float* %f, align 4
%conv = fpext float %tmp to double
store double %conv, double* %d, align 8
ret void
}
define void @f64tof32_loadstore() nounwind uwtable {
; GENERIC-LABEL: f64tof32_loadstore:
; GENERIC: # %bb.0: # %entry
; GENERIC-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero sched: [6:0.50]
; GENERIC-NEXT: vcvtsd2ss %xmm0, %xmm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: vmovss %xmm0, -{{[0-9]+}}(%rsp) # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: f64tof32_loadstore:
; SKX: # %bb.0: # %entry
; SKX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero sched: [5:0.50]
; SKX-NEXT: vcvtsd2ss %xmm0, %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: vmovss %xmm0, -{{[0-9]+}}(%rsp) # sched: [1:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
entry:
%f = alloca float, align 4
%d = alloca double, align 8
%tmp = load double, double* %d, align 8
%conv = fptrunc double %tmp to float
store float %conv, float* %f, align 4
ret void
}
define double @long_to_double(i64 %x) {
; GENERIC-LABEL: long_to_double:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vmovq %rdi, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: long_to_double:
; SKX: # %bb.0:
; SKX-NEXT: vmovq %rdi, %xmm0 # sched: [1:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%res = bitcast i64 %x to double
ret double %res
}
define i64 @double_to_long(double %x) {
; GENERIC-LABEL: double_to_long:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vmovq %xmm0, %rax # sched: [2:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: double_to_long:
; SKX: # %bb.0:
; SKX-NEXT: vmovq %xmm0, %rax # sched: [2:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%res = bitcast double %x to i64
ret i64 %res
}
define float @int_to_float(i32 %x) {
; GENERIC-LABEL: int_to_float:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vmovd %edi, %xmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: int_to_float:
; SKX: # %bb.0:
; SKX-NEXT: vmovd %edi, %xmm0 # sched: [1:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%res = bitcast i32 %x to float
ret float %res
}
define i32 @float_to_int(float %x) {
; GENERIC-LABEL: float_to_int:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vmovd %xmm0, %eax # sched: [2:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: float_to_int:
; SKX: # %bb.0:
; SKX-NEXT: vmovd %xmm0, %eax # sched: [2:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%res = bitcast float %x to i32
ret i32 %res
}
define <16 x double> @uito16f64(<16 x i32> %a) nounwind {
; GENERIC-LABEL: uito16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2pd %ymm0, %zmm2 # sched: [4:1.00]
; GENERIC-NEXT: vextractf64x4 $1, %zmm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtudq2pd %ymm0, %zmm1 # sched: [4:1.00]
; GENERIC-NEXT: vmovaps %zmm2, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito16f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2pd %ymm0, %zmm2 # sched: [7:1.00]
; SKX-NEXT: vextractf64x4 $1, %zmm0, %ymm0 # sched: [3:1.00]
; SKX-NEXT: vcvtudq2pd %ymm0, %zmm1 # sched: [7:1.00]
; SKX-NEXT: vmovaps %zmm2, %zmm0 # sched: [1:0.33]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <16 x i32> %a to <16 x double>
ret <16 x double> %b
}
define <8 x float> @slto8f32(<8 x i64> %a) {
; GENERIC-LABEL: slto8f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2ps %zmm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto8f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2ps %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <8 x i64> %a to <8 x float>
ret <8 x float> %b
}
define <16 x float> @slto16f32(<16 x i64> %a) {
; GENERIC-LABEL: slto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2ps %zmm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: vcvtqq2ps %zmm1, %ymm1 # sched: [3:1.00]
; GENERIC-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2ps %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: vcvtqq2ps %zmm1, %ymm1 # sched: [7:1.00]
; SKX-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <16 x i64> %a to <16 x float>
ret <16 x float> %b
}
define <8 x double> @slto8f64(<8 x i64> %a) {
; GENERIC-LABEL: slto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto8f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <8 x i64> %a to <8 x double>
ret <8 x double> %b
}
define <16 x double> @slto16f64(<16 x i64> %a) {
; GENERIC-LABEL: slto16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: vcvtqq2pd %zmm1, %zmm1 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: slto16f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtqq2pd %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: vcvtqq2pd %zmm1, %zmm1 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <16 x i64> %a to <16 x double>
ret <16 x double> %b
}
define <8 x float> @ulto8f32(<8 x i64> %a) {
; GENERIC-LABEL: ulto8f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtuqq2ps %zmm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ulto8f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtuqq2ps %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <8 x i64> %a to <8 x float>
ret <8 x float> %b
}
define <16 x float> @ulto16f32(<16 x i64> %a) {
; GENERIC-LABEL: ulto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtuqq2ps %zmm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: vcvtuqq2ps %zmm1, %ymm1 # sched: [3:1.00]
; GENERIC-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ulto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtuqq2ps %zmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: vcvtuqq2ps %zmm1, %ymm1 # sched: [7:1.00]
; SKX-NEXT: vinsertf64x4 $1, %ymm1, %zmm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <16 x i64> %a to <16 x float>
ret <16 x float> %b
}
define <8 x double> @uito8f64_mask(<8 x double> %a, <8 x i32> %b, i8 %c) nounwind {
; GENERIC-LABEL: uito8f64_mask:
; GENERIC: # %bb.0:
; GENERIC-NEXT: kmovd %edi, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtudq2pd %ymm1, %zmm0 {%k1} # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito8f64_mask:
; SKX: # %bb.0:
; SKX-NEXT: kmovd %edi, %k1 # sched: [1:1.00]
; SKX-NEXT: vcvtudq2pd %ymm1, %zmm0 {%k1} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
; VLNOBW-LABEL: uito8f64_mask:
; VLNOBW: # %bb.0:
; VLNOBW-NEXT: kmovw %edi, %k1
; VLNOBW-NEXT: vcvtudq2pd %ymm1, %zmm0 {%k1}
; VLNOBW-NEXT: ret{{[l|q]}}
%1 = bitcast i8 %c to <8 x i1>
%2 = uitofp <8 x i32> %b to <8 x double>
%3 = select <8 x i1> %1, <8 x double> %2, <8 x double> %a
ret <8 x double> %3
}
define <8 x double> @uito8f64_maskz(<8 x i32> %a, i8 %b) nounwind {
; GENERIC-LABEL: uito8f64_maskz:
; GENERIC: # %bb.0:
; GENERIC-NEXT: kmovd %edi, %k1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtudq2pd %ymm0, %zmm0 {%k1} {z} # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito8f64_maskz:
; SKX: # %bb.0:
; SKX-NEXT: kmovd %edi, %k1 # sched: [1:1.00]
; SKX-NEXT: vcvtudq2pd %ymm0, %zmm0 {%k1} {z} # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%1 = bitcast i8 %b to <8 x i1>
%2 = uitofp <8 x i32> %a to <8 x double>
%3 = select <8 x i1> %1, <8 x double> %2, <8 x double> zeroinitializer
ret <8 x double> %3
}
define <4 x double> @uito4f64(<4 x i32> %a) nounwind {
; GENERIC-LABEL: uito4f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2pd %xmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito4f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2pd %xmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <4 x i32> %a to <4 x double>
ret <4 x double> %b
}
define <16 x float> @uito16f32(<16 x i32> %a) nounwind {
; GENERIC-LABEL: uito16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito16f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <16 x i32> %a to <16 x float>
ret <16 x float> %b
}
define <8 x double> @uito8f64(<8 x i32> %a) {
; GENERIC-LABEL: uito8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito8f64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <8 x i32> %a to <8 x double>
ret <8 x double> %b
}
define <8 x float> @uito8f32(<8 x i32> %a) nounwind {
; GENERIC-LABEL: uito8f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2ps %ymm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito8f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2ps %ymm0, %ymm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <8 x i32> %a to <8 x float>
ret <8 x float> %b
}
define <4 x float> @uito4f32(<4 x i32> %a) nounwind {
; GENERIC-LABEL: uito4f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtudq2ps %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uito4f32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtudq2ps %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <4 x i32> %a to <4 x float>
ret <4 x float> %b
}
define i32 @fptosi(float %a) nounwind {
; GENERIC-LABEL: fptosi:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttss2si %xmm0, %eax # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: fptosi:
; SKX: # %bb.0:
; SKX-NEXT: vcvttss2si %xmm0, %eax # sched: [6:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptosi float %a to i32
ret i32 %b
}
define i32 @fptoui(float %a) nounwind {
; GENERIC-LABEL: fptoui:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvttss2usi %xmm0, %eax # sched: [5:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: fptoui:
; SKX: # %bb.0:
; SKX-NEXT: vcvttss2usi %xmm0, %eax # sched: [6:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = fptoui float %a to i32
ret i32 %b
}
define float @uitof32(i32 %a) nounwind {
; GENERIC-LABEL: uitof32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtusi2ssl %edi, %xmm0, %xmm0 # sched: [5:2.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uitof32:
; SKX: # %bb.0:
; SKX-NEXT: vcvtusi2ssl %edi, %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp i32 %a to float
ret float %b
}
define double @uitof64(i32 %a) nounwind {
; GENERIC-LABEL: uitof64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vcvtusi2sdl %edi, %xmm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: uitof64:
; SKX: # %bb.0:
; SKX-NEXT: vcvtusi2sdl %edi, %xmm0, %xmm0 # sched: [5:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp i32 %a to double
ret double %b
}
define <16 x float> @sbto16f32(<16 x i32> %a) {
; GENERIC-LABEL: sbto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovd2m %zmm0, %k0 # sched: [1:0.33]
; GENERIC-NEXT: vpmovm2d %k0, %zmm0 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vpmovd2m %zmm0, %k0 # sched: [1:1.00]
; SKX-NEXT: vpmovm2d %k0, %zmm0 # sched: [1:0.25]
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%mask = icmp slt <16 x i32> %a, zeroinitializer
%1 = sitofp <16 x i1> %mask to <16 x float>
ret <16 x float> %1
}
define <16 x float> @scto16f32(<16 x i8> %a) {
; GENERIC-LABEL: scto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxbd %xmm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: scto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vpmovsxbd %xmm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%1 = sitofp <16 x i8> %a to <16 x float>
ret <16 x float> %1
}
define <16 x float> @ssto16f32(<16 x i16> %a) {
; GENERIC-LABEL: ssto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxwd %ymm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ssto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vpmovsxwd %ymm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%1 = sitofp <16 x i16> %a to <16 x float>
ret <16 x float> %1
}
define <8 x double> @ssto16f64(<8 x i16> %a) {
; GENERIC-LABEL: ssto16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxwd %xmm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ssto16f64:
; SKX: # %bb.0:
; SKX-NEXT: vpmovsxwd %xmm0, %ymm0 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%1 = sitofp <8 x i16> %a to <8 x double>
ret <8 x double> %1
}
define <8 x double> @scto8f64(<8 x i8> %a) {
; GENERIC-LABEL: scto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero sched: [1:1.00]
; GENERIC-NEXT: vpslld $24, %ymm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: vpsrad $24, %ymm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: scto8f64:
; SKX: # %bb.0:
; SKX-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero sched: [3:1.00]
; SKX-NEXT: vpslld $24, %ymm0, %ymm0 # sched: [1:0.50]
; SKX-NEXT: vpsrad $24, %ymm0, %ymm0 # sched: [1:0.50]
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%1 = sitofp <8 x i8> %a to <8 x double>
ret <8 x double> %1
}
define <16 x double> @scto16f64(<16 x i8> %a) {
; GENERIC-LABEL: scto16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxbd %xmm0, %zmm1 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm1, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: vextracti64x4 $1, %zmm1, %ymm1 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm1, %zmm1 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: scto16f64:
; SKX: # %bb.0:
; SKX-NEXT: vpmovsxbd %xmm0, %zmm1 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2pd %ymm1, %zmm0 # sched: [7:1.00]
; SKX-NEXT: vextracti64x4 $1, %zmm1, %ymm1 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2pd %ymm1, %zmm1 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <16 x i8> %a to <16 x double>
ret <16 x double> %b
}
define <16 x double> @sbto16f64(<16 x double> %a) {
; GENERIC-LABEL: sbto16f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorpd %xmm2, %xmm2, %xmm2 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltpd %zmm0, %zmm2, %k0 # sched: [3:1.00]
; GENERIC-NEXT: vcmpltpd %zmm1, %zmm2, %k1 # sched: [3:1.00]
; GENERIC-NEXT: kunpckbw %k0, %k1, %k0 # sched: [1:1.00]
; GENERIC-NEXT: vpmovm2d %k0, %zmm1 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2pd %ymm1, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: vextracti64x4 $1, %zmm1, %ymm1 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm1, %zmm1 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto16f64:
; SKX: # %bb.0:
; SKX-NEXT: vxorpd %xmm2, %xmm2, %xmm2 # sched: [1:0.33]
; SKX-NEXT: vcmpltpd %zmm0, %zmm2, %k0 # sched: [3:1.00]
; SKX-NEXT: vcmpltpd %zmm1, %zmm2, %k1 # sched: [3:1.00]
; SKX-NEXT: kunpckbw %k0, %k1, %k0 # sched: [3:1.00]
; SKX-NEXT: vpmovm2d %k0, %zmm1 # sched: [1:0.25]
; SKX-NEXT: vcvtdq2pd %ymm1, %zmm0 # sched: [7:1.00]
; SKX-NEXT: vextracti64x4 $1, %zmm1, %ymm1 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2pd %ymm1, %zmm1 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <16 x double> %a, zeroinitializer
%1 = sitofp <16 x i1> %cmpres to <16 x double>
ret <16 x double> %1
}
define <8 x double> @sbto8f64(<8 x double> %a) {
; GENERIC-LABEL: sbto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltpd %zmm0, %zmm1, %k0 # sched: [3:1.00]
; GENERIC-NEXT: vpmovm2d %k0, %ymm0 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto8f64:
; SKX: # %bb.0:
; SKX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltpd %zmm0, %zmm1, %k0 # sched: [3:1.00]
; SKX-NEXT: vpmovm2d %k0, %ymm0 # sched: [1:0.25]
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <8 x double> %a, zeroinitializer
%1 = sitofp <8 x i1> %cmpres to <8 x double>
ret <8 x double> %1
}
define <8 x float> @sbto8f32(<8 x float> %a) {
; GENERIC-LABEL: sbto8f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltps %ymm0, %ymm1, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: vcvtdq2ps %ymm0, %ymm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto8f32:
; SKX: # %bb.0:
; SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltps %ymm0, %ymm1, %ymm0 # sched: [4:0.50]
; SKX-NEXT: vcvtdq2ps %ymm0, %ymm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <8 x float> %a, zeroinitializer
%1 = sitofp <8 x i1> %cmpres to <8 x float>
ret <8 x float> %1
}
define <4 x float> @sbto4f32(<4 x float> %a) {
; GENERIC-LABEL: sbto4f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltps %xmm0, %xmm1, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: vcvtdq2ps %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto4f32:
; SKX: # %bb.0:
; SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltps %xmm0, %xmm1, %xmm0 # sched: [4:0.50]
; SKX-NEXT: vcvtdq2ps %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <4 x float> %a, zeroinitializer
%1 = sitofp <4 x i1> %cmpres to <4 x float>
ret <4 x float> %1
}
define <4 x double> @sbto4f64(<4 x double> %a) {
; GENERIC-LABEL: sbto4f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltpd %ymm0, %ymm1, %k0 # sched: [3:1.00]
; GENERIC-NEXT: vpmovm2d %k0, %xmm0 # sched: [1:0.33]
; GENERIC-NEXT: vcvtdq2pd %xmm0, %ymm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto4f64:
; SKX: # %bb.0:
; SKX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltpd %ymm0, %ymm1, %k0 # sched: [3:1.00]
; SKX-NEXT: vpmovm2d %k0, %xmm0 # sched: [1:0.25]
; SKX-NEXT: vcvtdq2pd %xmm0, %ymm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <4 x double> %a, zeroinitializer
%1 = sitofp <4 x i1> %cmpres to <4 x double>
ret <4 x double> %1
}
define <2 x float> @sbto2f32(<2 x float> %a) {
; GENERIC-LABEL: sbto2f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltps %xmm0, %xmm1, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: vcvtdq2ps %xmm0, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto2f32:
; SKX: # %bb.0:
; SKX-NEXT: vxorps %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltps %xmm0, %xmm1, %xmm0 # sched: [4:0.50]
; SKX-NEXT: vcvtdq2ps %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <2 x float> %a, zeroinitializer
%1 = sitofp <2 x i1> %cmpres to <2 x float>
ret <2 x float> %1
}
define <2 x double> @sbto2f64(<2 x double> %a) {
; GENERIC-LABEL: sbto2f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [0:0.25]
; GENERIC-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0 # sched: [3:1.00]
; GENERIC-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,2,2,3] sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %xmm0, %xmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: sbto2f64:
; SKX: # %bb.0:
; SKX-NEXT: vxorpd %xmm1, %xmm1, %xmm1 # sched: [1:0.33]
; SKX-NEXT: vcmpltpd %xmm0, %xmm1, %xmm0 # sched: [4:0.50]
; SKX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,2,2,3] sched: [1:1.00]
; SKX-NEXT: vcvtdq2pd %xmm0, %xmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%cmpres = fcmp ogt <2 x double> %a, zeroinitializer
%1 = sitofp <2 x i1> %cmpres to <2 x double>
ret <2 x double> %1
}
define <16 x float> @ucto16f32(<16 x i8> %a) {
; GENERIC-LABEL: ucto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ucto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero sched: [3:1.00]
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <16 x i8> %a to <16 x float>
ret <16 x float>%b
}
define <8 x double> @ucto8f64(<8 x i8> %a) {
; GENERIC-LABEL: ucto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0 # sched: [7:0.50]
; GENERIC-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: ucto8f64:
; SKX: # %bb.0:
; SKX-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0 # sched: [7:0.50]
; SKX-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero sched: [3:1.00]
; SKX-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [7:1.00]
; SKX-NEXT: retq # sched: [7:1.00]
%b = uitofp <8 x i8> %a to <8 x double>
ret <8 x double> %b
}
define <16 x float> @swto16f32(<16 x i16> %a) {
; GENERIC-LABEL: swto16f32:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxwd %ymm0, %zmm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [3:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]
;
; SKX-LABEL: swto16f32:
; SKX: # %bb.0:
; SKX-NEXT: vpmovsxwd %ymm0, %zmm0 # sched: [3:1.00]
; SKX-NEXT: vcvtdq2ps %zmm0, %zmm0 # sched: [4:0.50]
; SKX-NEXT: retq # sched: [7:1.00]
%b = sitofp <16 x i16> %a to <16 x float>
ret <16 x float> %b
}
define <8 x double> @swto8f64(<8 x i16> %a) {
; GENERIC-LABEL: swto8f64:
; GENERIC: # %bb.0:
; GENERIC-NEXT: vpmovsxwd %xmm0, %ymm0 # sched: [1:1.00]
; GENERIC-NEXT: vcvtdq2pd %ymm0, %zmm0 # sched: [4:1.00]
; GENERIC-NEXT: retq # sched: [1:1.00]