Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 1 | /* |
| 2 | |
| 3 | Copyright (c) 2009, 2010, 2011 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 | #ifdef __arm__ |
| 27 | #include <arm_neon.h> |
| 28 | #else |
Christophe Lyon | 0dab5f7 | 2011-07-19 17:14:09 +0200 | [diff] [blame^] | 29 | #include "stm-arm-neon.h" |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #include "stm-arm-neon-ref.h" |
| 33 | |
| 34 | #define TEST_MSG "VLD1_LANE/VLD1_LANEQ" |
| 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 | DECL_VARIABLE_ALL_VARIANTS(vector_src); |
| 51 | |
| 52 | ARRAY(buffer_src, int, 8, 8); |
| 53 | ARRAY(buffer_src, int, 16, 4); |
| 54 | ARRAY(buffer_src, int, 32, 2); |
| 55 | ARRAY(buffer_src, int, 64, 1); |
| 56 | ARRAY(buffer_src, uint, 8, 8); |
| 57 | ARRAY(buffer_src, uint, 16, 4); |
| 58 | ARRAY(buffer_src, uint, 32, 2); |
| 59 | ARRAY(buffer_src, uint, 64, 1); |
| 60 | ARRAY(buffer_src, float, 32, 2); |
| 61 | |
| 62 | ARRAY(buffer_src, int, 8, 16); |
| 63 | ARRAY(buffer_src, int, 16, 8); |
| 64 | ARRAY(buffer_src, int, 32, 4); |
| 65 | ARRAY(buffer_src, int, 64, 2); |
| 66 | ARRAY(buffer_src, uint, 8, 16); |
| 67 | ARRAY(buffer_src, uint, 16, 8); |
| 68 | ARRAY(buffer_src, uint, 32, 4); |
| 69 | ARRAY(buffer_src, uint, 64, 2); |
| 70 | ARRAY(buffer_src, float, 32, 4); |
| 71 | |
| 72 | clean_results (); |
| 73 | |
| 74 | /* Choose lane arbitrarily */ |
| 75 | TEST_VLD1_LANE(, int, s, 8, 8, 6); |
| 76 | TEST_VLD1_LANE(, int, s, 16, 4, 3); |
| 77 | TEST_VLD1_LANE(, int, s, 32, 2, 1); |
| 78 | TEST_VLD1_LANE(, int, s, 64, 1, 0); |
| 79 | TEST_VLD1_LANE(, uint, u, 8, 8, 7); |
| 80 | TEST_VLD1_LANE(, uint, u, 16, 4, 3); |
| 81 | TEST_VLD1_LANE(, uint, u, 32, 2, 1); |
| 82 | TEST_VLD1_LANE(, uint, u, 64, 1, 0); |
| 83 | TEST_VLD1_LANE(, float, f, 32, 2, 1); |
| 84 | |
| 85 | TEST_VLD1_LANE(q, int, s, 8, 16, 15); |
| 86 | TEST_VLD1_LANE(q, int, s, 16, 8, 5); |
| 87 | TEST_VLD1_LANE(q, int, s, 32, 4, 2); |
| 88 | TEST_VLD1_LANE(q, int, s, 64, 2, 1); |
| 89 | TEST_VLD1_LANE(q, uint, u, 8, 16, 12); |
| 90 | TEST_VLD1_LANE(q, uint, u, 16, 8, 6); |
| 91 | TEST_VLD1_LANE(q, uint, u, 32, 4, 2); |
| 92 | TEST_VLD1_LANE(q, uint, u, 64, 2, 0); |
| 93 | TEST_VLD1_LANE(q, float, f, 32, 4, 2); |
| 94 | |
| 95 | #ifndef __CC_ARM |
| 96 | /* Check runtime assertions. With RVCT, the check is performed at |
| 97 | compile-time */ |
| 98 | // TEST_VLD1_LANE(, int, s, 64, 1, 1); |
| 99 | #endif |
| 100 | |
| 101 | dump_results_hex (TEST_MSG); |
| 102 | } |