ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | LICENSE

Commit: a5400b32e0c4ebfbd85139f5b93f7bb1f76f49e8
Parent: 4f386a62139824d44532638f16fa25a9738ccbb6
Author: Randy Palamar
Date:   Tue, 10 Dec 2024 05:34:08 -0700

don't over-constrain mem_copy

for simple functions like this which we haven't profiled it s
better to let the compiler do the work. The restrict keyword can
be used to assure the compiler that the pointers won't alias.

Diffstat:
Mbuild.sh | 2+-
Mutil.c | 9+--------
2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/build.sh b/build.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -cflags="-march=native -std=c11 -O3 -Wall -I./external/include -fno-builtin" +cflags="-march=native -std=c11 -O3 -Wall -I./external/include" #cflags="${cflags} -fproc-stat-report" #cflags="${cflags} -Rpass-missed=.*" libcflags="$cflags -fPIC -shared -Wno-unused-variable" diff --git a/util.c b/util.c @@ -23,17 +23,10 @@ mem_clear(void *p_, u8 c, size len) } static void -mem_copy(void *src, void *dest, size n) +mem_copy(void *restrict src, void *restrict dest, size n) { ASSERT(n >= 0); u8 *s = src, *d = dest; -#if defined(__AVX512BW__) - /* TODO: aligned load/store and comparison */ - for (; n >= 64; n -= 64, s += 64, d += 64) - _mm512_storeu_epi8(d, _mm512_loadu_epi8(s)); -#endif - for (; n >= 16; n -= 16, s += 16, d += 16) - _mm_storeu_si128((__m128i *)d, _mm_loadu_si128((__m128i*)s)); for (; n; n--) *d++ = *s++; }