[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 27/30] Hexagon HVX (tests/tcg/hexagon) vector_add_int test
From: |
Taylor Simpson |
Subject: |
[PULL v2 27/30] Hexagon HVX (tests/tcg/hexagon) vector_add_int test |
Date: |
Wed, 3 Nov 2021 16:17:24 -0500 |
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
tests/tcg/hexagon/vector_add_int.c | 61 ++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 tests/tcg/hexagon/vector_add_int.c
diff --git a/tests/tcg/hexagon/vector_add_int.c
b/tests/tcg/hexagon/vector_add_int.c
new file mode 100644
index 0000000..d6010ea
--- /dev/null
+++ b/tests/tcg/hexagon/vector_add_int.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights
Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+
+int gA[401];
+int gB[401];
+int gC[401];
+
+void vector_add_int()
+{
+ int i;
+ for (i = 0; i < 400; i++) {
+ gA[i] = gB[i] + gC[i];
+ }
+}
+
+int main()
+{
+ int error = 0;
+ int i;
+ for (i = 0; i < 400; i++) {
+ gB[i] = i * 2;
+ gC[i] = i * 3;
+ }
+ gA[400] = 17;
+ vector_add_int();
+ for (i = 0; i < 400; i++) {
+ if (gA[i] != i * 5) {
+ error++;
+ printf("ERROR: gB[%d] = %d\t", i, gB[i]);
+ printf("gC[%d] = %d\t", i, gC[i]);
+ printf("gA[%d] = %d\n", i, gA[i]);
+ }
+ }
+ if (gA[400] != 17) {
+ error++;
+ printf("ERROR: Overran the buffer\n");
+ }
+ if (!error) {
+ printf("PASS\n");
+ return 0;
+ } else {
+ printf("FAIL\n");
+ return 1;
+ }
+}
--
2.7.4
- [PULL v2 09/30] Hexagon HVX (target/hexagon) C preprocessor for decode tree, (continued)
- [PULL v2 09/30] Hexagon HVX (target/hexagon) C preprocessor for decode tree, Taylor Simpson, 2021/11/03
- [PULL v2 02/30] Hexagon HVX (target/hexagon) add Hexagon Vector eXtensions (HVX) to core, Taylor Simpson, 2021/11/03
- [PULL v2 04/30] Hexagon HVX (target/hexagon) instruction attributes, Taylor Simpson, 2021/11/03
- [PULL v2 01/30] Hexagon HVX (target/hexagon) README, Taylor Simpson, 2021/11/03
- [PULL v2 11/30] Hexagon HVX (target/hexagon) helper functions, Taylor Simpson, 2021/11/03
- [PULL v2 19/30] Hexagon HVX (target/hexagon) helper overrides - vector logical ops, Taylor Simpson, 2021/11/03
- [PULL v2 05/30] Hexagon HVX (target/hexagon) macros, Taylor Simpson, 2021/11/03
- [PULL v2 12/30] Hexagon HVX (target/hexagon) TCG generation, Taylor Simpson, 2021/11/03
- [PULL v2 16/30] Hexagon HVX (target/hexagon) helper overrides - vector add & sub, Taylor Simpson, 2021/11/03
- [PULL v2 10/30] Hexagon HVX (target/hexagon) instruction utility functions, Taylor Simpson, 2021/11/03
- [PULL v2 27/30] Hexagon HVX (tests/tcg/hexagon) vector_add_int test,
Taylor Simpson <=
- [PULL v2 18/30] Hexagon HVX (target/hexagon) helper overrides - vector max/min, Taylor Simpson, 2021/11/03
- [PULL v2 06/30] Hexagon HVX (target/hexagon) import macro definitions, Taylor Simpson, 2021/11/03
- [PULL v2 20/30] Hexagon HVX (target/hexagon) helper overrides - vector compares, Taylor Simpson, 2021/11/03
- [PULL v2 15/30] Hexagon HVX (target/hexagon) helper overrides - vector assign & cmov, Taylor Simpson, 2021/11/03
- [PULL v2 08/30] Hexagon HVX (target/hexagon) semantics generator - part 2, Taylor Simpson, 2021/11/03
- [PULL v2 07/30] Hexagon HVX (target/hexagon) semantics generator, Taylor Simpson, 2021/11/03
- [PULL v2 21/30] Hexagon HVX (target/hexagon) helper overrides - vector splat and abs, Taylor Simpson, 2021/11/03
- [PULL v2 17/30] Hexagon HVX (target/hexagon) helper overrides - vector shifts, Taylor Simpson, 2021/11/03
- [PULL v2 14/30] Hexagon HVX (target/hexagon) helper overrides for histogram instructions, Taylor Simpson, 2021/11/03
- [PULL v2 23/30] Hexagon HVX (target/hexagon) helper overrides - vector stores, Taylor Simpson, 2021/11/03