aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil K Pandey <skpgkp2@gmail.com>2022-03-07 10:47:15 -0800
committerSunil K Pandey <skpgkp2@gmail.com>2022-03-07 21:44:09 -0800
commit160e183a9a1d2bb54fb899f86ab67ce516a95304 (patch)
tree17fbd41421fde4158f6d3b663baabff6d0692ab7
parentd9f0857d4de731ad322c2f97fce94fdc1241d1b5 (diff)
downloadglibc-160e183a9a1d2bb54fb899f86ab67ce516a95304.tar.xz
glibc-160e183a9a1d2bb54fb899f86ab67ce516a95304.zip
x86_64: Fix svml_s_tanf8_core_avx2.S code formatting
This commit contains following formatting changes 1. Instructions proceeded by a tab. 2. Instruction less than 8 characters in length have a tab between it and the first operand. 3. Instruction greater than 7 characters in length have a space between it and the first operand. 4. Tabs after `#define`d names and their value. 5. 8 space at the beginning of line replaced by tab. 6. Indent comments with code. 7. Remove redundent .text section. 8. 1 space between line content and line comment. 9. Space after all commas. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
-rw-r--r--sysdeps/x86_64/fpu/multiarch/svml_s_tanf8_core_avx2.S4937
1 files changed, 2467 insertions, 2470 deletions
diff --git a/sysdeps/x86_64/fpu/multiarch/svml_s_tanf8_core_avx2.S b/sysdeps/x86_64/fpu/multiarch/svml_s_tanf8_core_avx2.S
index 7c67acf8c8..cd33fac643 100644
--- a/sysdeps/x86_64/fpu/multiarch/svml_s_tanf8_core_avx2.S
+++ b/sysdeps/x86_64/fpu/multiarch/svml_s_tanf8_core_avx2.S
@@ -47,2549 +47,2546 @@
/* Offsets for data table __svml_stan_data_internal
*/
-#define _sInvPI_uisa 0
-#define _sPI1_uisa 32
-#define _sPI2_uisa 64
-#define _sPI3_uisa 96
-#define _sPI2_ha_uisa 128
-#define _sPI3_ha_uisa 160
-#define Th_tbl_uisa 192
-#define Tl_tbl_uisa 320
-#define _sPC3_uisa 448
-#define _sPC5_uisa 480
-#define _sRangeReductionVal_uisa 512
-#define _sInvPi 544
-#define _sSignMask 576
-#define _sAbsMask 608
-#define _sRangeVal 640
-#define _sRShifter 672
-#define _sOne 704
-#define _sRangeReductionVal 736
-#define _sPI1 768
-#define _sPI2 800
-#define _sPI3 832
-#define _sPI4 864
-#define _sPI1_FMA 896
-#define _sPI2_FMA 928
-#define _sPI3_FMA 960
-#define _sP0 992
-#define _sP1 1024
-#define _sQ0 1056
-#define _sQ1 1088
-#define _sQ2 1120
-#define _sTwo 1152
-#define _sCoeffs 1184
+#define _sInvPI_uisa 0
+#define _sPI1_uisa 32
+#define _sPI2_uisa 64
+#define _sPI3_uisa 96
+#define _sPI2_ha_uisa 128
+#define _sPI3_ha_uisa 160
+#define Th_tbl_uisa 192
+#define Tl_tbl_uisa 320
+#define _sPC3_uisa 448
+#define _sPC5_uisa 480
+#define _sRangeReductionVal_uisa 512
+#define _sInvPi 544
+#define _sSignMask 576
+#define _sAbsMask 608
+#define _sRangeVal 640
+#define _sRShifter 672
+#define _sOne 704
+#define _sRangeReductionVal 736
+#define _sPI1 768
+#define _sPI2 800
+#define _sPI3 832
+#define _sPI4 864
+#define _sPI1_FMA 896
+#define _sPI2_FMA 928
+#define _sPI3_FMA 960
+#define _sP0 992
+#define _sP1 1024
+#define _sQ0 1056
+#define _sQ1 1088
+#define _sQ2 1120
+#define _sTwo 1152
+#define _sCoeffs 1184
#include <sysdep.h>
- .text
- .section .text.avx2,"ax",@progbits
+ .section .text.avx2, "ax", @progbits
ENTRY(_ZGVdN8v_tanf_avx2)
- pushq %rbp
- cfi_def_cfa_offset(16)
- movq %rsp, %rbp
- cfi_def_cfa(6, 16)
- cfi_offset(6, -16)
- andq $-32, %rsp
- pushq %rbx
- subq $184, %rsp
-
-/*
- * Legacy Code
- * Here HW FMA can be unavailable
- */
- xorl %eax, %eax
- vmovups _sAbsMask+__svml_stan_data_internal(%rip), %ymm10
-
-/*
- *
- * Main path (_LA_ and _EP_)
- *
- * Octant calculation
- */
- vmovups _sInvPi+__svml_stan_data_internal(%rip), %ymm5
- vmovups _sRShifter+__svml_stan_data_internal(%rip), %ymm2
-
-/* Range reduction */
- vmovups _sPI1_FMA+__svml_stan_data_internal(%rip), %ymm3
-
-/* Rational approximation */
- vmovups _sP1+__svml_stan_data_internal(%rip), %ymm9
- vmovaps %ymm0, %ymm12
- vandps %ymm10, %ymm12, %ymm1
- vfmadd213ps %ymm2, %ymm1, %ymm5
- vsubps %ymm2, %ymm5, %ymm8
- vpslld $30, %ymm5, %ymm6
-
-/* Inversion mask and sign calculation */
- vpslld $31, %ymm5, %ymm4
- vfnmadd213ps %ymm1, %ymm8, %ymm3
- vfnmadd231ps _sPI2_FMA+__svml_stan_data_internal(%rip), %ymm8, %ymm3
- vfnmadd132ps _sPI3_FMA+__svml_stan_data_internal(%rip), %ymm3, %ymm8
- vmovups _sQ2+__svml_stan_data_internal(%rip), %ymm3
- vmulps %ymm8, %ymm8, %ymm13
- vfmadd213ps _sQ1+__svml_stan_data_internal(%rip), %ymm13, %ymm3
- vfmadd213ps _sP0+__svml_stan_data_internal(%rip), %ymm13, %ymm9
- vfmadd213ps _sQ0+__svml_stan_data_internal(%rip), %ymm13, %ymm3
- vmulps %ymm9, %ymm8, %ymm8
- vxorps %ymm7, %ymm7, %ymm7
- vcmpneqps %ymm7, %ymm6, %ymm2
- vandnps %ymm12, %ymm10, %ymm11
- vxorps %ymm11, %ymm4, %ymm0
-
-/* Exchanged numerator and denominator if necessary */
- vandnps %ymm8, %ymm2, %ymm14
- vandps %ymm3, %ymm2, %ymm15
- vandps %ymm8, %ymm2, %ymm4
- vandnps %ymm3, %ymm2, %ymm5
- vorps %ymm15, %ymm14, %ymm6
- vorps %ymm5, %ymm4, %ymm7
-
-/* Division */
- vdivps %ymm7, %ymm6, %ymm9
-
-/* Large values check */
- vcmpnle_uqps _sRangeReductionVal+__svml_stan_data_internal(%rip), %ymm1, %ymm10
- vmovmskps %ymm10, %edx
-
-/* Sign setting */
- vxorps %ymm0, %ymm9, %ymm0
-
-/*
- *
- * End of main path (_LA_ and _EP_)
- */
-
- testl %edx, %edx
-
-/* Go to auxilary branch */
- jne L(AUX_BRANCH)
- /* DW_CFA_expression: r3 (rbx) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -8; DW_OP_plus) */
- .cfi_escape 0x10, 0x03, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xf8, 0xff, 0xff, 0xff, 0x22
- # LOE r12 r13 r14 r15 eax ymm0 ymm1 ymm10 ymm11 ymm12
-
-/* Return from auxilary branch
- * for out of main path inputs
- */
+ pushq %rbp
+ cfi_def_cfa_offset(16)
+ movq %rsp, %rbp
+ cfi_def_cfa(6, 16)
+ cfi_offset(6, -16)
+ andq $-32, %rsp
+ pushq %rbx
+ subq $184, %rsp
+
+ /*
+ * Legacy Code
+ * Here HW FMA can be unavailable
+ */
+ xorl %eax, %eax
+ vmovups _sAbsMask+__svml_stan_data_internal(%rip), %ymm10
+
+ /*
+ *
+ * Main path (_LA_ and _EP_)
+ *
+ * Octant calculation
+ */
+ vmovups _sInvPi+__svml_stan_data_internal(%rip), %ymm5
+ vmovups _sRShifter+__svml_stan_data_internal(%rip), %ymm2
+
+ /* Range reduction */
+ vmovups _sPI1_FMA+__svml_stan_data_internal(%rip), %ymm3
+
+ /* Rational approximation */
+ vmovups _sP1+__svml_stan_data_internal(%rip), %ymm9
+ vmovaps %ymm0, %ymm12
+ vandps %ymm10, %ymm12, %ymm1
+ vfmadd213ps %ymm2, %ymm1, %ymm5
+ vsubps %ymm2, %ymm5, %ymm8
+ vpslld $30, %ymm5, %ymm6
+
+ /* Inversion mask and sign calculation */
+ vpslld $31, %ymm5, %ymm4
+ vfnmadd213ps %ymm1, %ymm8, %ymm3
+ vfnmadd231ps _sPI2_FMA+__svml_stan_data_internal(%rip), %ymm8, %ymm3
+ vfnmadd132ps _sPI3_FMA+__svml_stan_data_internal(%rip), %ymm3, %ymm8
+ vmovups _sQ2+__svml_stan_data_internal(%rip), %ymm3
+ vmulps %ymm8, %ymm8, %ymm13
+ vfmadd213ps _sQ1+__svml_stan_data_internal(%rip), %ymm13, %ymm3
+ vfmadd213ps _sP0+__svml_stan_data_internal(%rip), %ymm13, %ymm9
+ vfmadd213ps _sQ0+__svml_stan_data_internal(%rip), %ymm13, %ymm3
+ vmulps %ymm9, %ymm8, %ymm8
+ vxorps %ymm7, %ymm7, %ymm7
+ vcmpneqps %ymm7, %ymm6, %ymm2
+ vandnps %ymm12, %ymm10, %ymm11
+ vxorps %ymm11, %ymm4, %ymm0
+
+ /* Exchanged numerator and denominator if necessary */
+ vandnps %ymm8, %ymm2, %ymm14
+ vandps %ymm3, %ymm2, %ymm15
+ vandps %ymm8, %ymm2, %ymm4
+ vandnps %ymm3, %ymm2, %ymm5
+ vorps %ymm15, %ymm14, %ymm6
+ vorps %ymm5, %ymm4, %ymm7
+
+ /* Division */
+ vdivps %ymm7, %ymm6, %ymm9
+
+ /* Large values check */
+ vcmpnle_uqps _sRangeReductionVal+__svml_stan_data_internal(%rip), %ymm1, %ymm10
+ vmovmskps %ymm10, %edx
+
+ /* Sign setting */
+ vxorps %ymm0, %ymm9, %ymm0
+
+ /*
+ *
+ * End of main path (_LA_ and _EP_)
+ */
+
+ testl %edx, %edx
+
+ /* Go to auxilary branch */
+ jne L(AUX_BRANCH)
+ /* DW_CFA_expression: r3 (rbx) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -8; DW_OP_plus) */
+ .cfi_escape 0x10, 0x03, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xf8, 0xff, 0xff, 0xff, 0x22
+ # LOE r12 r13 r14 r15 eax ymm0 ymm1 ymm10 ymm11 ymm12
+
+ /* Return from auxilary branch
+ * for out of main path inputs
+ */
L(AUX_BRANCH_RETURN):
- testl %eax, %eax
+ testl %eax, %eax
-/* Go to special inputs processing branch */
- jne L(SPECIAL_VALUES_BRANCH)
- # LOE r12 r13 r14 r15 eax ymm0 ymm12
+ /* Go to special inputs processing branch */
+ jne L(SPECIAL_VALUES_BRANCH)
+ # LOE r12 r13 r14 r15 eax ymm0 ymm12
-/* Restore registers
- * and exit the function
- */
+ /* Restore registers
+ * and exit the function
+ */
L(EXIT):
- addq $184, %rsp
- cfi_restore(3)
- popq %rbx
- movq %rbp, %rsp
- popq %rbp
- cfi_def_cfa(7, 8)
- cfi_restore(6)
- ret
- cfi_def_cfa(6, 16)
- /* DW_CFA_expression: r3 (rbx) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -8; DW_OP_plus) */
- .cfi_escape 0x10, 0x03, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xf8, 0xff, 0xff, 0xff, 0x22
- cfi_offset(6, -16)
-
-/* Branch to process
- * special inputs
- */
+ addq $184, %rsp
+ cfi_restore(3)
+ popq %rbx
+ movq %rbp, %rsp
+ popq %rbp
+ cfi_def_cfa(7, 8)
+ cfi_restore(6)
+ ret
+ cfi_def_cfa(6, 16)
+ /* DW_CFA_expression: r3 (rbx) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -8; DW_OP_plus) */
+ .cfi_escape 0x10, 0x03, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0xf8, 0xff, 0xff, 0xff, 0x22
+ cfi_offset(6, -16)
+
+ /* Branch to process
+ * special inputs
+ */
L(SPECIAL_VALUES_BRANCH):
- vmovups %ymm12, 32(%rsp)
- vmovups %ymm0, 64(%rsp)
- # LOE r12 r13 r14 r15 eax ymm0
-
- xorl %ebx, %ebx
- # LOE r12 r13 r14 r15 eax ebx
-
- vzeroupper
- movq %r12, 8(%rsp)
- /* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
- .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
- movl %eax, %r12d
- movq %r13, (%rsp)
- /* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
- .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
- # LOE r14 r15 ebx r12d
-
-/* Range mask
- * bits check
- */
+ vmovups %ymm12, 32(%rsp)
+ vmovups %ymm0, 64(%rsp)
+ # LOE r12 r13 r14 r15 eax ymm0
+
+ xorl %ebx, %ebx
+ # LOE r12 r13 r14 r15 eax ebx
+
+ vzeroupper
+ movq %r12, 8(%rsp)
+ /* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
+ movl %eax, %r12d
+ movq %r13, (%rsp)
+ /* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
+ # LOE r14 r15 ebx r12d
+
+ /* Range mask
+ * bits check
+ */
L(RANGEMASK_CHECK):
- btl %ebx, %r12d
+ btl %ebx, %r12d
-/* Call scalar math function */
- jc L(SCALAR_MATH_CALL)
- # LOE r14 r15 ebx r12d
+ /* Call scalar math function */
+ jc L(SCALAR_MATH_CALL)
+ # LOE r14 r15 ebx r12d
-/* Special inputs
- * processing loop
- */
+ /* Special inputs
+ * processing loop
+ */
L(SPECIAL_VALUES_LOOP):
- incl %ebx
- cmpl $8, %ebx
-
-/* Check bits in range mask */
- jl L(RANGEMASK_CHECK)
- # LOE r14 r15 ebx r12d
-
- movq 8(%rsp), %r12
- cfi_restore(12)
- movq (%rsp), %r13
- cfi_restore(13)
- vmovups 64(%rsp), %ymm0
-
-/* Go to exit */
- jmp L(EXIT)
- /* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
- .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
- /* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
- .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
- # LOE r12 r13 r14 r15 ymm0
-
-/* Scalar math fucntion call
- * to process special input
- */
+ incl %ebx
+ cmpl $8, %ebx
+
+ /* Check bits in range mask */
+ jl L(RANGEMASK_CHECK)
+ # LOE r14 r15 ebx r12d
+
+ movq 8(%rsp), %r12
+ cfi_restore(12)
+ movq (%rsp), %r13
+ cfi_restore(13)
+ vmovups 64(%rsp), %ymm0
+
+ /* Go to exit */
+ jmp L(EXIT)
+ /* DW_CFA_expression: r12 (r12) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -184; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0c, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x48, 0xff, 0xff, 0xff, 0x22
+ /* DW_CFA_expression: r13 (r13) (DW_OP_lit8; DW_OP_minus; DW_OP_const4s: -32; DW_OP_and; DW_OP_const4s: -192; DW_OP_plus) */
+ .cfi_escape 0x10, 0x0d, 0x0e, 0x38, 0x1c, 0x0d, 0xe0, 0xff, 0xff, 0xff, 0x1a, 0x0d, 0x40, 0xff, 0xff, 0xff, 0x22
+ # LOE r12 r13 r14 r15 ymm0
+
+ /* Scalar math fucntion call
+ * to process special input
+ */
L(SCALAR_MATH_CALL):
- movl %ebx, %r13d
- movss 32(%rsp,%r13,4), %xmm0
- call tanf@PLT
- # LOE r13 r14 r15 ebx r12d xmm0
+ movl %ebx, %r13d
+ movss 32(%rsp, %r13, 4), %xmm0
+ call tanf@PLT
+ # LOE r13 r14 r15 ebx r12d xmm0
- movss %xmm0, 64(%rsp,%r13,4)
+ movss %xmm0, 64(%rsp, %r13, 4)
-/* Process special inputs in loop */
- jmp L(SPECIAL_VALUES_LOOP)
- cfi_restore(12)
- cfi_restore(13)
- # LOE r14 r15 ebx r12d
+ /* Process special inputs in loop */
+ jmp L(SPECIAL_VALUES_LOOP)
+ cfi_restore(12)
+ cfi_restore(13)
+ # LOE r14 r15 ebx r12d
-/* Auxilary branch
- * for out of main path inputs
- */
+ /* Auxilary branch
+ * for out of main path inputs
+ */
L(AUX_BRANCH):
- vpand .FLT_16(%rip), %ymm1, %ymm5
-
-/*
- * Get the (2^a / 2pi) mod 1 values from the table.
- * Because doesn't have I-type gather, we need a trivial cast
- */
- lea __svml_stan_reduction_data_internal(%rip), %rdx
- vmovups %ymm11, 64(%rsp)
- vmovups .FLT_15(%rip), %ymm7
- vmovups %ymm10, 96(%rsp)
- vmovups %ymm0, 128(%rsp)
- vpsrld $23, %ymm5, %ymm6
- vpslld $1, %ymm6, %ymm11
- vpaddd %ymm6, %ymm11, %ymm13
- vpslld $2, %ymm13, %ymm15
- vandps %ymm7, %ymm12, %ymm14
- vcmpeqps %ymm7, %ymm14, %ymm10
- vmovmskps %ymm10, %eax
- vextractf128 $1, %ymm15, %xmm7
- vmovd %xmm15, %ecx
- vmovd %xmm7, %r8d
- vmovd (%rcx,%rdx), %xmm8
- vpextrd $1, %xmm15, %ebx
- vpextrd $2, %xmm15, %esi
- vpextrd $3, %xmm15, %edi
- vpextrd $1, %xmm7, %r10d
- vpextrd $2, %xmm7, %r9d
- vpextrd $3, %xmm7, %r11d
- vmovd (%rbx,%rdx), %xmm3
- vmovd (%rsi,%rdx), %xmm2
- vmovd (%rdi,%rdx), %xmm14
- vmovd (%r8,%rdx), %xmm10
- vmovd (%r10,%rdx), %xmm5
- vmovd (%r9,%rdx), %xmm11
- vmovd (%r11,%rdx), %xmm6
- vpunpckldq %xmm3, %xmm8, %xmm4
- vpunpckldq %xmm14, %xmm2, %xmm0
- vpunpckldq %xmm5, %xmm10, %xmm13
- vpunpckldq %xmm6, %xmm11, %xmm15
- vpunpcklqdq %xmm0, %xmm4, %xmm9
- vmovd 4(%rcx,%rdx), %xmm3
- vmovd 4(%rbx,%rdx), %xmm2
- vmovd 4(%rsi,%rdx), %xmm14
- vmovd 4(%rdi,%rdx), %xmm4
- vpunpcklqdq %xmm15, %xmm13, %xmm8
- vmovd 4(%r8,%rdx), %xmm5
- vmovd 4(%r10,%rdx), %xmm6
- vmovd 4(%r9,%rdx), %xmm13
- vmovd 4(%r11,%rdx), %xmm15
- vpunpckldq %xmm2, %xmm3, %xmm0
- vpunpckldq %xmm4, %xmm14, %xmm7
- vpunpckldq %xmm15, %xmm13, %xmm3
- vpunpcklqdq %xmm7, %xmm0, %xmm10
- vmovd 8(%rsi,%rdx), %xmm0
- vmovd 8(%rdi,%rdx), %xmm7
- vmovd 8(%rcx,%rdx), %xmm14
- vmovd 8(%rbx,%rdx), %xmm4
- vmovd 8(%r8,%rdx), %xmm15
- vinsertf128 $1, %xmm8, %ymm9, %ymm11
- vpunpckldq %xmm6, %xmm5, %xmm8
- vpunpcklqdq %xmm3, %xmm8, %xmm2
- vpunpckldq %xmm7, %xmm0, %xmm6
-
-/*
- * Also get the significand as an integer
- * NB: adding in the integer bit is wrong for denorms!
- * To make this work for denorms we should do something slightly different
- */
- vpand .FLT_17(%rip), %ymm1, %ymm7
- vmovd 8(%r10,%rdx), %xmm8
- vmovd 8(%r9,%rdx), %xmm3
- vpunpckldq %xmm4, %xmm14, %xmm5
- vpunpckldq %xmm8, %xmm15, %xmm14
-
-/* Load constants (not all needed at once) */
- lea _sCoeffs+36+__svml_stan_data_internal(%rip), %r9
- vpunpcklqdq %xmm6, %xmm5, %xmm13
- vpaddd .FLT_18(%rip), %ymm7, %ymm5
- vinsertf128 $1, %xmm2, %ymm10, %ymm9
- vmovd 8(%r11,%rdx), %xmm2
- vpunpckldq %xmm2, %xmm3, %xmm4
- vpunpcklqdq %xmm4, %xmm14, %xmm0
-
-/*
- * Break the P_xxx and m into 16-bit chunks ready for
- * the long multiplication via 16x16->32 multiplications
- */
- vmovdqu .FLT_19(%rip), %ymm14
- vpsrld $16, %ymm5, %ymm10
- vpand %ymm14, %ymm5, %ymm5
- vpand %ymm14, %ymm9, %ymm3
- vpand %ymm14, %ymm11, %ymm7
- vpsrld $16, %ymm11, %ymm11
- vpmulld %ymm3, %ymm5, %ymm8
- vpmulld %ymm3, %ymm10, %ymm3
- vinsertf128 $1, %xmm0, %ymm13, %ymm13
- vpsrld $16, %ymm13, %ymm6
- vpand %ymm14, %ymm13, %ymm15
- vpsrld $16, %ymm9, %ymm0
- vpmulld %ymm6, %ymm10, %ymm13
- vpmulld %ymm6, %ymm5, %ymm6
- vpsrld $16, %ymm6, %ymm6
- vpmulld %ymm15, %ymm10, %ymm4
- vpand %ymm14, %ymm8, %ymm15
- vpaddd %ymm6, %ymm13, %ymm13
- vpsrld $16, %ymm4, %ymm4
- vpsrld $16, %ymm8, %ymm8
- vpaddd %ymm13, %ymm15, %ymm15
- vpmulld %ymm0, %ymm5, %ymm2
- vpaddd %ymm15, %ymm4, %ymm13
- vpand %ymm14, %ymm2, %ymm4
- vpaddd %ymm8, %ymm3, %ymm15
- vpsrld $16, %ymm2, %ymm2
- vpsrld $16, %ymm13, %ymm6
-
-/* Assemble reduced argument from the pieces */
- vpand %ymm14, %ymm13, %ymm13
- vpaddd %ymm15, %ymm4, %ymm8
- vpmulld %ymm7, %ymm5, %ymm9
- vpmulld %ymm0, %ymm10, %ymm0
- vpaddd %ymm8, %ymm6, %ymm4
- vpand %ymm14, %ymm9, %ymm6
- vpaddd %ymm2, %ymm0, %ymm8
- vpsrld $16, %ymm9, %ymm3
- vpsrld $16, %ymm4, %ymm15
- vpslld $16, %ymm4, %ymm4
- vpaddd %ymm8, %ymm6, %ymm6
- vpaddd %ymm6, %ymm15, %ymm0
- vpmulld %ymm11, %ymm5, %ymm6
-
-/* Now do the big multiplication and carry propagation */
- vpmulld %ymm7, %ymm10, %ymm8
- vpand %ymm14, %ymm6, %ymm2
- vpaddd %ymm3, %ymm8, %ymm5
- vpsrld $16, %ymm0, %ymm15
- vpand %ymm14, %ymm0, %ymm0
-
-/*
- * We want to incorporate the original sign now too.
- * Do it here for convenience in getting the right N value,
- * though we could wait right to the end if we were prepared
- * to modify the sign of N later too.
- * So get the appropriate sign mask now (or sooner).
- */
- vpand .FLT_20(%rip), %ymm1, %ymm3
- vpaddd %ymm5, %ymm2, %ymm7
- vpaddd %ymm13, %ymm4, %ymm8
-
-/*
- * Now round at the 2^-8 bit position for reduction mod pi/2^7
- * instead of the original 2pi (but still with the same 2pi scaling).
- * Use a shifter of 2^15 + 2^14.
- * The N we get is our final version; it has an offset of
- * 2^8 because of the implicit integer bit, and anyway for negative
- * starting value it's a 2s complement thing. But we need to mask
- * off the exponent part anyway so it's fine.
- */
- vmovups .FLT_22(%rip), %ymm14
- vpaddd %ymm7, %ymm15, %ymm15
-
-/*
- * Create floating-point high part, implicitly adding integer bit 1
- * Incorporate overall sign at this stage too.
- */
- vpxor .FLT_21(%rip), %ymm3, %ymm11
-
-/*
- * Create floating-point low and medium parts, respectively
- * lo_17, ... lo_0, 0, ..., 0
- * hi_8, ... hi_0, lo_31, ..., lo_18
- * then subtract off the implicitly added integer bits,
- * 2^-46 and 2^-23, respectively.
- * Put the original sign into all of them at this stage.
- */
- vpxor .FLT_23(%rip), %ymm3, %ymm7
- vpslld $16, %ymm15, %ymm9
- vpaddd %ymm0, %ymm9, %ymm2
- vpand .FLT_24(%rip), %ymm8, %ymm0
- vpsrld $18, %ymm8, %ymm8
- vpsrld $9, %ymm2, %ymm10
- vpslld $5, %ymm0, %ymm4
- vpor %ymm11, %ymm10, %ymm6
- vpxor .FLT_25(%rip), %ymm3, %ymm11
- vpand .FLT_26(%rip), %ymm2, %ymm3
- vpor %ymm7, %ymm4, %ymm5
-
-/*
- * If the magnitude of the input is <= 2^-20, then
- * just pass through the input, since no reduction will be needed and
- * the main path will only work accurately if the reduced argument is
- * about >= 2^-40 (which it is for all large pi multiples)
- */
- vmovups .FLT_30(%rip), %ymm4
- vpslld $14, %ymm3, %ymm2
-
-/*
- * Now multiply those numbers all by 2 pi, reasonably accurately.
- * (RHi + RLo) * (pi_lead + pi_trail) ~=
- * RHi * pi_lead + (RHi * pi_trail + RLo * pi_lead)
- */
- vmovups .FLT_27(%rip), %ymm3
- vaddps %ymm14, %ymm6, %ymm13
- vpor %ymm8, %ymm2, %ymm9
- vsubps %ymm14, %ymm13, %ymm15
-
-/* Grab our final N value as an integer, appropriately masked mod 2^8 */
- vpand .FLT_31(%rip), %ymm13, %ymm13
- vpor %ymm11, %ymm9, %ymm10
- vsubps %ymm15, %ymm6, %ymm6
- vsubps %ymm7, %ymm5, %ymm15
- vsubps %ymm11, %ymm10, %ymm14
-
-/* Now add them up into 2 reasonably aligned pieces */
- vaddps %ymm14, %ymm6, %ymm2
- vsubps %ymm2, %ymm6, %ymm6
- vmulps %ymm2, %ymm3, %ymm7
- vaddps %ymm6, %ymm14, %ymm8
- vaddps %ymm8, %ymm15, %ymm8
- vmovaps %ymm3, %ymm15
- vfmsub213ps %ymm7, %ymm2, %ymm15
- vandps .FLT_29(%rip), %ymm1, %ymm0
- vfmadd132ps .FLT_28(%rip), %ymm15, %ymm2
- vcmpgt_oqps %ymm4, %ymm0, %ymm9
- vcmple_oqps %ymm4, %ymm0, %ymm5
-
-/*
- * The output is _VRES_R (high) + _VRES_E (low), and the integer part is _VRES_IND
- * Set sRp2 = _VRES_R^2 and then resume the original code.
- * Argument reduction is now finished: x = n * pi/128 + r
- * where n = iIndex and r = sR (high) + sE (low).
- * But we have n modulo 256, needed for sin/cos with period 2pi
- * but we want it modulo 128 since tan has period pi.
- */
- vpand .FLT_32(%rip), %ymm13, %ymm0
- vfmadd213ps %ymm2, %ymm3, %ymm8
- vpslld $2, %ymm0, %ymm2
- vandps %ymm1, %ymm5, %ymm1
- vandps %ymm7, %ymm9, %ymm6
- vorps %ymm6, %ymm1, %ymm15
- vpaddd %ymm0, %ymm2, %ymm1
- vpslld $3, %ymm1, %ymm4
- vand