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 | /* Template file for unary operator validation */ |
| 27 | |
| 28 | #ifdef __arm__ |
| 29 | #include <arm_neon.h> |
| 30 | #else |
Christophe Lyon | 0dab5f7 | 2011-07-19 17:14:09 +0200 | [diff] [blame^] | 31 | #include "stm-arm-neon.h" |
Christophe Lyon | 073831a | 2011-01-24 17:37:40 +0100 | [diff] [blame] | 32 | #endif |
| 33 | |
| 34 | #include "stm-arm-neon-ref.h" |
| 35 | |
| 36 | #define INSN_NAME vcreate |
| 37 | #define TEST_MSG "VCREATE" |
| 38 | |
| 39 | #define FNNAME1(NAME) void exec_ ## NAME (void) |
| 40 | #define FNNAME(NAME) FNNAME1(NAME) |
| 41 | |
| 42 | FNNAME (INSN_NAME) |
| 43 | { |
| 44 | /* Basic test: y=vcreate(x), then store the result. */ |
| 45 | #define TEST_VCREATE(T1, T2, W, N) \ |
| 46 | VECT_VAR(vector_res, T1, W, N) = vcreate_##T2##W(VECT_VAR(val, T1, W, N)); \ |
| 47 | vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) |
| 48 | |
| 49 | /* With ARM RVCT, we need to declare variables before any executable |
| 50 | statement */ |
| 51 | |
| 52 | #define DECL_VAL(VAR, T1, W, N) \ |
| 53 | uint64_t VECT_VAR(VAR, T1, W, N) |
| 54 | |
| 55 | DECL_VAL(val, int, 8, 8); |
| 56 | DECL_VAL(val, int, 16, 4); |
| 57 | DECL_VAL(val, int, 32, 2); |
| 58 | DECL_VAL(val, int, 64, 1); |
| 59 | DECL_VAL(val, float, 32, 2); |
| 60 | DECL_VAL(val, uint, 8, 8); |
| 61 | DECL_VAL(val, uint, 16, 4); |
| 62 | DECL_VAL(val, uint, 32, 2); |
| 63 | DECL_VAL(val, uint, 64, 1); |
| 64 | |
| 65 | DECL_VARIABLE(vector_res, int, 8, 8); |
| 66 | DECL_VARIABLE(vector_res, int, 16, 4); |
| 67 | DECL_VARIABLE(vector_res, int, 32, 2); |
| 68 | DECL_VARIABLE(vector_res, int, 64, 1); |
| 69 | DECL_VARIABLE(vector_res, float, 32, 2); |
| 70 | DECL_VARIABLE(vector_res, uint, 8, 8); |
| 71 | DECL_VARIABLE(vector_res, uint, 16, 4); |
| 72 | DECL_VARIABLE(vector_res, uint, 32, 2); |
| 73 | DECL_VARIABLE(vector_res, uint, 64, 1); |
| 74 | |
| 75 | clean_results (); |
| 76 | |
| 77 | /* Initialize input values arbitrarily */ |
| 78 | VECT_VAR(val, int, 8, 8) = 0x123456789abcdef0LL; |
| 79 | VECT_VAR(val, int, 16, 4) = 0x123456789abcdef0LL; |
| 80 | VECT_VAR(val, int, 32, 2) = 0x123456789abcdef0LL; |
| 81 | VECT_VAR(val, int, 64, 1) = 0x123456789abcdef0LL; |
| 82 | VECT_VAR(val, float, 32, 2) = 0x123456789abcdef0LL; |
| 83 | VECT_VAR(val, uint, 8, 8) = 0x123456789abcdef0ULL; |
| 84 | VECT_VAR(val, uint, 16, 4) = 0x123456789abcdef0ULL; |
| 85 | VECT_VAR(val, uint, 32, 2) = 0x123456789abcdef0ULL; |
| 86 | VECT_VAR(val, uint, 64, 1) = 0x123456789abcdef0ULL; |
| 87 | |
| 88 | TEST_VCREATE(int, s, 8, 8); |
| 89 | TEST_VCREATE(int, s, 16, 4); |
| 90 | TEST_VCREATE(int, s, 32, 2); |
| 91 | TEST_VCREATE(float, f, 32, 2); |
| 92 | TEST_VCREATE(int, s, 64, 1); |
| 93 | TEST_VCREATE(uint, u, 8, 8); |
| 94 | TEST_VCREATE(uint, u, 16, 4); |
| 95 | TEST_VCREATE(uint, u, 32, 2); |
| 96 | TEST_VCREATE(uint, u, 64, 1); |
| 97 | |
| 98 | dump_results_hex (TEST_MSG); |
| 99 | } |