blob: c7b1814b3658ab5fb72bf9d8562a1e2fceb8a52f [file] [log] [blame]
Christophe Lyon073831a2011-01-24 17:37:40 +01001/*
2
Christophe Lyon80902f62013-03-29 16:26:42 +01003Copyright (c) 2009, 2010, 2011, 2013 STMicroelectronics
Christophe Lyon073831a2011-01-24 17:37:40 +01004Written by Christophe Lyon
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE SOFTWARE.
23
24*/
25
Christophe Lyon1775be02014-07-10 13:46:54 +020026#if defined(__arm__) || defined(__aarch64__)
Christophe Lyon073831a2011-01-24 17:37:40 +010027#include <arm_neon.h>
28#else
Christophe Lyon0dab5f72011-07-19 17:14:09 +020029#include "stm-arm-neon.h"
Christophe Lyon073831a2011-01-24 17:37:40 +010030#endif
31
32#include "stm-arm-neon-ref.h"
33
34#ifndef INSN_NAME
35#define INSN_NAME vmul
36#define TEST_MSG "VMUL"
37#endif
38
39
40#define FNNAME1(NAME) void exec_ ## NAME (void)
41#define FNNAME(NAME) FNNAME1(NAME)
42
43FNNAME (INSN_NAME)
44{
45#define DECL_VMUL(T, W, N) \
46 DECL_VARIABLE(vector1, T, W, N); \
47 DECL_VARIABLE(vector2, T, W, N); \
48 DECL_VARIABLE(vector_res, T, W, N)
49
Christophe Lyona89b3552014-06-05 21:53:56 +020050 /* vector_res = OP(vector1, vector2), then store the result. */
Christophe Lyon073831a2011-01-24 17:37:40 +010051#define TEST_VMUL1(INSN, Q, T1, T2, W, N) \
52 VECT_VAR(vector_res, T1, W, N) = \
53 INSN##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \
54 VECT_VAR(vector2, T1, W, N)); \
55 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \
56 VECT_VAR(vector_res, T1, W, N))
57
58#define TEST_VMUL(INSN, Q, T1, T2, W, N) \
59 TEST_VMUL1(INSN, Q, T1, T2, W, N)
60
61 /* With ARM RVCT, we need to declare variables before any executable
62 statement */
63 DECL_VMUL(int, 8, 8);
64 DECL_VMUL(int, 16, 4);
65 DECL_VMUL(int, 32, 2);
66 DECL_VMUL(uint, 8, 8);
67 DECL_VMUL(uint, 16, 4);
68 DECL_VMUL(uint, 32, 2);
Christophe Lyon80902f62013-03-29 16:26:42 +010069 DECL_VMUL(poly, 8, 8);
Christophe Lyon073831a2011-01-24 17:37:40 +010070 DECL_VMUL(float, 32, 2);
71 DECL_VMUL(int, 8, 16);
72 DECL_VMUL(int, 16, 8);
73 DECL_VMUL(int, 32, 4);
74 DECL_VMUL(uint, 8, 16);
75 DECL_VMUL(uint, 16, 8);
76 DECL_VMUL(uint, 32, 4);
Christophe Lyon80902f62013-03-29 16:26:42 +010077 DECL_VMUL(poly, 8, 16);
Christophe Lyon073831a2011-01-24 17:37:40 +010078 DECL_VMUL(float, 32, 4);
79
80 clean_results ();
81
Christophe Lyonf2053672014-12-16 10:26:00 +010082 VLOAD(vector1, buffer, , int, s, 8, 8);
83 VLOAD(vector1, buffer, , int, s, 16, 4);
84 VLOAD(vector1, buffer, , int, s, 32, 2);
85 VLOAD(vector1, buffer, , uint, u, 8, 8);
86 VLOAD(vector1, buffer, , uint, u, 16, 4);
87 VLOAD(vector1, buffer, , uint, u, 32, 2);
88 VLOAD(vector1, buffer, , poly, p, 8, 8);
89 VLOAD(vector1, buffer, , float, f, 32, 2);
90 VLOAD(vector1, buffer, q, int, s, 8, 16);
91 VLOAD(vector1, buffer, q, int, s, 16, 8);
92 VLOAD(vector1, buffer, q, int, s, 32, 4);
93 VLOAD(vector1, buffer, q, uint, u, 8, 16);
94 VLOAD(vector1, buffer, q, uint, u, 16, 8);
95 VLOAD(vector1, buffer, q, uint, u, 32, 4);
96 VLOAD(vector1, buffer, q, poly, p, 8, 16);
97 VLOAD(vector1, buffer, q, float, f, 32, 4);
Christophe Lyon073831a2011-01-24 17:37:40 +010098
Christophe Lyonf2053672014-12-16 10:26:00 +010099 VDUP(vector2, , int, s, 8, 8, 0x11);
100 VDUP(vector2, , int, s, 16, 4, 0x22);
101 VDUP(vector2, , int, s, 32, 2, 0x33);
102 VDUP(vector2, , uint, u, 8, 8, 0x44);
103 VDUP(vector2, , uint, u, 16, 4, 0x55);
104 VDUP(vector2, , uint, u, 32, 2, 0x66);
105 VDUP(vector2, , poly, p, 8, 8, 0x44);
106 VDUP(vector2, , float, f, 32, 2, 33.3f);
107 VDUP(vector2, q, int, s, 8, 16, 0x77);
108 VDUP(vector2, q, int, s, 16, 8, 0x88);
109 VDUP(vector2, q, int, s, 32, 4, 0x99);
110 VDUP(vector2, q, uint, u, 8, 16, 0xAA);
111 VDUP(vector2, q, uint, u, 16, 8, 0xBB);
112 VDUP(vector2, q, uint, u, 32, 4, 0xCC);
113 VDUP(vector2, q, poly, p, 8, 16, 0xAA);
114 VDUP(vector2, q, float, f, 32, 4, 99.6f);
Christophe Lyon073831a2011-01-24 17:37:40 +0100115
116 TEST_VMUL(INSN_NAME, , int, s, 8, 8);
117 TEST_VMUL(INSN_NAME, , int, s, 16, 4);
118 TEST_VMUL(INSN_NAME, , int, s, 32, 2);
119 TEST_VMUL(INSN_NAME, , uint, u, 8, 8);
120 TEST_VMUL(INSN_NAME, , uint, u, 16, 4);
121 TEST_VMUL(INSN_NAME, , uint, u, 32, 2);
Christophe Lyon80902f62013-03-29 16:26:42 +0100122 TEST_VMUL(INSN_NAME, , poly, p, 8, 8);
Christophe Lyon073831a2011-01-24 17:37:40 +0100123 TEST_VMUL(INSN_NAME, , float, f, 32, 2);
124 TEST_VMUL(INSN_NAME, q, int, s, 8, 16);
125 TEST_VMUL(INSN_NAME, q, int, s, 16, 8);
126 TEST_VMUL(INSN_NAME, q, int, s, 32, 4);
127 TEST_VMUL(INSN_NAME, q, uint, u, 8, 16);
128 TEST_VMUL(INSN_NAME, q, uint, u, 16, 8);
129 TEST_VMUL(INSN_NAME, q, uint, u, 32, 4);
Christophe Lyon80902f62013-03-29 16:26:42 +0100130 TEST_VMUL(INSN_NAME, q, poly, p, 8, 16);
Christophe Lyon073831a2011-01-24 17:37:40 +0100131 TEST_VMUL(INSN_NAME, q, float, f, 32, 4);
132
133 dump_results_hex (TEST_MSG);
134}