|
|
190885 |
From c166f44e4488af4f4af035645775fe44b12bab13 Mon Sep 17 00:00:00 2001
|
|
|
190885 |
From: "H.J. Lu" <hjl.tools@gmail.com>
|
|
|
190885 |
Date: Fri, 20 Aug 2021 06:42:24 -0700
|
|
|
190885 |
Subject: [PATCH] x86-64: Optimize load of all bits set into ZMM register [BZ
|
|
|
190885 |
#28252]
|
|
|
190885 |
|
|
|
190885 |
Optimize loads of all bits set into ZMM register in AVX512 SVML codes
|
|
|
190885 |
by replacing
|
|
|
190885 |
|
|
|
190885 |
vpbroadcastq .L_2il0floatpacket.16(%rip), %zmmX
|
|
|
190885 |
|
|
|
190885 |
and
|
|
|
190885 |
|
|
|
190885 |
vmovups .L_2il0floatpacket.13(%rip), %zmmX
|
|
|
190885 |
|
|
|
190885 |
with
|
|
|
190885 |
vpternlogd $0xff, %zmmX, %zmmX, %zmmX
|
|
|
190885 |
|
|
|
190885 |
This fixes BZ #28252.
|
|
|
190885 |
|
|
|
190885 |
(cherry picked from commit 78c9ec9000f873abe7a15a91b87080a2e4308260)
|
|
|
190885 |
---
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_d_log8_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S | 7 +------
|
|
|
190885 |
.../fpu/multiarch/svml_d_sincos8_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S | 12 ++----------
|
|
|
190885 |
.../fpu/multiarch/svml_s_sincosf16_core_avx512.S | 7 +------
|
|
|
190885 |
.../x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S | 7 +------
|
|
|
190885 |
10 files changed, 11 insertions(+), 64 deletions(-)
|
|
|
190885 |
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S
|
|
|
190885 |
index 24e3b363..07dfed85 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_cos8_core_avx512.S
|
|
|
190885 |
@@ -265,7 +265,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_cos
|
|
|
190885 |
vmovaps %zmm0, %zmm8
|
|
|
190885 |
|
|
|
190885 |
/* Check for large arguments path */
|
|
|
190885 |
- vpbroadcastq .L_2il0floatpacket.16(%rip), %zmm2
|
|
|
190885 |
+ vpternlogd $0xff, %zmm2, %zmm2, %zmm2
|
|
|
190885 |
|
|
|
190885 |
/*
|
|
|
190885 |
ARGUMENT RANGE REDUCTION:
|
|
|
190885 |
@@ -456,8 +456,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_cos
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN8v_cos_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.16:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.16,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S
|
|
|
190885 |
index ae8af8d8..ddb60e5b 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_log8_core_avx512.S
|
|
|
190885 |
@@ -274,7 +274,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_log
|
|
|
190885 |
|
|
|
190885 |
/* preserve mantissa, set input exponent to 2^(-10) */
|
|
|
190885 |
vpternlogq $248, _ExpMask(%rax), %zmm3, %zmm2
|
|
|
190885 |
- vpbroadcastq .L_2il0floatpacket.12(%rip), %zmm1
|
|
|
190885 |
+ vpternlogd $0xff, %zmm1, %zmm1, %zmm1
|
|
|
190885 |
vpsrlq $32, %zmm4, %zmm6
|
|
|
190885 |
|
|
|
190885 |
/* reciprocal approximation good to at least 11 bits */
|
|
|
190885 |
@@ -461,8 +461,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_log
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN8v_log_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.12:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.12,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S
|
|
|
190885 |
index 2d4b14fd..529c454a 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_sin8_core_avx512.S
|
|
|
190885 |
@@ -261,7 +261,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_sin
|
|
|
190885 |
andq $-64, %rsp
|
|
|
190885 |
subq $1280, %rsp
|
|
|
190885 |
movq __svml_d_trig_data@GOTPCREL(%rip), %rax
|
|
|
190885 |
- vpbroadcastq .L_2il0floatpacket.14(%rip), %zmm14
|
|
|
190885 |
+ vpternlogd $0xff, %zmm1, %zmm1, %zmm14
|
|
|
190885 |
vmovups __dAbsMask(%rax), %zmm7
|
|
|
190885 |
vmovups __dInvPI(%rax), %zmm2
|
|
|
190885 |
vmovups __dRShifter(%rax), %zmm1
|
|
|
190885 |
@@ -458,8 +458,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN4v_sin
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN8v_sin_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.14:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.14,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S
|
|
|
190885 |
index 2df626c0..e501a53a 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_d_sincos8_core_avx512.S
|
|
|
190885 |
@@ -430,7 +430,7 @@ WRAPPER_IMPL_AVX512_fFF _ZGVdN4vl8l8_sincos
|
|
|
190885 |
|
|
|
190885 |
/* SinPoly = SinR*SinPoly */
|
|
|
190885 |
vfmadd213pd %zmm5, %zmm5, %zmm4
|
|
|
190885 |
- vpbroadcastq .L_2il0floatpacket.15(%rip), %zmm3
|
|
|
190885 |
+ vpternlogd $0xff, %zmm3, %zmm3, %zmm3
|
|
|
190885 |
|
|
|
190885 |
/* Update Cos result's sign */
|
|
|
190885 |
vxorpd %zmm2, %zmm1, %zmm1
|
|
|
190885 |
@@ -741,8 +741,3 @@ END (_ZGVeN8vvv_sincos_knl)
|
|
|
190885 |
ENTRY (_ZGVeN8vvv_sincos_skx)
|
|
|
190885 |
WRAPPER_AVX512_vvv_vl8l8 _ZGVeN8vl8l8_sincos_skx
|
|
|
190885 |
END (_ZGVeN8vvv_sincos_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.15:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.15,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S
|
|
|
190885 |
index 6ea1137b..377af394 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_cosf16_core_avx512.S
|
|
|
190885 |
@@ -278,7 +278,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_cosf
|
|
|
190885 |
X = X - Y*PI1 - Y*PI2 - Y*PI3
|
|
|
190885 |
*/
|
|
|
190885 |
vmovaps %zmm0, %zmm6
|
|
|
190885 |
- vmovups .L_2il0floatpacket.13(%rip), %zmm12
|
|
|
190885 |
+ vpternlogd $0xff, %zmm12, %zmm12, %zmm12
|
|
|
190885 |
vmovups __sRShifter(%rax), %zmm3
|
|
|
190885 |
vmovups __sPI1_FMA(%rax), %zmm5
|
|
|
190885 |
vmovups __sA9_FMA(%rax), %zmm9
|
|
|
190885 |
@@ -453,8 +453,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_cosf
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN16v_cosf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.13:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.13,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S
|
|
|
190885 |
index 89ba0df2..46f33d46 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_expf16_core_avx512.S
|
|
|
190885 |
@@ -264,7 +264,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_expf
|
|
|
190885 |
vmovaps %zmm0, %zmm7
|
|
|
190885 |
|
|
|
190885 |
/* compare against threshold */
|
|
|
190885 |
- vmovups .L_2il0floatpacket.13(%rip), %zmm3
|
|
|
190885 |
+ vpternlogd $0xff, %zmm3, %zmm3, %zmm3
|
|
|
190885 |
vmovups __sInvLn2(%rax), %zmm4
|
|
|
190885 |
vmovups __sShifter(%rax), %zmm1
|
|
|
190885 |
vmovups __sLn2hi(%rax), %zmm6
|
|
|
190885 |
@@ -440,8 +440,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_expf
|
|
|
190885 |
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN16v_expf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.13:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.13,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S
|
|
|
190885 |
index 4cf0a96f..9e254956 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_logf16_core_avx512.S
|
|
|
190885 |
@@ -235,7 +235,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_logf
|
|
|
190885 |
andq $-64, %rsp
|
|
|
190885 |
subq $1280, %rsp
|
|
|
190885 |
movq __svml_slog_data@GOTPCREL(%rip), %rax
|
|
|
190885 |
- vmovups .L_2il0floatpacket.7(%rip), %zmm6
|
|
|
190885 |
+ vpternlogd $0xff, %zmm6, %zmm6, %zmm6
|
|
|
190885 |
vmovups _iBrkValue(%rax), %zmm4
|
|
|
190885 |
vmovups _sPoly_7(%rax), %zmm8
|
|
|
190885 |
|
|
|
190885 |
@@ -409,8 +409,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_logf
|
|
|
190885 |
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN16v_logf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.7:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.7,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S
|
|
|
190885 |
index bdcd50af..e8331ba1 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_powf16_core_avx512.S
|
|
|
190885 |
@@ -385,7 +385,7 @@ WRAPPER_IMPL_AVX512_ff _ZGVdN8vv_powf
|
|
|
190885 |
vpsrlq $32, %zmm3, %zmm2
|
|
|
190885 |
vpmovqd %zmm2, %ymm11
|
|
|
190885 |
vcvtps2pd %ymm14, %zmm13
|
|
|
190885 |
- vmovups .L_2il0floatpacket.23(%rip), %zmm14
|
|
|
190885 |
+ vpternlogd $0xff, %zmm14, %zmm14, %zmm14
|
|
|
190885 |
vmovaps %zmm14, %zmm26
|
|
|
190885 |
vpandd _ABSMASK(%rax), %zmm1, %zmm8
|
|
|
190885 |
vpcmpd $1, _INF(%rax), %zmm8, %k2
|
|
|
190885 |
@@ -427,7 +427,7 @@ WRAPPER_IMPL_AVX512_ff _ZGVdN8vv_powf
|
|
|
190885 |
vpmovqd %zmm11, %ymm5
|
|
|
190885 |
vpxord %zmm10, %zmm10, %zmm10
|
|
|
190885 |
vgatherdpd _Log2Rcp_lookup(%rax,%ymm4), %zmm10{%k3}
|
|
|
190885 |
- vpbroadcastq .L_2il0floatpacket.24(%rip), %zmm4
|
|
|
190885 |
+ vpternlogd $0xff, %zmm4, %zmm4, %zmm4
|
|
|
190885 |
vpxord %zmm11, %zmm11, %zmm11
|
|
|
190885 |
vcvtdq2pd %ymm7, %zmm7
|
|
|
190885 |
vgatherdpd _Log2Rcp_lookup(%rax,%ymm5), %zmm11{%k1}
|
|
|
190885 |
@@ -643,11 +643,3 @@ WRAPPER_IMPL_AVX512_ff _ZGVdN8vv_powf
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN16vv_powf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.23:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.23,@object
|
|
|
190885 |
-.L_2il0floatpacket.24:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.24,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
|
|
|
190885 |
index 5fa4bc41..1f46f334 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_sincosf16_core_avx512.S
|
|
|
190885 |
@@ -317,7 +317,7 @@ WRAPPER_IMPL_AVX512_fFF _ZGVdN8vvv_sincosf
|
|
|
190885 |
|
|
|
190885 |
/* Result sign calculations */
|
|
|
190885 |
vpternlogd $150, %zmm0, %zmm14, %zmm1
|
|
|
190885 |
- vmovups .L_2il0floatpacket.13(%rip), %zmm14
|
|
|
190885 |
+ vpternlogd $0xff, %zmm14, %zmm14, %zmm14
|
|
|
190885 |
|
|
|
190885 |
/* Add correction term 0.5 for cos() part */
|
|
|
190885 |
vaddps %zmm8, %zmm5, %zmm15
|
|
|
190885 |
@@ -748,8 +748,3 @@ END (_ZGVeN16vvv_sincosf_knl)
|
|
|
190885 |
ENTRY (_ZGVeN16vvv_sincosf_skx)
|
|
|
190885 |
WRAPPER_AVX512_vvv_vl4l4 _ZGVeN16vl4l4_sincosf_skx
|
|
|
190885 |
END (_ZGVeN16vvv_sincosf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.13:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.13,@object
|
|
|
190885 |
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S b/sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S
|
|
|
190885 |
index 141f747e..1fc9308a 100644
|
|
|
190885 |
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S
|
|
|
190885 |
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_sinf16_core_avx512.S
|
|
|
190885 |
@@ -280,7 +280,7 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_sinf
|
|
|
190885 |
movq __svml_s_trig_data@GOTPCREL(%rip), %rax
|
|
|
190885 |
|
|
|
190885 |
/* Check for large and special values */
|
|
|
190885 |
- vmovups .L_2il0floatpacket.11(%rip), %zmm14
|
|
|
190885 |
+ vpternlogd $0xff, %zmm14, %zmm14, %zmm14
|
|
|
190885 |
vmovups __sAbsMask(%rax), %zmm5
|
|
|
190885 |
vmovups __sInvPI(%rax), %zmm1
|
|
|
190885 |
vmovups __sRShifter(%rax), %zmm2
|
|
|
190885 |
@@ -472,8 +472,3 @@ WRAPPER_IMPL_AVX512 _ZGVdN8v_sinf
|
|
|
190885 |
jmp .LBL_2_7
|
|
|
190885 |
#endif
|
|
|
190885 |
END (_ZGVeN16v_sinf_skx)
|
|
|
190885 |
-
|
|
|
190885 |
- .section .rodata, "a"
|
|
|
190885 |
-.L_2il0floatpacket.11:
|
|
|
190885 |
- .long 0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff,0xffffffff
|
|
|
190885 |
- .type .L_2il0floatpacket.11,@object
|
|
|
190885 |
--
|
|
|
190885 |
GitLab
|
|
|
190885 |
|