• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 
3 Copyright (c) 2009, 2010, 2011, 2013 STMicroelectronics
4 Written by Christophe Lyon
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23 
24 */
25 
26 #if defined(__arm__) || defined(__aarch64__)
27 #include <arm_neon.h>
28 #else
29 #include "stm-arm-neon.h"
30 #endif
31 
32 #include "stm-arm-neon-ref.h"
33 
34 #define TEST_MSG "VLD1_LANE/VLD1_LANEQ"
exec_vld1_lane(void)35 void 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);
50 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
51   DECL_VARIABLE(vector, float, 16, 4);
52   DECL_VARIABLE(vector, float, 16, 8);
53 #endif
54   DECL_VARIABLE_ALL_VARIANTS(vector_src);
55 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
56   DECL_VARIABLE(vector_src, float, 16, 4);
57   DECL_VARIABLE(vector_src, float, 16, 8);
58 #endif
59 
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);
68   ARRAY(buffer_src, poly, 8, 8);
69   ARRAY(buffer_src, poly, 16, 4);
70   ARRAY(buffer_src, float, 32, 2);
71 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
72   ARRAY(buffer_src, float, 16, 4);
73 #endif
74 
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);
83   ARRAY(buffer_src, poly, 8, 16);
84   ARRAY(buffer_src, poly, 16, 8);
85   ARRAY(buffer_src, float, 32, 4);
86 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
87   ARRAY(buffer_src, float, 16, 8);
88 #endif
89 
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);
101   TEST_VLD1_LANE(, poly, p, 8, 8, 7);
102   TEST_VLD1_LANE(, poly, p, 16, 4, 3);
103   TEST_VLD1_LANE(, float, f, 32, 2, 1);
104 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
105   TEST_VLD1_LANE(, float, f, 16, 4, 2);
106 #endif
107 
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);
116   TEST_VLD1_LANE(q, poly, p, 8, 16, 12);
117   TEST_VLD1_LANE(q, poly, p, 16, 8, 6);
118   TEST_VLD1_LANE(q, float, f, 32, 4, 2);
119 #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) )
120   TEST_VLD1_LANE(q, float, f, 16, 8, 5);
121 #endif
122 
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 }
131