From baf4910870a6e8999802b9a4a22eabd4142a34e3 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 1 Dec 2022 22:30:22 +0100 Subject: Move all Advent of Codes into one repo --- 2020/01/repair_avx.asm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 2020/01/repair_avx.asm (limited to '2020/01/repair_avx.asm') diff --git a/2020/01/repair_avx.asm b/2020/01/repair_avx.asm new file mode 100644 index 0000000..4f128f6 --- /dev/null +++ b/2020/01/repair_avx.asm @@ -0,0 +1,21 @@ +global repair_avx_inner + +section .text + +repair_avx_inner: +%assign i 0 +%rep 25 + vpcmpeqd ymm1, ymm0, [rdi + i] +; vptest ymm1, ymm1 ; slower then vpmovmskb + test + vpmovmskb eax, ymm1 + test eax, eax + jne .found +%assign i i+32 +%endrep + xor eax, eax ; not found, return 0 + vzeroupper ; eliminate performance penalties caused by false dependencies when transitioning between AVX and legacy SSE instructions + ret +.found: + vzeroupper ; eliminate performance penalties caused by false dependencies when transitioning between AVX and legacy SSE instructions + movd eax, xmm0 ; smaller then putting a vmovd before the vzeroupper and no measurable performance difference + ret -- cgit v1.2.3