hrev54295 adds 1 changeset to branch 'master'
old head: 0ba51bc88f30f16a42f1b3804e1eb2b90457b564
new head: a9f415f06a4457c27f4a7e87ff74a79839b03ce5
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=a9f415f06a44+%5E0ba51bc88f30
----------------------------------------------------------------------------
a9f415f06a44: add simple avx test
Change-Id: Ia17524929672b420e20d9b491fdafd21cc5a928f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2850
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>
[ Jérôme Duval <jerome.duval@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54295
Commit: a9f415f06a4457c27f4a7e87ff74a79839b03ce5
URL: https://git.haiku-os.org/haiku/commit/?id=a9f415f06a44
Author: Jérôme Duval <jerome.duval@xxxxxxxxx>
Date: Thu May 7 21:54:03 2020 UTC
Committer: waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Wed Jun 3 13:57:35 2020 UTC
----------------------------------------------------------------------------
2 files changed, 30 insertions(+)
src/tests/system/kernel/Jamfile | 5 +++++
src/tests/system/kernel/hello_avx.c | 25 +++++++++++++++++++++++++
----------------------------------------------------------------------------
diff --git a/src/tests/system/kernel/Jamfile b/src/tests/system/kernel/Jamfile
index b385aa8a33..91a33a6e2d 100644
--- a/src/tests/system/kernel/Jamfile
+++ b/src/tests/system/kernel/Jamfile
@@ -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
diff --git a/src/tests/system/kernel/hello_avx.c
b/src/tests/system/kernel/hello_avx.c
new file mode 100644
index 0000000000..f84377506d
--- /dev/null
+++ b/src/tests/system/kernel/hello_avx.c
@@ -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;
+}