blob: 97367488ec050ec7cceabe23e9e089175a3c706f [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#define TEST_MSG "VLD1_LANE/VLD1_LANEQ"
35void exec_vld1_lane (void)
36{
37 /* Fill vector_src with 0xAA, then load 1 lane */
38#define TEST_VLD1_LANE(Q, T1, T2, W, N, L) \
39 memset (VECT_VAR(buffer_src, T1, W, N), 0xAA, W/8*N); \
40 VECT_VAR(vector_src, T1, W, N) = \
41 vld1##Q##_##T2##W(VECT_VAR(buffer_src, T1, W, N)); \
42 VECT_VAR(vector, T1, W, N) = \
43 vld1##Q##_lane_##T2##W(VECT_VAR(buffer, T1, W, N), \
44 VECT_VAR(vector_src, T1, W, N), L); \
45 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N))
46
47 /* With ARM RVCT, we need to declare variables before any executable
48 statement */
49 DECL_VARIABLE_ALL_VARIANTS(vector);
Christophe Lyond98beba2016-08-24 18:02:41 +020050#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020051 DECL_VARIABLE(vector, float, 16, 4);
52 DECL_VARIABLE(vector, float, 16, 8);
53#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010054 DECL_VARIABLE_ALL_VARIANTS(vector_src);
Christophe Lyond98beba2016-08-24 18:02:41 +020055#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020056 DECL_VARIABLE(vector_src, float, 16, 4);
57 DECL_VARIABLE(vector_src, float, 16, 8);
58#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010059
60 ARRAY(buffer_src, int, 8, 8);
61 ARRAY(buffer_src, int, 16, 4);
62 ARRAY(buffer_src, int, 32, 2);
63 ARRAY(buffer_src, int, 64, 1);
64 ARRAY(buffer_src, uint, 8, 8);
65 ARRAY(buffer_src, uint, 16, 4);
66 ARRAY(buffer_src, uint, 32, 2);
67 ARRAY(buffer_src, uint, 64, 1);
Christophe Lyon80902f62013-03-29 16:26:42 +010068 ARRAY(buffer_src, poly, 8, 8);
69 ARRAY(buffer_src, poly, 16, 4);
Christophe Lyon073831a2011-01-24 17:37:40 +010070 ARRAY(buffer_src, float, 32, 2);
Christophe Lyond98beba2016-08-24 18:02:41 +020071#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020072 ARRAY(buffer_src, float, 16, 4);
73#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010074
75 ARRAY(buffer_src, int, 8, 16);
76 ARRAY(buffer_src, int, 16, 8);
77 ARRAY(buffer_src, int, 32, 4);
78 ARRAY(buffer_src, int, 64, 2);
79 ARRAY(buffer_src, uint, 8, 16);
80 ARRAY(buffer_src, uint, 16, 8);
81 ARRAY(buffer_src, uint, 32, 4);
82 ARRAY(buffer_src, uint, 64, 2);
Christophe Lyon80902f62013-03-29 16:26:42 +010083 ARRAY(buffer_src, poly, 8, 16);
84 ARRAY(buffer_src, poly, 16, 8);
Christophe Lyon073831a2011-01-24 17:37:40 +010085 ARRAY(buffer_src, float, 32, 4);
Christophe Lyond98beba2016-08-24 18:02:41 +020086#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +020087 ARRAY(buffer_src, float, 16, 8);
88#endif
Christophe Lyon073831a2011-01-24 17:37:40 +010089
90 clean_results ();
91
92 /* Choose lane arbitrarily */
93 TEST_VLD1_LANE(, int, s, 8, 8, 6);
94 TEST_VLD1_LANE(, int, s, 16, 4, 3);
95 TEST_VLD1_LANE(, int, s, 32, 2, 1);
96 TEST_VLD1_LANE(, int, s, 64, 1, 0);
97 TEST_VLD1_LANE(, uint, u, 8, 8, 7);
98 TEST_VLD1_LANE(, uint, u, 16, 4, 3);
99 TEST_VLD1_LANE(, uint, u, 32, 2, 1);
100 TEST_VLD1_LANE(, uint, u, 64, 1, 0);
Christophe Lyon80902f62013-03-29 16:26:42 +0100101 TEST_VLD1_LANE(, poly, p, 8, 8, 7);
102 TEST_VLD1_LANE(, poly, p, 16, 4, 3);
Christophe Lyon073831a2011-01-24 17:37:40 +0100103 TEST_VLD1_LANE(, float, f, 32, 2, 1);
Christophe Lyond98beba2016-08-24 18:02:41 +0200104#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +0200105 TEST_VLD1_LANE(, float, f, 16, 4, 2);
106#endif
Christophe Lyon073831a2011-01-24 17:37:40 +0100107
108 TEST_VLD1_LANE(q, int, s, 8, 16, 15);
109 TEST_VLD1_LANE(q, int, s, 16, 8, 5);
110 TEST_VLD1_LANE(q, int, s, 32, 4, 2);
111 TEST_VLD1_LANE(q, int, s, 64, 2, 1);
112 TEST_VLD1_LANE(q, uint, u, 8, 16, 12);
113 TEST_VLD1_LANE(q, uint, u, 16, 8, 6);
114 TEST_VLD1_LANE(q, uint, u, 32, 4, 2);
115 TEST_VLD1_LANE(q, uint, u, 64, 2, 0);
Christophe Lyon80902f62013-03-29 16:26:42 +0100116 TEST_VLD1_LANE(q, poly, p, 8, 16, 12);
117 TEST_VLD1_LANE(q, poly, p, 16, 8, 6);
Christophe Lyon073831a2011-01-24 17:37:40 +0100118 TEST_VLD1_LANE(q, float, f, 32, 4, 2);
Christophe Lyond98beba2016-08-24 18:02:41 +0200119#if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
Christophe Lyon34adaf62013-04-11 15:05:18 +0200120 TEST_VLD1_LANE(q, float, f, 16, 8, 5);
121#endif
Christophe Lyon073831a2011-01-24 17:37:40 +0100122
123#ifndef __CC_ARM
124 /* Check runtime assertions. With RVCT, the check is performed at
125 compile-time */
126 // TEST_VLD1_LANE(, int, s, 64, 1, 1);
127#endif
128
129 dump_results_hex (TEST_MSG);
130}