mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 21:20:27 -04:00
A test case for issue #40. Segfaults with: make -C test test_simd && ./test/test_simd
This commit is contained in:
parent
c2c0c0be03
commit
b30b93cd97
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,3 +44,4 @@ tools/fft_float
|
|||||||
tools/fft_int16_t
|
tools/fft_int16_t
|
||||||
tools/fft_int32_t
|
tools/fft_int32_t
|
||||||
tools/fft_simd
|
tools/fft_simd
|
||||||
|
test/test_simd
|
||||||
|
@ -64,6 +64,8 @@ all: tools $(BENCHKISS) $(SELFTEST) $(BENCHFFTW) $(TESTREAL) $(TESTKFC)
|
|||||||
tools:
|
tools:
|
||||||
cd ../tools && make all
|
cd ../tools && make all
|
||||||
|
|
||||||
|
test_simd: test_simd.c $(SRCFILES)
|
||||||
|
$(CC) -o $@ -g $(CFLAGS) -DUSE_SIMD=1 -msse $+ -lm
|
||||||
|
|
||||||
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
||||||
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
|
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm
|
||||||
|
25
test/test_simd.c
Normal file
25
test/test_simd.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <kiss_fftnd.h>
|
||||||
|
|
||||||
|
static void test1(void)
|
||||||
|
{
|
||||||
|
int is_inverse = 1;
|
||||||
|
int n[2] = {256,256};
|
||||||
|
size_t nbytes = sizeof(kiss_fft_cpx)*n[0]*n[1];
|
||||||
|
|
||||||
|
kiss_fft_cpx * inbuf = _mm_malloc(nbytes,16);
|
||||||
|
kiss_fft_cpx * outbuf = _mm_malloc(nbytes,16);
|
||||||
|
memset(inbuf,0,nbytes);
|
||||||
|
memset(outbuf,0,nbytes);
|
||||||
|
|
||||||
|
kiss_fftnd_cfg cfg = kiss_fftnd_alloc(n,2,is_inverse,0,0);
|
||||||
|
kiss_fftnd(cfg,inbuf,outbuf);
|
||||||
|
kiss_fft_free(cfg);
|
||||||
|
_mm_free(inbuf);
|
||||||
|
_mm_free(outbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
test1();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user