[v1.01] Do not use FMA for frequency measurement. It is sufficient to run any other AVX instructions, and some CPUs support AVX but not FMA.

This commit is contained in:
Dr-Noob
2021-11-20 10:25:36 +01:00
parent 4b50740516
commit fe3bc6163c
3 changed files with 12 additions and 14 deletions

View File

@@ -17,12 +17,11 @@ void* compute_avx() {
__m256 a = _mm256_set1_ps(1.5);
__m256 b = _mm256_set1_ps(1.2);
__m256 c = _mm256_set1_ps(0.0);
gettimeofday(&begin, NULL);
while(!end) {
for(uint64_t i=0; i < LOOP_ITERS; i++) {
c = _mm256_fmadd_ps(a, b, c);
a = _mm256_add_ps(a, b);
}
gettimeofday(&now, NULL);
@@ -35,7 +34,7 @@ void* compute_avx() {
printf("fopen: %s", strerror(errno));
}
else {
fprintf(fp, "%f", c[0]);
fprintf(fp, "%f", a[0]);
fclose(fp);
}