add simple avx test
Change-Id: Ia17524929672b420e20d9b491fdafd21cc5a928f Reviewed-on: https://review.haiku-os.org/c/haiku/+/2850 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
0ba51bc88f
commit
a9f415f06a
@@ -13,6 +13,11 @@ SimpleTest fibo_exec : fibo_exec.cpp ;
|
||||
|
||||
SimpleTest fifo_poll_test : fifo_poll_test.cpp ;
|
||||
|
||||
SimpleTest hello_avx : hello_avx.c ;
|
||||
local avxSource = [ FGristFiles hello_avx.c ] ;
|
||||
local avxObject = $(avxSource:S=$(SUFOBJ)) ;
|
||||
CCFLAGS on $(avxObject) = -mavx ;
|
||||
|
||||
SimpleTest live_query :
|
||||
live_query.cpp
|
||||
: be
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* https://www.codeproject.com/Articles/874396/Crunching-Numbers-with-AVX-and-AVX
|
||||
* 2016, Matt Scarpino, released under the Code Project Open License
|
||||
* https://www.codeproject.com/info/cpol10.aspx
|
||||
*/
|
||||
|
||||
#include <immintrin.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
|
||||
/* Initialize the two argument vectors */
|
||||
__m256 evens = _mm256_set_ps(2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0);
|
||||
__m256 odds = _mm256_set_ps(1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0);
|
||||
|
||||
/* Compute the difference between the two vectors */
|
||||
__m256 result = _mm256_sub_ps(evens, odds);
|
||||
|
||||
/* Display the elements of the result vector */
|
||||
float* f = (float*)&result;
|
||||
printf("%f %f %f %f %f %f %f %f\n",
|
||||
f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user