Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 1 | /* |
| 2 | |
Christophe Lyon | 80902f6 | 2013-03-29 16:26:42 +0100 | [diff] [blame] | 3 | Copyright (c) 2009, 2010, 2011, 2013 STMicroelectronics |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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 | |
Christophe Lyon | 1775be0 | 2014-07-10 13:46:54 +0200 | [diff] [blame] | 26 | #if defined(__arm__) || defined(__aarch64__) |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 50 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 51 | DECL_VARIABLE(vector, float, 16, 4); |
| 52 | DECL_VARIABLE(vector, float, 16, 8); |
| 53 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 54 | DECL_VARIABLE_ALL_VARIANTS(vector_src); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 55 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 56 | DECL_VARIABLE(vector_src, float, 16, 4); |
| 57 | DECL_VARIABLE(vector_src, float, 16, 8); |
| 58 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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); |
Christophe Lyon | 80902f6 | 2013-03-29 16:26:42 +0100 | [diff] [blame] | 68 | ARRAY(buffer_src, poly, 8, 8); |
| 69 | ARRAY(buffer_src, poly, 16, 4); |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 70 | ARRAY(buffer_src, float, 32, 2); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 71 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 72 | ARRAY(buffer_src, float, 16, 4); |
| 73 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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); |
Christophe Lyon | 80902f6 | 2013-03-29 16:26:42 +0100 | [diff] [blame] | 83 | ARRAY(buffer_src, poly, 8, 16); |
| 84 | ARRAY(buffer_src, poly, 16, 8); |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 85 | ARRAY(buffer_src, float, 32, 4); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 86 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 87 | ARRAY(buffer_src, float, 16, 8); |
| 88 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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); |
Christophe Lyon | 80902f6 | 2013-03-29 16:26:42 +0100 | [diff] [blame] | 101 | TEST_VLD1_LANE(, poly, p, 8, 8, 7); |
| 102 | TEST_VLD1_LANE(, poly, p, 16, 4, 3); |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 103 | TEST_VLD1_LANE(, float, f, 32, 2, 1); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 104 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 105 | TEST_VLD1_LANE(, float, f, 16, 4, 2); |
| 106 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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); |
Christophe Lyon | 80902f6 | 2013-03-29 16:26:42 +0100 | [diff] [blame] | 116 | TEST_VLD1_LANE(q, poly, p, 8, 16, 12); |
| 117 | TEST_VLD1_LANE(q, poly, p, 16, 8, 6); |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 118 | TEST_VLD1_LANE(q, float, f, 32, 4, 2); |
Christophe Lyon | d98beba | 2016-08-24 18:02:41 +0200 | [diff] [blame] | 119 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) |
Christophe Lyon | 34adaf6 | 2013-04-11 15:05:18 +0200 | [diff] [blame] | 120 | TEST_VLD1_LANE(q, float, f, 16, 8, 5); |
| 121 | #endif |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 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 | } |