├── .travis.yml ├── Init.s ├── InitCache.s ├── LICENSE ├── Makefile ├── Makefile.gcc ├── README ├── armscript.inc ├── compute_ref.axf ├── compute_ref.c ├── compute_ref.gccarm ├── compute_ref.gccarm-rvct ├── compute_ref_data.c ├── expected_input4gcc-nofp16.txt ├── expected_input4gcc.txt ├── license.html ├── ref-rvct-all.txt ├── ref-rvct-neon-nofp16.txt ├── ref-rvct-neon.txt ├── ref_dsp.c ├── ref_dspfns.c ├── ref_integer.c ├── ref_v_binary_op.c ├── ref_v_binary_sat_op.c ├── ref_v_comp_f_op.c ├── ref_v_comp_op.c ├── ref_v_unary_op.c ├── ref_v_unary_sat_op.c ├── ref_vaba.c ├── ref_vabal.c ├── ref_vabd.c ├── ref_vabdl.c ├── ref_vabs.c ├── ref_vadd.c ├── ref_vaddhn.c ├── ref_vaddl.c ├── ref_vaddw.c ├── ref_vand.c ├── ref_vbic.c ├── ref_vbsl.c ├── ref_vcage.c ├── ref_vcagt.c ├── ref_vcale.c ├── ref_vcalt.c ├── ref_vceq.c ├── ref_vcge.c ├── ref_vcgt.c ├── ref_vcle.c ├── ref_vcls.c ├── ref_vclt.c ├── ref_vclz.c ├── ref_vcnt.c ├── ref_vcombine.c ├── ref_vcreate.c ├── ref_vcvt.c ├── ref_vdup.c ├── ref_vdup_lane.c ├── ref_veor.c ├── ref_vext.c ├── ref_vget_high.c ├── ref_vget_lane.c ├── ref_vget_low.c ├── ref_vhadd.c ├── ref_vhsub.c ├── ref_vld1.c ├── ref_vld1_dup.c ├── ref_vld1_lane.c ├── ref_vldX.c ├── ref_vldX_dup.c ├── ref_vldX_lane.c ├── ref_vmax.c ├── ref_vmin.c ├── ref_vmla.c ├── ref_vmla_lane.c ├── ref_vmla_n.c ├── ref_vmlal.c ├── ref_vmlal_lane.c ├── ref_vmlal_n.c ├── ref_vmls.c ├── ref_vmls_lane.c ├── ref_vmls_n.c ├── ref_vmlsl.c ├── ref_vmlsl_lane.c ├── ref_vmlsl_n.c ├── ref_vmovl.c ├── ref_vmovn.c ├── ref_vmul.c ├── ref_vmul_lane.c ├── ref_vmul_n.c ├── ref_vmull.c ├── ref_vmull_lane.c ├── ref_vmull_n.c ├── ref_vmvn.c ├── ref_vneg.c ├── ref_vorn.c ├── ref_vorr.c ├── ref_vpadal.c ├── ref_vpadd.c ├── ref_vpaddl.c ├── ref_vpmax.c ├── ref_vpmin.c ├── ref_vqabs.c ├── ref_vqadd.c ├── ref_vqdmlal.c ├── ref_vqdmlal_lane.c ├── ref_vqdmlal_n.c ├── ref_vqdmlsl.c ├── ref_vqdmlsl_lane.c ├── ref_vqdmlsl_n.c ├── ref_vqdmulh.c ├── ref_vqdmulh_lane.c ├── ref_vqdmulh_n.c ├── ref_vqdmull.c ├── ref_vqdmull_lane.c ├── ref_vqdmull_n.c ├── ref_vqmovn.c ├── ref_vqmovun.c ├── ref_vqneg.c ├── ref_vqrdmulh.c ├── ref_vqrdmulh_lane.c ├── ref_vqrdmulh_n.c ├── ref_vqrshl.c ├── ref_vqrshrn_n.c ├── ref_vqrshrun_n.c ├── ref_vqshl.c ├── ref_vqshl_n.c ├── ref_vqshlu_n.c ├── ref_vqshrn_n.c ├── ref_vqshrun_n.c ├── ref_vqsub.c ├── ref_vraddhn.c ├── ref_vrecpe.c ├── ref_vrecps.c ├── ref_vreinterpret.c ├── ref_vrev.c ├── ref_vrhadd.c ├── ref_vrshl.c ├── ref_vrshr_n.c ├── ref_vrshrn_n.c ├── ref_vrsqrte.c ├── ref_vrsqrts.c ├── ref_vrsra_n.c ├── ref_vrsubhn.c ├── ref_vsXi_n.c ├── ref_vset_lane.c ├── ref_vshl.c ├── ref_vshl_n.c ├── ref_vshll_n.c ├── ref_vshr_n.c ├── ref_vshrn_n.c ├── ref_vsli_n.c ├── ref_vsra_n.c ├── ref_vsri_n.c ├── ref_vst1_lane.c ├── ref_vstX_lane.c ├── ref_vsub.c ├── ref_vsubhn.c ├── ref_vsubl.c ├── ref_vsubw.c ├── ref_vtbX.c ├── ref_vtrn.c ├── ref_vtst.c ├── ref_vuzp.c ├── ref_vzip.c ├── retarget.c ├── scatter.scat └── stm-arm-neon-ref.h /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | dist: trusty 3 | sudo: required 4 | before_install: 5 | - sudo apt-get update -qq 6 | - sudo apt-get install -qq make gcc-arm-none-eabi qemu-user 7 | 8 | env: 9 | matrix: 10 | - OPTIMIZE_INTRINSICS=0 11 | - OPTIMIZE_INTRINSICS=1 12 | 13 | script: make -f Makefile.gcc clean && make -f Makefile.gcc compute_ref.gccarm OPTIMIZE_INTRINSICS=${OPTIMIZE_INTRINSICS} && qemu-arm -cpu cortex-a9 compute_ref.gccarm && diff stm-arm-neon.gccarm ref-rvct-neon-nofp16.txt 14 | 15 | notifications: 16 | email: 17 | on_success: always 18 | recipients: 19 | - christophelyon@gmail.com 20 | -------------------------------------------------------------------------------- /InitCache.s: -------------------------------------------------------------------------------- 1 | ; Copyright ARM Ltd 2005. All rights reserved. 2 | 3 | ;================================================================== 4 | ; This code provides basic global enable for a Cortex-A8 cache 5 | ; and program flow prediction 6 | ; This code must be run from a privileged mode 7 | ;================================================================== 8 | 9 | AREA CORTEXA8CACHE, CODE, READONLY 10 | EXPORT core_init 11 | 12 | core_init 13 | 14 | ;================================================================== 15 | ; Global Enable for Cortex-A8 Instruction and Data Caching 16 | ;================================================================== 17 | 18 | MRC p15, 0, r0, c1, c0, 0 ; read CP15 register 1 into r0 19 | ORR r0, r0, #(0x1 <<12) ; enable I Cache 20 | ;BIC r0, r0, #(0x1 <<12) ; Clear bit 0 21 | ORR r0, r0, #(0x1 <<2) ; enable D Cache 22 | ;BIC r0, r0, #(0x1 << 2) ; Clear bit 0 23 | ORR r0, r0, #0x1 ; enable MMU 24 | MCR p15, 0, r0, c1, c0, 0 ; write CP15 register 1 25 | 26 | ;================================================================== 27 | ; Enable Cortex-A8 Level2 Unified Cache 28 | ;================================================================== 29 | 30 | MRC p15, 0, r0, c1, c0, 1 ; Read Auxiliary Control Register 31 | ORR r0, r0, #2 ; L2EN bit, enable L2 cache 32 | ;BIC r0, r0, #(0x1 << 1) ; L2EN bit, disable L2 cache 33 | ;ORR r0, r0, #(0x1 << 4) ;Enables speculative accesses on AXI 34 | ORR r0, r0, #(0x1 << 4) ;Enables speculative accesses on AXI 35 | ORR r0, r0, #(0x1 << 5) ;Enables caching NEON data within the L1 data cache 36 | MCR p15, 0, r0, c1, c0, 1 ; Write Auxiliary Control Register 37 | 38 | ;================================================================== 39 | ; Cortex-A8 program flow prediction 40 | ;================================================================== 41 | 42 | MRC p15, 0, r0, c1, c0, 0 ; read CP15 register 1 into r0 43 | ORR r0, r0, #(0x1 <<11) ; Enable all forms of branch prediction 44 | ;BIC r0, r0, #(0x1 << 11) ; Disable all forms of branch prediction 45 | MCR p15, 0, r0, c1, c0, 0 ; write CP15 register 1 46 | 47 | ;================================================================== 48 | 49 | BX lr 50 | 51 | END ; mark the end of this file 52 | 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | License: 3 | -------- 4 | All files are covered by the MIT license, except for: 5 | retarget.c 6 | Init.s 7 | InitCache.s 8 | scatter.scat 9 | which are covered by ARM's EULA regarding "EXAMPLE CODE", as described 10 | in license.html. 11 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ARM Neon reference tests 2 | ======================== 3 | This package contains extensive tests for the ARM/Neon instructions. 4 | 5 | It works by building a program which uses all of them, and then 6 | executing it on an actual target or a simulator. 7 | 8 | It can be used to validate the simulator against an actual HW target, 9 | or to validate C compilers in presence of Neon intrinsics calls. 10 | 11 | The supplied Makefile enables to build with both ARM RVCT compiler and 12 | GNU GCC (for the ARM target), and supports execution with ARM RVDEBUG 13 | on an ARM simulator and with QEMU. 14 | 15 | For convenience, the ARM ELF binary file (as compiled with RVCT) is 16 | supplied (compute_ref.axf), as well as expected output (ref-rvct.txt). 17 | 18 | A second file containing expected output is also supplied: 19 | ref-rvct-neon.txt, which contains only the results of the Neon 20 | instrinsics tests. It is aimed at being used to check GCC's results, 21 | since this compiler does not support the integer & dsp builtins whose 22 | results are also present in ref-rvct.txt. 23 | 24 | Typical usage when used to debug QEmu: 25 | $ make all # to build the test program with ARM rvct and execute with QEmu 26 | $ make check # to compare the results with the expected output 27 | 28 | 29 | Known issues: 30 | ------------- 31 | Some tests currently fail to build with GCC/ARM: 32 | - missing include files: dspfns.h, armdsp.h 33 | 34 | As GCC/ARM provides no support for the 35 | Neon_Cumulative_Saturation/fpsrc register, auxiliary accessor 36 | functions have been implemented in stm-arm-neon-ref.h. 37 | 38 | Engineering: 39 | ------------ 40 | In order to cover all the Neon instructions extensively, these tests 41 | make intensive use of the C-preprocessor, to save maintenance efforts. 42 | 43 | Most tests (the more regular ones) share a common basic structure. In 44 | general, variable names are suffixed by their type name, so as to 45 | differentiate variables with the same purpose but of differente types. 46 | Hence vector1_int8x8, vector1_int16x4 etc... 47 | 48 | For instance in ref_vmul.c the layout of the code is as follows: 49 | 50 | - declare input and output vectors (named 'vector1', 'vector2' and 51 | 'vector_res') of each possible type (s/u, 8/16/32/64 bits). 52 | 53 | - clean the result buffers. 54 | 55 | - initialize input vectors 'vector1' and 'vector2'. 56 | 57 | - call each variant of the intrinsic and store the result in a buffer 58 | named 'buffer', whose contents is printed after execution. 59 | 60 | One can then compare the actual result with the expected one. 61 | -------------------------------------------------------------------------------- /armscript.inc: -------------------------------------------------------------------------------- 1 | ERROR=ABORT // Abort if error occurs when processing the script 2 | WAIT=ON // Wait for each command to finish 3 | 4 | GO 5 | 6 | STATS 7 | 8 | //STDIOLOG OFF // Close the log file 9 | 10 | //UNLOAD 1 // Unload the image 11 | //DELFILE 1 // Remove the symbol definitions 12 | //DISCONNECT // Disconnect from the target 13 | //WAIT=OFF 14 | QUIT Y 15 | -------------------------------------------------------------------------------- /compute_ref.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/christophe-lyon/arm-neon-tests/2d60620d1a570acf2e4f803c1d0ebd0e6ffabe9a/compute_ref.axf -------------------------------------------------------------------------------- /compute_ref.gccarm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/christophe-lyon/arm-neon-tests/2d60620d1a570acf2e4f803c1d0ebd0e6ffabe9a/compute_ref.gccarm -------------------------------------------------------------------------------- /compute_ref.gccarm-rvct: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/christophe-lyon/arm-neon-tests/2d60620d1a570acf2e4f803c1d0ebd0e6ffabe9a/compute_ref.gccarm-rvct -------------------------------------------------------------------------------- /ref_v_binary_op.c: -------------------------------------------------------------------------------- 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 binary operator validation */ 27 | 28 | #if defined(__arm__) || defined(__aarch64__) 29 | #include 30 | #else 31 | #include "stm-arm-neon.h" 32 | #endif 33 | 34 | #include "stm-arm-neon-ref.h" 35 | 36 | #define FNNAME1(NAME) void exec_ ## NAME (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN_NAME) 40 | { 41 | /* Basic test: y=OP(x,x), then store the result. */ 42 | #define TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ 43 | VECT_VAR(vector_res, T1, W, N) = \ 44 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ 45 | VECT_VAR(vector2, T1, W, N)); \ 46 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 47 | 48 | #define TEST_BINARY_OP(INSN, Q, T1, T2, W, N) \ 49 | TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ 50 | 51 | /* With ARM RVCT, we need to declare variables before any executable 52 | statement */ 53 | DECL_VARIABLE_ALL_VARIANTS(vector); 54 | DECL_VARIABLE_ALL_VARIANTS(vector2); 55 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 56 | 57 | clean_results (); 58 | 59 | /* Initialize input "vector" from "buffer" */ 60 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 61 | 62 | /* Fill input vector2 with arbitrary values */ 63 | VDUP(vector2, , int, s, 8, 8, 2); 64 | VDUP(vector2, , int, s, 16, 4, -4); 65 | VDUP(vector2, , int, s, 32, 2, 3); 66 | VDUP(vector2, , int, s, 64, 1, 100); 67 | VDUP(vector2, , uint, u, 8, 8, 20); 68 | VDUP(vector2, , uint, u, 16, 4, 30); 69 | VDUP(vector2, , uint, u, 32, 2, 40); 70 | VDUP(vector2, , uint, u, 64, 1, 2); 71 | VDUP(vector2, q, int, s, 8, 16, -10); 72 | VDUP(vector2, q, int, s, 16, 8, -20); 73 | VDUP(vector2, q, int, s, 32, 4, -30); 74 | VDUP(vector2, q, int, s, 64, 2, 24); 75 | VDUP(vector2, q, uint, u, 8, 16, 12); 76 | VDUP(vector2, q, uint, u, 16, 8, 3); 77 | VDUP(vector2, q, uint, u, 32, 4, 55); 78 | VDUP(vector2, q, uint, u, 64, 2, 3); 79 | 80 | /* Apply a binary operator named INSN_NAME */ 81 | TEST_MACRO_ALL_VARIANTS_1_5(TEST_BINARY_OP, INSN_NAME); 82 | 83 | dump_results_hex (TEST_MSG); 84 | 85 | #ifdef EXTRA_TESTS 86 | EXTRA_TESTS(); 87 | #endif 88 | } 89 | -------------------------------------------------------------------------------- /ref_v_comp_f_op.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | 35 | #define FNNAME1(NAME) void exec_ ## NAME (void) 36 | #define FNNAME(NAME) FNNAME1(NAME) 37 | 38 | FNNAME (INSN_NAME) 39 | { 40 | int i; 41 | 42 | /* Basic test: y=vcomp(x,x), then store the result. */ 43 | #define TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) \ 44 | VECT_VAR(vector_res, T3, W, N) = \ 45 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ 46 | VECT_VAR(vector2, T1, W, N)); \ 47 | vst1##Q##_u##W(VECT_VAR(result, T3, W, N), VECT_VAR(vector_res, T3, W, N)) 48 | 49 | #define TEST_VCOMP(INSN, Q, T1, T2, T3, W, N) \ 50 | TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) 51 | 52 | /* With ARM RVCT, we need to declare variables before any executable 53 | statement */ 54 | DECL_VARIABLE(vector, float, 32, 2); 55 | DECL_VARIABLE(vector, float, 32, 4); 56 | DECL_VARIABLE(vector2, float, 32, 2); 57 | DECL_VARIABLE(vector2, float, 32, 4); 58 | DECL_VARIABLE(vector_res, uint, 32, 2); 59 | DECL_VARIABLE(vector_res, uint, 32, 4); 60 | 61 | clean_results (); 62 | 63 | VLOAD(vector, buffer, , float, f, 32, 2); 64 | VLOAD(vector, buffer, q, float, f, 32, 4); 65 | 66 | /* Choose init value arbitrarily, will be used for vector 67 | comparison */ 68 | VDUP(vector2, , float, f, 32, 2, -16.0f); 69 | VDUP(vector2, q, float, f, 32, 4, -14.0f); 70 | 71 | fprintf(ref_file, "\n%s output:\n", TEST_MSG); 72 | fprintf(gcc_tests_file, "\n%s output:\n", TEST_MSG); 73 | TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2); 74 | DUMP(TEST_MSG, uint, 32, 2, PRIx32); 75 | 76 | TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4); 77 | DUMP(TEST_MSG, uint, 32, 4, PRIx32); 78 | 79 | VDUP(vector2, , float, f, 32, 2, -10.0f); 80 | VDUP(vector2, q, float, f, 32, 4, 10.0f); 81 | 82 | fprintf(ref_file, "\n%s output:\n", TEST_MSG); 83 | fprintf(gcc_tests_file, "\n%s output:\n", TEST_MSG); 84 | TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2); 85 | DUMP(TEST_MSG, uint, 32, 2, PRIx32); 86 | 87 | TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4); 88 | DUMP(TEST_MSG, uint, 32, 4, PRIx32); 89 | } 90 | -------------------------------------------------------------------------------- /ref_v_unary_op.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 29 | #include 30 | #else 31 | #include "stm-arm-neon.h" 32 | #endif 33 | 34 | #include "stm-arm-neon-ref.h" 35 | 36 | #define FNNAME1(NAME) void exec_ ## NAME (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN_NAME) 40 | { 41 | /* Basic test: y=OP(x), then store the result. */ 42 | #define TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ 43 | VECT_VAR(vector_res, T1, W, N) = \ 44 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ 45 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 46 | 47 | #define TEST_UNARY_OP(INSN, Q, T1, T2, W, N) \ 48 | TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ 49 | 50 | /* With ARM RVCT, we need to declare variables before any executable 51 | statement */ 52 | 53 | /* No need for 64 bits variants */ 54 | DECL_VARIABLE(vector, int, 8, 8); 55 | DECL_VARIABLE(vector, int, 16, 4); 56 | DECL_VARIABLE(vector, int, 32, 2); 57 | DECL_VARIABLE(vector, int, 8, 16); 58 | DECL_VARIABLE(vector, int, 16, 8); 59 | DECL_VARIABLE(vector, int, 32, 4); 60 | 61 | DECL_VARIABLE(vector_res, int, 8, 8); 62 | DECL_VARIABLE(vector_res, int, 16, 4); 63 | DECL_VARIABLE(vector_res, int, 32, 2); 64 | DECL_VARIABLE(vector_res, int, 8, 16); 65 | DECL_VARIABLE(vector_res, int, 16, 8); 66 | DECL_VARIABLE(vector_res, int, 32, 4); 67 | 68 | clean_results (); 69 | 70 | /* Initialize input "vector" from "buffer" */ 71 | VLOAD(vector, buffer, , int, s, 8, 8); 72 | VLOAD(vector, buffer, , int, s, 16, 4); 73 | VLOAD(vector, buffer, , int, s, 32, 2); 74 | VLOAD(vector, buffer, q, int, s, 8, 16); 75 | VLOAD(vector, buffer, q, int, s, 16, 8); 76 | VLOAD(vector, buffer, q, int, s, 32, 4); 77 | 78 | /* Apply a unary operator named INSN_NAME */ 79 | TEST_UNARY_OP(INSN_NAME, , int, s, 8, 8); 80 | TEST_UNARY_OP(INSN_NAME, , int, s, 16, 4); 81 | TEST_UNARY_OP(INSN_NAME, , int, s, 32, 2); 82 | TEST_UNARY_OP(INSN_NAME, q, int, s, 8, 16); 83 | TEST_UNARY_OP(INSN_NAME, q, int, s, 16, 8); 84 | TEST_UNARY_OP(INSN_NAME, q, int, s, 32, 4); 85 | 86 | dump_results_hex (TEST_MSG); 87 | 88 | #ifdef EXTRA_TESTS 89 | EXTRA_TESTS(); 90 | #endif 91 | } 92 | -------------------------------------------------------------------------------- /ref_v_unary_sat_op.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 saturating operator validation */ 27 | 28 | #if defined(__arm__) || defined(__aarch64__) 29 | #include 30 | #else 31 | #include "stm-arm-neon.h" 32 | #endif 33 | 34 | #include "stm-arm-neon-ref.h" 35 | 36 | #define FNNAME1(NAME) void exec_ ## NAME (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN_NAME) 40 | { 41 | /* Basic test: y=OP(x), then store the result. */ 42 | #define TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N) \ 43 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ 44 | VECT_VAR(vector_res, T1, W, N) = \ 45 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ 46 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ 47 | VECT_VAR(vector_res, T1, W, N)); \ 48 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##Q##_##T2##W), \ 49 | xSTR(T1), W, N) 50 | 51 | #define TEST_UNARY_SAT_OP(INSN, Q, T1, T2, W, N) \ 52 | TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N) 53 | 54 | /* With ARM RVCT, we need to declare variables before any executable 55 | statement */ 56 | 57 | /* No need for 64 bits variants */ 58 | DECL_VARIABLE(vector, int, 8, 8); 59 | DECL_VARIABLE(vector, int, 16, 4); 60 | DECL_VARIABLE(vector, int, 32, 2); 61 | DECL_VARIABLE(vector, int, 8, 16); 62 | DECL_VARIABLE(vector, int, 16, 8); 63 | DECL_VARIABLE(vector, int, 32, 4); 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, 8, 16); 69 | DECL_VARIABLE(vector_res, int, 16, 8); 70 | DECL_VARIABLE(vector_res, int, 32, 4); 71 | 72 | clean_results (); 73 | 74 | /* Initialize input "vector" from "buffer" */ 75 | VLOAD(vector, buffer, , int, s, 8, 8); 76 | VLOAD(vector, buffer, , int, s, 16, 4); 77 | VLOAD(vector, buffer, , int, s, 32, 2); 78 | VLOAD(vector, buffer, q, int, s, 8, 16); 79 | VLOAD(vector, buffer, q, int, s, 16, 8); 80 | VLOAD(vector, buffer, q, int, s, 32, 4); 81 | 82 | /* Apply a unary operator named INSN_NAME */ 83 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 84 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8); 85 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4); 86 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2); 87 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16); 88 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8); 89 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4); 90 | 91 | dump_results_hex (TEST_MSG); 92 | 93 | #ifdef EXTRA_TESTS 94 | EXTRA_TESTS(); 95 | #endif 96 | } 97 | -------------------------------------------------------------------------------- /ref_vabdl.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VABDL" 35 | void exec_vabdl (void) 36 | { 37 | /* Basic test: v4=vabdl(v1,v2), then store the result. */ 38 | #define TEST_VABDL(T1, T2, W, W2, N) \ 39 | VECT_VAR(vector_res, T1, W2, N) = \ 40 | vabdl_##T2##W(VECT_VAR(vector1, T1, W, N), \ 41 | VECT_VAR(vector2, T1, W, N)); \ 42 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | #define DECL_VABDL_VAR_LONG(VAR) \ 47 | DECL_VARIABLE(VAR, int, 16, 8); \ 48 | DECL_VARIABLE(VAR, int, 32, 4); \ 49 | DECL_VARIABLE(VAR, int, 64, 2); \ 50 | DECL_VARIABLE(VAR, uint, 16, 8); \ 51 | DECL_VARIABLE(VAR, uint, 32, 4); \ 52 | DECL_VARIABLE(VAR, uint, 64, 2) 53 | 54 | #define DECL_VABDL_VAR_SHORT(VAR) \ 55 | DECL_VARIABLE(VAR, int, 8, 8); \ 56 | DECL_VARIABLE(VAR, int, 16, 4); \ 57 | DECL_VARIABLE(VAR, int, 32, 2); \ 58 | DECL_VARIABLE(VAR, uint, 8, 8); \ 59 | DECL_VARIABLE(VAR, uint, 16, 4); \ 60 | DECL_VARIABLE(VAR, uint, 32, 2) 61 | 62 | DECL_VABDL_VAR_SHORT(vector1); 63 | DECL_VABDL_VAR_SHORT(vector2); 64 | DECL_VABDL_VAR_LONG(vector_res); 65 | 66 | clean_results (); 67 | 68 | /* Initialize input "vector" from "buffer" */ 69 | VLOAD(vector1, buffer, , int, s, 8, 8); 70 | VLOAD(vector1, buffer, , int, s, 16, 4); 71 | VLOAD(vector1, buffer, , int, s, 32, 2); 72 | VLOAD(vector1, buffer, , uint, u, 8, 8); 73 | VLOAD(vector1, buffer, , uint, u, 16, 4); 74 | VLOAD(vector1, buffer, , uint, u, 32, 2); 75 | 76 | 77 | /* Choose init value arbitrarily */ 78 | VDUP(vector2, , int, s, 8, 8, 1); 79 | VDUP(vector2, , int, s, 16, 4, -13); 80 | VDUP(vector2, , int, s, 32, 2, 8); 81 | VDUP(vector2, , uint, u, 8, 8, 1); 82 | VDUP(vector2, , uint, u, 16, 4, 13); 83 | VDUP(vector2, , uint, u, 32, 2, 8); 84 | 85 | TEST_VABDL(int, s, 8, 16, 8); 86 | TEST_VABDL(int, s, 16, 32, 4); 87 | TEST_VABDL(int, s, 32, 64, 2); 88 | TEST_VABDL(uint, u, 8, 16, 8); 89 | TEST_VABDL(uint, u, 16, 32, 4); 90 | TEST_VABDL(uint, u, 32, 64, 2); 91 | 92 | dump_results_hex (TEST_MSG); 93 | } 94 | -------------------------------------------------------------------------------- /ref_vabs.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vabs 27 | #define TEST_MSG "VABS/VABSQ" 28 | 29 | /* Extra tests for functions requiring floating-point types */ 30 | void exec_vabs_f32(void); 31 | #define EXTRA_TESTS exec_vabs_f32 32 | 33 | #include "ref_v_unary_op.c" 34 | 35 | void exec_vabs_f32(void) 36 | { 37 | int i; 38 | 39 | DECL_VARIABLE(vector, float, 32, 2); 40 | DECL_VARIABLE(vector, float, 32, 4); 41 | 42 | DECL_VARIABLE(vector_res, float, 32, 2); 43 | DECL_VARIABLE(vector_res, float, 32, 4); 44 | 45 | VDUP(vector, , float, f, 32, 2, -2.3f); 46 | VDUP(vector, q, float, f, 32, 4, 3.4f); 47 | 48 | TEST_UNARY_OP(INSN_NAME, , float, f, 32, 2); 49 | TEST_UNARY_OP(INSN_NAME, q, float, f, 32, 4); 50 | 51 | fprintf(ref_file, "\nfloat32:\n"); 52 | DUMP_FP(TEST_MSG, float, 32, 2, PRIx32); 53 | DUMP_FP(TEST_MSG, float, 32, 4, PRIx32); 54 | } 55 | -------------------------------------------------------------------------------- /ref_vadd.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vadd 27 | #define TEST_MSG "VADD/VADDQ" 28 | 29 | /* Extra tests for functions requiring floating-point types */ 30 | void exec_vadd_f32(void); 31 | #define EXTRA_TESTS exec_vadd_f32 32 | 33 | #include "ref_v_binary_op.c" 34 | 35 | void exec_vadd_f32(void) 36 | { 37 | int i; 38 | 39 | DECL_VARIABLE(vector, float, 32, 2); 40 | DECL_VARIABLE(vector, float, 32, 4); 41 | 42 | DECL_VARIABLE(vector2, float, 32, 2); 43 | DECL_VARIABLE(vector2, float, 32, 4); 44 | 45 | DECL_VARIABLE(vector_res, float, 32, 2); 46 | DECL_VARIABLE(vector_res, float, 32, 4); 47 | 48 | VDUP(vector, , float, f, 32, 2, 2.3f); 49 | VDUP(vector, q, float, f, 32, 4, 3.4f); 50 | 51 | VDUP(vector2, , float, f, 32, 2, 4.5f); 52 | VDUP(vector2, q, float, f, 32, 4, 5.6f); 53 | 54 | TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2); 55 | TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4); 56 | 57 | fprintf(ref_file, "\nfloat32:\n"); 58 | DUMP_FP(TEST_MSG, float, 32, 2, PRIx32); 59 | DUMP_FP(TEST_MSG, float, 32, 4, PRIx32); 60 | } 61 | -------------------------------------------------------------------------------- /ref_vaddhn.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #if defined(__cplusplus) 35 | #include 36 | #else 37 | #if defined(_MSC_VER) 38 | #include "msstdint.h" 39 | #else 40 | #include 41 | #endif 42 | #endif 43 | 44 | #ifndef INSN_NAME 45 | #define INSN_NAME vaddhn 46 | #define TEST_MSG "VADDHN" 47 | #endif 48 | 49 | #define FNNAME1(NAME) void exec_ ## NAME (void) 50 | #define FNNAME(NAME) FNNAME1(NAME) 51 | 52 | FNNAME (INSN_NAME) 53 | { 54 | /* Basic test: vec64=vaddhn(vec128_a, vec128_b), then store the result. */ 55 | #define TEST_VADDHN1(INSN, T1, T2, W, W2, N) \ 56 | VECT_VAR(vector64, T1, W2, N) = INSN##_##T2##W(VECT_VAR(vector1, T1, W, N), \ 57 | VECT_VAR(vector2, T1, W, N)); \ 58 | vst1_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector64, T1, W2, N)) 59 | 60 | #define TEST_VADDHN(INSN, T1, T2, W, W2, N) \ 61 | TEST_VADDHN1(INSN, T1, T2, W, W2, N) 62 | 63 | /* With ARM RVCT, we need to declare variables before any executable 64 | statement */ 65 | DECL_VARIABLE_64BITS_VARIANTS(vector64); 66 | DECL_VARIABLE_128BITS_VARIANTS(vector1); 67 | DECL_VARIABLE_128BITS_VARIANTS(vector2); 68 | 69 | clean_results (); 70 | 71 | /* Fill input vector1 and vector2 with arbitrary values */ 72 | VDUP(vector1, q, int, s, 16, 8, 50*(UINT8_MAX+1)); 73 | VDUP(vector1, q, int, s, 32, 4, 50*(UINT16_MAX+1)); 74 | VDUP(vector1, q, int, s, 64, 2, 24*((uint64_t)UINT32_MAX+1)); 75 | VDUP(vector1, q, uint, u, 16, 8, 3*(UINT8_MAX+1)); 76 | VDUP(vector1, q, uint, u, 32, 4, 55*(UINT16_MAX+1)); 77 | VDUP(vector1, q, uint, u, 64, 2, 3*((uint64_t)UINT32_MAX+1)); 78 | 79 | VDUP(vector2, q, int, s, 16, 8, (uint16_t)UINT8_MAX); 80 | VDUP(vector2, q, int, s, 32, 4, (uint32_t)UINT16_MAX); 81 | VDUP(vector2, q, int, s, 64, 2, (uint64_t)UINT32_MAX); 82 | VDUP(vector2, q, uint, u, 16, 8, (uint16_t)UINT8_MAX); 83 | VDUP(vector2, q, uint, u, 32, 4, (uint32_t)UINT16_MAX); 84 | VDUP(vector2, q, uint, u, 64, 2, (uint64_t)UINT32_MAX); 85 | 86 | TEST_VADDHN(INSN_NAME, int, s, 16, 8, 8); 87 | TEST_VADDHN(INSN_NAME, int, s, 32, 16, 4); 88 | TEST_VADDHN(INSN_NAME, int, s, 64, 32, 2); 89 | TEST_VADDHN(INSN_NAME, uint, u, 16, 8, 8); 90 | TEST_VADDHN(INSN_NAME, uint, u, 32, 16, 4); 91 | TEST_VADDHN(INSN_NAME, uint, u, 64, 32, 2); 92 | 93 | dump_results_hex (TEST_MSG); 94 | } 95 | -------------------------------------------------------------------------------- /ref_vaddl.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vaddl 36 | #define TEST_MSG "VADDL" 37 | #endif 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=vaddl(x,x), then store the result. */ 45 | #define TEST_VADDL1(INSN, T1, T2, W, W2, N) \ 46 | VECT_VAR(vector_res, T1, W2, N) = \ 47 | INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ 48 | VECT_VAR(vector2, T1, W, N)); \ 49 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 50 | 51 | #define TEST_VADDL(INSN, T1, T2, W, W2, N) \ 52 | TEST_VADDL1(INSN, T1, T2, W, W2, N) 53 | 54 | /* With ARM RVCT, we need to declare variables before any executable 55 | statement */ 56 | DECL_VARIABLE(vector, int, 8, 8); 57 | DECL_VARIABLE(vector, int, 16, 4); 58 | DECL_VARIABLE(vector, int, 32, 2); 59 | DECL_VARIABLE(vector, uint, 8, 8); 60 | DECL_VARIABLE(vector, uint, 16, 4); 61 | DECL_VARIABLE(vector, uint, 32, 2); 62 | 63 | DECL_VARIABLE(vector2, int, 8, 8); 64 | DECL_VARIABLE(vector2, int, 16, 4); 65 | DECL_VARIABLE(vector2, int, 32, 2); 66 | DECL_VARIABLE(vector2, uint, 8, 8); 67 | DECL_VARIABLE(vector2, uint, 16, 4); 68 | DECL_VARIABLE(vector2, uint, 32, 2); 69 | 70 | DECL_VARIABLE(vector_res, int, 16, 8); 71 | DECL_VARIABLE(vector_res, int, 32, 4); 72 | DECL_VARIABLE(vector_res, int, 64, 2); 73 | DECL_VARIABLE(vector_res, uint, 16, 8); 74 | DECL_VARIABLE(vector_res, uint, 32, 4); 75 | DECL_VARIABLE(vector_res, uint, 64, 2); 76 | 77 | clean_results (); 78 | 79 | /* Initialize input "vector" from "buffer" */ 80 | VLOAD(vector, buffer, , int, s, 8, 8); 81 | VLOAD(vector, buffer, , int, s, 16, 4); 82 | VLOAD(vector, buffer, , int, s, 32, 2); 83 | VLOAD(vector, buffer, , uint, u, 8, 8); 84 | VLOAD(vector, buffer, , uint, u, 16, 4); 85 | VLOAD(vector, buffer, , uint, u, 32, 2); 86 | 87 | /* Choose init value arbitrarily */ 88 | VDUP(vector2, , int, s, 8, 8, -13); 89 | VDUP(vector2, , int, s, 16, 4, -14); 90 | VDUP(vector2, , int, s, 32, 2, -16); 91 | VDUP(vector2, , uint, u, 8, 8, 0xf3); 92 | VDUP(vector2, , uint, u, 16, 4, 0xfff1); 93 | VDUP(vector2, , uint, u, 32, 2, 0xfffffff0); 94 | 95 | TEST_VADDL(INSN_NAME, int, s, 8, 16, 8); 96 | TEST_VADDL(INSN_NAME, int, s, 16, 32, 4); 97 | TEST_VADDL(INSN_NAME, int, s, 32, 64, 2); 98 | TEST_VADDL(INSN_NAME, uint, u, 8, 16, 8); 99 | TEST_VADDL(INSN_NAME, uint, u, 16, 32, 4); 100 | TEST_VADDL(INSN_NAME, uint, u, 32, 64, 2); 101 | 102 | /* FIXME: only a few result buffers are used, but we output all of them */ 103 | dump_results_hex (TEST_MSG); 104 | } 105 | -------------------------------------------------------------------------------- /ref_vaddw.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vaddw 36 | #define TEST_MSG "VADDW" 37 | #endif 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=vaddw(x,x), then store the result. */ 45 | #define TEST_VADDW1(INSN, T1, T2, W, W2, N) \ 46 | VECT_VAR(vector_res, T1, W2, N) = \ 47 | INSN##_##T2##W(VECT_VAR(vector, T1, W2, N), \ 48 | VECT_VAR(vector2, T1, W, N)); \ 49 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 50 | 51 | #define TEST_VADDW(INSN, T1, T2, W, W2, N) \ 52 | TEST_VADDW1(INSN, T1, T2, W, W2, N) 53 | 54 | /* With ARM RVCT, we need to declare variables before any executable 55 | statement */ 56 | DECL_VARIABLE(vector, int, 16, 8); 57 | DECL_VARIABLE(vector, int, 32, 4); 58 | DECL_VARIABLE(vector, int, 64, 2); 59 | DECL_VARIABLE(vector, uint, 16, 8); 60 | DECL_VARIABLE(vector, uint, 32, 4); 61 | DECL_VARIABLE(vector, uint, 64, 2); 62 | 63 | DECL_VARIABLE(vector2, int, 8, 8); 64 | DECL_VARIABLE(vector2, int, 16, 4); 65 | DECL_VARIABLE(vector2, int, 32, 2); 66 | DECL_VARIABLE(vector2, uint, 8, 8); 67 | DECL_VARIABLE(vector2, uint, 16, 4); 68 | DECL_VARIABLE(vector2, uint, 32, 2); 69 | 70 | DECL_VARIABLE(vector_res, int, 16, 8); 71 | DECL_VARIABLE(vector_res, int, 32, 4); 72 | DECL_VARIABLE(vector_res, int, 64, 2); 73 | DECL_VARIABLE(vector_res, uint, 16, 8); 74 | DECL_VARIABLE(vector_res, uint, 32, 4); 75 | DECL_VARIABLE(vector_res, uint, 64, 2); 76 | 77 | clean_results (); 78 | 79 | /* Initialize input "vector" from "buffer" */ 80 | VLOAD(vector, buffer, q, int, s, 16, 8); 81 | VLOAD(vector, buffer, q, int, s, 32, 4); 82 | VLOAD(vector, buffer, q, int, s, 64, 2); 83 | VLOAD(vector, buffer, q, uint, u, 16, 8); 84 | VLOAD(vector, buffer, q, uint, u, 32, 4); 85 | VLOAD(vector, buffer, q, uint, u, 64, 2); 86 | 87 | /* Choose init value arbitrarily */ 88 | VDUP(vector2, , int, s, 8, 8, -13); 89 | VDUP(vector2, , int, s, 16, 4, -14); 90 | VDUP(vector2, , int, s, 32, 2, -16); 91 | VDUP(vector2, , uint, u, 8, 8, 0xf3); 92 | VDUP(vector2, , uint, u, 16, 4, 0xfff1); 93 | VDUP(vector2, , uint, u, 32, 2, 0xfffffff0); 94 | 95 | TEST_VADDW(INSN_NAME, int, s, 8, 16, 8); 96 | TEST_VADDW(INSN_NAME, int, s, 16, 32, 4); 97 | TEST_VADDW(INSN_NAME, int, s, 32, 64, 2); 98 | TEST_VADDW(INSN_NAME, uint, u, 8, 16, 8); 99 | TEST_VADDW(INSN_NAME, uint, u, 16, 32, 4); 100 | TEST_VADDW(INSN_NAME, uint, u, 32, 64, 2); 101 | 102 | /* FIXME: only a few result buffers are used, but we output all of them */ 103 | dump_results_hex (TEST_MSG); 104 | } 105 | -------------------------------------------------------------------------------- /ref_vand.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vand 27 | #define TEST_MSG "VAND/VANDQ" 28 | 29 | #include "ref_v_binary_op.c" 30 | -------------------------------------------------------------------------------- /ref_vbic.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vbic 27 | #define TEST_MSG "VBIC/VBICQ" 28 | 29 | #include "ref_v_binary_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcage.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcage 27 | #define TEST_MSG "VCAGE/VCAGEQ" 28 | 29 | #include "ref_v_comp_f_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcagt.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcagt 27 | #define TEST_MSG "VCAGT/VCAGTQ" 28 | 29 | #include "ref_v_comp_f_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcale.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcale 27 | #define TEST_MSG "VCALE/VCALEQ" 28 | 29 | #include "ref_v_comp_f_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcalt.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcalt 27 | #define TEST_MSG "VCALT/VCALTQ" 28 | 29 | #include "ref_v_comp_f_op.c" 30 | -------------------------------------------------------------------------------- /ref_vceq.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vceq 27 | #define TEST_MSG "VCEQ/VCEQQ" 28 | 29 | /* Extra tests for _p8 variants, which exist only for vceq */ 30 | void exec_vceq_p8(void); 31 | #define EXTRA_TESTS exec_vceq_p8 32 | 33 | #include "ref_v_comp_op.c" 34 | 35 | void exec_vceq_p8(void) 36 | { 37 | int i; /* Used by DUMP() */ 38 | 39 | DECL_VARIABLE(vector, poly, 8, 8); 40 | DECL_VARIABLE(vector, poly, 8, 16); 41 | 42 | DECL_VARIABLE(vector2, poly, 8, 8); 43 | DECL_VARIABLE(vector2, poly, 8, 16); 44 | 45 | DECL_VARIABLE(vector_res, uint, 8, 8); 46 | DECL_VARIABLE(vector_res, uint, 8, 16); 47 | 48 | clean_results (); 49 | 50 | VLOAD(vector, buffer, , poly, p, 8, 8); 51 | VLOAD(vector, buffer, q, poly, p, 8, 16); 52 | 53 | VDUP(vector2, , poly, p, 8, 8, 0xF3); 54 | VDUP(vector2, q, poly, p, 8, 16, 0xF4); 55 | 56 | fprintf(ref_file, "\n%s output:\n", TEST_MSG " p8"); 57 | TEST_VCOMP(INSN_NAME, , poly, p, uint, 8, 8); 58 | TEST_VCOMP(INSN_NAME, q, poly, p, uint, 8, 16); 59 | 60 | DUMP(TEST_MSG, uint, 8, 8, PRIx8); 61 | DUMP(TEST_MSG, uint, 8, 16, PRIx8); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ref_vcge.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcge 27 | #define TEST_MSG "VCGE/VCGEQ" 28 | 29 | #include "ref_v_comp_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcgt.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcgt 27 | #define TEST_MSG "VCGT/VCGTQ" 28 | 29 | #include "ref_v_comp_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcle.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vcle 27 | #define TEST_MSG "VCLE/VCLEQ" 28 | 29 | #include "ref_v_comp_op.c" 30 | -------------------------------------------------------------------------------- /ref_vclt.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vclt 27 | #define TEST_MSG "VCLT/VCLTQ" 28 | 29 | #include "ref_v_comp_op.c" 30 | -------------------------------------------------------------------------------- /ref_vcnt.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN_NAME vcnt 35 | #define TEST_MSG "VCNT/VCNTQ" 36 | 37 | #define FNNAME1(NAME) void exec_ ## NAME (void) 38 | #define FNNAME(NAME) FNNAME1(NAME) 39 | 40 | FNNAME (INSN_NAME) 41 | { 42 | /* Basic test: y=OP(x), then store the result. */ 43 | #define TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ 44 | VECT_VAR(vector_res, T1, W, N) = \ 45 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ 46 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 47 | 48 | #define TEST_UNARY_OP(INSN, Q, T1, T2, W, N) \ 49 | TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \ 50 | 51 | /* With ARM RVCT, we need to declare variables before any executable 52 | statement */ 53 | 54 | /* No need for 64 bits variants */ 55 | DECL_VARIABLE(vector, int, 8, 8); 56 | DECL_VARIABLE(vector, uint, 8, 8); 57 | DECL_VARIABLE(vector, poly, 8, 8); 58 | DECL_VARIABLE(vector, int, 8, 16); 59 | DECL_VARIABLE(vector, uint, 8, 16); 60 | DECL_VARIABLE(vector, poly, 8, 16); 61 | 62 | DECL_VARIABLE(vector_res, int, 8, 8); 63 | DECL_VARIABLE(vector_res, uint, 8, 8); 64 | DECL_VARIABLE(vector_res, poly, 8, 8); 65 | DECL_VARIABLE(vector_res, int, 8, 16); 66 | DECL_VARIABLE(vector_res, uint, 8, 16); 67 | DECL_VARIABLE(vector_res, poly, 8, 16); 68 | 69 | clean_results (); 70 | 71 | /* Fill input vector with arbitrary values */ 72 | VDUP(vector, , int, s, 8, 8, 0xFF); 73 | VDUP(vector, , uint, u, 8, 8, 0x35); 74 | VDUP(vector, , poly, p, 8, 8, 0x35); 75 | VDUP(vector, q, int, s, 8, 16, 0); 76 | VDUP(vector, q, uint, u, 8, 16, 0xBD); 77 | VDUP(vector, q, poly, p, 8, 16, 0xBD); 78 | 79 | /* Apply a unary operator named INSN_NAME */ 80 | TEST_UNARY_OP(INSN_NAME, , int, s, 8, 8); 81 | TEST_UNARY_OP(INSN_NAME, , uint, u, 8, 8); 82 | TEST_UNARY_OP(INSN_NAME, , poly, p, 8, 8); 83 | TEST_UNARY_OP(INSN_NAME, q, int, s, 8, 16); 84 | TEST_UNARY_OP(INSN_NAME, q, uint, u, 8, 16); 85 | TEST_UNARY_OP(INSN_NAME, q, poly, p, 8, 16); 86 | 87 | dump_results_hex (TEST_MSG); 88 | } 89 | -------------------------------------------------------------------------------- /ref_vdup.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VDUP/VDUPQ" 35 | void exec_vdup (void) 36 | { 37 | int i; 38 | 39 | /* Basic test: vec=vdup(x), then store the result. */ 40 | #define TEST_VDUP(Q, T1, T2, W, N) \ 41 | VECT_VAR(vector, T1, W, N) = \ 42 | vdup##Q##_n_##T2##W(VECT_VAR(buffer_dup, T1, W, N)[i]); \ 43 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N)) 44 | 45 | /* Basic test: vec=vmov(x), then store the result. */ 46 | #define TEST_VMOV(Q, T1, T2, W, N) \ 47 | VECT_VAR(vector, T1, W, N) = \ 48 | vmov##Q##_n_##T2##W(VECT_VAR(buffer_dup, T1, W, N)[i]); \ 49 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N)) 50 | 51 | /* With ARM RVCT, we need to declare variables before any executable 52 | statement */ 53 | DECL_VARIABLE_ALL_VARIANTS(vector); 54 | 55 | for (i=0; i< 3; i++) { 56 | clean_results (); 57 | 58 | TEST_VDUP(, int, s, 8, 8); 59 | TEST_VDUP(, int, s, 16, 4); 60 | TEST_VDUP(, int, s, 32, 2); 61 | TEST_VDUP(, int, s, 64, 1); 62 | TEST_VDUP(, uint, u, 8, 8); 63 | TEST_VDUP(, uint, u, 16, 4); 64 | TEST_VDUP(, uint, u, 32, 2); 65 | TEST_VDUP(, uint, u, 64, 1); 66 | TEST_VDUP(, poly, p, 8, 8); 67 | TEST_VDUP(, poly, p, 16, 4); 68 | TEST_VDUP(, float, f, 32, 2); 69 | 70 | TEST_VDUP(q, int, s, 8, 16); 71 | TEST_VDUP(q, int, s, 16, 8); 72 | TEST_VDUP(q, int, s, 32, 4); 73 | TEST_VDUP(q, int, s, 64, 2); 74 | TEST_VDUP(q, uint, u, 8, 16); 75 | TEST_VDUP(q, uint, u, 16, 8); 76 | TEST_VDUP(q, uint, u, 32, 4); 77 | TEST_VDUP(q, uint, u, 64, 2); 78 | TEST_VDUP(q, poly, p, 8, 16); 79 | TEST_VDUP(q, poly, p, 16, 8); 80 | TEST_VDUP(q, float, f, 32, 4); 81 | 82 | dump_results_hex (TEST_MSG); 83 | } 84 | 85 | #undef TEST_MSG 86 | #define TEST_MSG "VMOV/VMOVQ" 87 | for (i=0; i< 3; i++) { 88 | clean_results (); 89 | 90 | TEST_VMOV(, int, s, 8, 8); 91 | TEST_VMOV(, int, s, 16, 4); 92 | TEST_VMOV(, int, s, 32, 2); 93 | TEST_VMOV(, int, s, 64, 1); 94 | TEST_VMOV(, uint, u, 8, 8); 95 | TEST_VMOV(, uint, u, 16, 4); 96 | TEST_VMOV(, uint, u, 32, 2); 97 | TEST_VMOV(, uint, u, 64, 1); 98 | TEST_VMOV(, poly, p, 8, 8); 99 | TEST_VMOV(, poly, p, 16, 4); 100 | TEST_VMOV(, float, f, 32, 2); 101 | 102 | TEST_VMOV(q, int, s, 8, 16); 103 | TEST_VMOV(q, int, s, 16, 8); 104 | TEST_VMOV(q, int, s, 32, 4); 105 | TEST_VMOV(q, int, s, 64, 2); 106 | TEST_VMOV(q, uint, u, 8, 16); 107 | TEST_VMOV(q, uint, u, 16, 8); 108 | TEST_VMOV(q, uint, u, 32, 4); 109 | TEST_VMOV(q, uint, u, 64, 2); 110 | TEST_VMOV(q, poly, p, 8, 16); 111 | TEST_VMOV(q, poly, p, 16, 8); 112 | TEST_VMOV(q, float, f, 32, 4); 113 | 114 | dump_results_hex (TEST_MSG); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /ref_vdup_lane.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VDUP_LANE/VDUP_LANEQ" 35 | void exec_vdup_lane (void) 36 | { 37 | /* Basic test: vec1=vdup_lane(vec2, lane), then store the result. */ 38 | #define TEST_VDUP_LANE(Q, T1, T2, W, N, N2, L) \ 39 | VECT_VAR(vector_res, T1, W, N) = \ 40 | vdup##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N2), L); \ 41 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | /* Input vector can only have 64 bits */ 46 | DECL_VARIABLE_64BITS_VARIANTS(vector); 47 | 48 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 49 | 50 | clean_results (); 51 | 52 | TEST_MACRO_64BITS_VARIANTS_2_5(VLOAD, vector, buffer); 53 | VLOAD(vector, buffer, , float, f, 32, 2); 54 | 55 | /* Choose lane arbitrarily */ 56 | TEST_VDUP_LANE(, int, s, 8, 8, 8, 1); 57 | TEST_VDUP_LANE(, int, s, 16, 4, 4, 2); 58 | TEST_VDUP_LANE(, int, s, 32, 2, 2, 1); 59 | TEST_VDUP_LANE(, int, s, 64, 1, 1, 0); 60 | TEST_VDUP_LANE(, uint, u, 8, 8, 8, 7); 61 | TEST_VDUP_LANE(, uint, u, 16, 4, 4, 3); 62 | TEST_VDUP_LANE(, uint, u, 32, 2, 2, 1); 63 | TEST_VDUP_LANE(, uint, u, 64, 1, 1, 0); 64 | TEST_VDUP_LANE(, poly, p, 8, 8, 8, 7); 65 | TEST_VDUP_LANE(, poly, p, 16, 4, 4, 3); 66 | TEST_VDUP_LANE(, float, f, 32, 2, 2, 1); 67 | 68 | TEST_VDUP_LANE(q, int, s, 8, 16, 8, 2); 69 | TEST_VDUP_LANE(q, int, s, 16, 8, 4, 3); 70 | TEST_VDUP_LANE(q, int, s, 32, 4, 2, 1); 71 | TEST_VDUP_LANE(q, int, s, 64, 2, 1, 0); 72 | TEST_VDUP_LANE(q, uint, u, 8, 16, 8, 5); 73 | TEST_VDUP_LANE(q, uint, u, 16, 8, 4, 1); 74 | TEST_VDUP_LANE(q, uint, u, 32, 4, 2, 0); 75 | TEST_VDUP_LANE(q, uint, u, 64, 2, 1, 0); 76 | TEST_VDUP_LANE(q, poly, p, 8, 16, 8, 5); 77 | TEST_VDUP_LANE(q, poly, p, 16, 8, 4, 1); 78 | TEST_VDUP_LANE(q, float, f, 32, 4, 2, 1); 79 | 80 | dump_results_hex (TEST_MSG); 81 | } 82 | -------------------------------------------------------------------------------- /ref_veor.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME veor 27 | #define TEST_MSG "VEOR/VEORQ" 28 | 29 | #include "ref_v_binary_op.c" 30 | -------------------------------------------------------------------------------- /ref_vget_high.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VGET_HIGH" 35 | void exec_vget_high (void) 36 | { 37 | /* Basic test: vec64=vget_high(vec128), then store the result. */ 38 | #define TEST_VGET_HIGH(T1, T2, W, N, N2) \ 39 | VECT_VAR(vector64, T1, W, N) = \ 40 | vget_high_##T2##W(VECT_VAR(vector128, T1, W, N2)); \ 41 | vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector64, T1, W, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_64BITS_VARIANTS(vector64); 46 | DECL_VARIABLE_128BITS_VARIANTS(vector128); 47 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 48 | DECL_VARIABLE(vector64, float, 16, 4); 49 | DECL_VARIABLE(vector128, float, 16, 8); 50 | #endif 51 | 52 | TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); 53 | VLOAD(vector128, buffer, q, float, f, 32, 4); 54 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 55 | VLOAD(vector128, buffer, q, float, f, 16, 8); 56 | #endif 57 | 58 | clean_results (); 59 | 60 | TEST_VGET_HIGH(int, s, 8, 8, 16); 61 | TEST_VGET_HIGH(int, s, 16, 4, 8); 62 | TEST_VGET_HIGH(int, s, 32, 2, 4); 63 | TEST_VGET_HIGH(int, s, 64, 1, 2); 64 | TEST_VGET_HIGH(uint, u, 8, 8, 16); 65 | TEST_VGET_HIGH(uint, u, 16, 4, 8); 66 | TEST_VGET_HIGH(uint, u, 32, 2, 4); 67 | TEST_VGET_HIGH(uint, u, 64, 1, 2); 68 | TEST_VGET_HIGH(poly, p, 8, 8, 16); 69 | TEST_VGET_HIGH(poly, p, 16, 4, 8); 70 | TEST_VGET_HIGH(float, f, 32, 2, 4); 71 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 72 | TEST_VGET_HIGH(float, f, 16, 4, 8); 73 | #endif 74 | 75 | dump_results_hex (TEST_MSG); 76 | } 77 | -------------------------------------------------------------------------------- /ref_vget_low.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VGET_LOW" 35 | void exec_vget_low (void) 36 | { 37 | /* Basic test: vec64=vget_low(vec128), then store the result. */ 38 | #define TEST_VGET_LOW(T1, T2, W, N, N2) \ 39 | VECT_VAR(vector64, T1, W, N) = \ 40 | vget_low_##T2##W(VECT_VAR(vector128, T1, W, N2)); \ 41 | vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector64, T1, W, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_64BITS_VARIANTS(vector64); 46 | DECL_VARIABLE_128BITS_VARIANTS(vector128); 47 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 48 | DECL_VARIABLE(vector64, float, 16, 4); 49 | DECL_VARIABLE(vector128, float, 16, 8); 50 | #endif 51 | 52 | TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); 53 | VLOAD(vector128, buffer, q, float, f, 32, 4); 54 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 55 | VLOAD(vector128, buffer, q, float, f, 16, 8); 56 | #endif 57 | 58 | clean_results (); 59 | 60 | TEST_VGET_LOW(int, s, 8, 8, 16); 61 | TEST_VGET_LOW(int, s, 16, 4, 8); 62 | TEST_VGET_LOW(int, s, 32, 2, 4); 63 | TEST_VGET_LOW(int, s, 64, 1, 2); 64 | TEST_VGET_LOW(uint, u, 8, 8, 16); 65 | TEST_VGET_LOW(uint, u, 16, 4, 8); 66 | TEST_VGET_LOW(uint, u, 32, 2, 4); 67 | TEST_VGET_LOW(uint, u, 64, 1, 2); 68 | TEST_VGET_LOW(poly, p, 8, 8, 16); 69 | TEST_VGET_LOW(poly, p, 16, 4, 8); 70 | TEST_VGET_LOW(float, f, 32, 2, 4); 71 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 72 | TEST_VGET_LOW(float, f, 16, 4, 8); 73 | #endif 74 | 75 | dump_results_hex (TEST_MSG); 76 | } 77 | -------------------------------------------------------------------------------- /ref_vhadd.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vhadd 27 | #define TEST_MSG "VHADD/VHADDQ" 28 | 29 | #define NO_FLOAT_VARIANT 30 | 31 | #include "ref_vmax.c" 32 | -------------------------------------------------------------------------------- /ref_vhsub.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vhsub 27 | #define TEST_MSG "VHSUB/VHSUBQ" 28 | 29 | #define NO_FLOAT_VARIANT 30 | 31 | #include "ref_vmax.c" 32 | -------------------------------------------------------------------------------- /ref_vld1.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VLD1/VLD1Q" 35 | void exec_vld1 (void) 36 | { 37 | /* Basic test vec=vld1(buffer); then store vec: vst1(result, vector) */ 38 | /* This test actually tests vdl1 and vst1 at the same time */ 39 | #define TEST_VLD1(VAR, BUF, Q, T1, T2, W, N) \ 40 | VECT_VAR(VAR, T1, W, N) = vld1##Q##_##T2##W(VECT_VAR(BUF, T1, W, N)); \ 41 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(VAR, T1, W, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_ALL_VARIANTS(vector); 46 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 47 | DECL_VARIABLE(vector, float, 16, 4); 48 | DECL_VARIABLE(vector, float, 16, 8); 49 | #endif 50 | 51 | clean_results (); 52 | 53 | TEST_MACRO_ALL_VARIANTS_2_5(TEST_VLD1, vector, buffer); 54 | 55 | TEST_VLD1(vector, buffer, , float, f, 32, 2); 56 | TEST_VLD1(vector, buffer, q, float, f, 32, 4); 57 | 58 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 59 | TEST_VLD1(vector, buffer, , float, f, 16, 4); 60 | TEST_VLD1(vector, buffer, q, float, f, 16, 8); 61 | #endif 62 | 63 | dump_results_hex (TEST_MSG); 64 | } 65 | -------------------------------------------------------------------------------- /ref_vld1_dup.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VLD1_DUP/VLD1_DUPQ" 35 | void exec_vld1_dup (void) 36 | { 37 | int i; 38 | 39 | /* Fill vector with buffer item #i */ 40 | #define TEST_VLD1_DUP(VAR, BUF, Q, T1, T2, W, N) \ 41 | VECT_VAR(VAR, T1, W, N) = \ 42 | vld1##Q##_dup_##T2##W(&VECT_VAR(BUF, T1, W, N)[i]); \ 43 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(VAR, T1, W, N)) 44 | 45 | /* With ARM RVCT, we need to declare variables before any executable 46 | statement */ 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 49 | DECL_VARIABLE(vector, float, 16, 4); 50 | DECL_VARIABLE(vector, float, 16, 8); 51 | #endif 52 | 53 | /* Try to read different places from the input buffer */ 54 | for (i=0; i<3; i++) { 55 | clean_results (); 56 | 57 | TEST_MACRO_ALL_VARIANTS_2_5(TEST_VLD1_DUP, vector, buffer_dup); 58 | 59 | TEST_VLD1_DUP(vector, buffer_dup, , float, f, 32, 2); 60 | TEST_VLD1_DUP(vector, buffer_dup, q, float, f, 32, 4); 61 | 62 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 63 | TEST_VLD1_DUP(vector, buffer_dup, , float, f, 16, 4); 64 | TEST_VLD1_DUP(vector, buffer_dup, q, float, f, 16, 8); 65 | #endif 66 | 67 | dump_results_hex (TEST_MSG); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /ref_vmin.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmin 27 | #define TEST_MSG "VMIN/VMINQ" 28 | 29 | #include "ref_vmax.c" 30 | -------------------------------------------------------------------------------- /ref_vmlal_lane.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vmlal_lane 36 | #define TEST_MSG "VMLAL_LANE" 37 | #endif 38 | 39 | #define FNNAME1(NAME) void exec_ ## NAME (void) 40 | #define FNNAME(NAME) FNNAME1(NAME) 41 | 42 | FNNAME (INSN_NAME) 43 | { 44 | /* vector_res = vmlxl_lane(vector, vector3, vector4, lane), 45 | then store the result. */ 46 | #define TEST_VMLXL_LANE1(INSN, T1, T2, W, W2, N, V) \ 47 | VECT_VAR(vector_res, T1, W, N) = \ 48 | INSN##_##T2##W2(VECT_VAR(vector, T1, W, N), \ 49 | VECT_VAR(vector3, T1, W2, N), \ 50 | VECT_VAR(vector4, T1, W2, N), \ 51 | V); \ 52 | vst1q_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 53 | 54 | #define TEST_VMLXL_LANE(INSN, T1, T2, W, W2, N, V) \ 55 | TEST_VMLXL_LANE1(INSN, T1, T2, W, W2, N, V) 56 | 57 | /* With ARM RVCT, we need to declare variables before any executable 58 | statement */ 59 | DECL_VARIABLE(vector, int, 32, 4); 60 | DECL_VARIABLE(vector3, int, 16, 4); 61 | DECL_VARIABLE(vector4, int, 16, 4); 62 | DECL_VARIABLE(vector_res, int, 32, 4); 63 | 64 | DECL_VARIABLE(vector, int, 64, 2); 65 | DECL_VARIABLE(vector3, int, 32, 2); 66 | DECL_VARIABLE(vector4, int, 32, 2); 67 | DECL_VARIABLE(vector_res, int, 64, 2); 68 | 69 | DECL_VARIABLE(vector, uint, 32, 4); 70 | DECL_VARIABLE(vector3, uint, 16, 4); 71 | DECL_VARIABLE(vector4, uint, 16, 4); 72 | DECL_VARIABLE(vector_res, uint, 32, 4); 73 | 74 | DECL_VARIABLE(vector, uint, 64, 2); 75 | DECL_VARIABLE(vector3, uint, 32, 2); 76 | DECL_VARIABLE(vector4, uint, 32, 2); 77 | DECL_VARIABLE(vector_res, uint, 64, 2); 78 | 79 | clean_results (); 80 | 81 | VLOAD(vector, buffer, q, int, s, 32, 4); 82 | VLOAD(vector, buffer, q, int, s, 64, 2); 83 | VLOAD(vector, buffer, q, uint, u, 32, 4); 84 | VLOAD(vector, buffer, q, uint, u, 64, 2); 85 | 86 | VDUP(vector3, , int, s, 16, 4, 0x55); 87 | VDUP(vector4, , int, s, 16, 4, 0xBB); 88 | VDUP(vector3, , int, s, 32, 2, 0x55); 89 | VDUP(vector4, , int, s, 32, 2, 0xBB); 90 | VDUP(vector3, , uint, u, 16, 4, 0x55); 91 | VDUP(vector4, , uint, u, 16, 4, 0xBB); 92 | VDUP(vector3, , uint, u, 32, 2, 0x55); 93 | VDUP(vector4, , uint, u, 32, 2, 0xBB); 94 | 95 | TEST_VMLXL_LANE(INSN_NAME, int, s, 32, 16, 4, 2); 96 | TEST_VMLXL_LANE(INSN_NAME, int, s, 64, 32, 2, 1); 97 | TEST_VMLXL_LANE(INSN_NAME, uint, u, 32, 16, 4, 2); 98 | TEST_VMLXL_LANE(INSN_NAME, uint, u, 64, 32, 2, 1); 99 | 100 | dump_results_hex (TEST_MSG); 101 | } 102 | -------------------------------------------------------------------------------- /ref_vmlal_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vmlal_n 36 | #define TEST_MSG "VMLAL_N" 37 | #endif 38 | 39 | #define FNNAME1(NAME) void exec_ ## NAME (void) 40 | #define FNNAME(NAME) FNNAME1(NAME) 41 | 42 | FNNAME (INSN_NAME) 43 | { 44 | /* vector_res = vmlxl_n(vector, vector2, val), 45 | then store the result. */ 46 | #define TEST_VMLXL_N1(INSN, T1, T2, W, W2, N, V) \ 47 | VECT_VAR(vector_res, T1, W, N) = INSN##_##T2##W2(VECT_VAR(vector, T1, W, N), \ 48 | VECT_VAR(vector2, T1, W2, N), \ 49 | V); \ 50 | vst1q_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 51 | 52 | #define TEST_VMLXL_N(INSN, T1, T2, W, W2, N, V) \ 53 | TEST_VMLXL_N1(INSN, T1, T2, W, W2, N, V) 54 | 55 | /* With ARM RVCT, we need to declare variables before any executable 56 | statement */ 57 | DECL_VARIABLE(vector, int, 32, 4); 58 | DECL_VARIABLE(vector2, int, 16, 4); 59 | DECL_VARIABLE(vector_res, int, 32, 4); 60 | 61 | DECL_VARIABLE(vector, int, 64, 2); 62 | DECL_VARIABLE(vector2, int, 32, 2); 63 | DECL_VARIABLE(vector_res, int, 64, 2); 64 | 65 | DECL_VARIABLE(vector, uint, 32, 4); 66 | DECL_VARIABLE(vector2, uint, 16, 4); 67 | DECL_VARIABLE(vector_res, uint, 32, 4); 68 | 69 | DECL_VARIABLE(vector, uint, 64, 2); 70 | DECL_VARIABLE(vector2, uint, 32, 2); 71 | DECL_VARIABLE(vector_res, uint, 64, 2); 72 | 73 | clean_results (); 74 | 75 | VLOAD(vector, buffer, q, int, s, 32, 4); 76 | VLOAD(vector, buffer, q, int, s, 64, 2); 77 | VLOAD(vector, buffer, q, uint, u, 32, 4); 78 | VLOAD(vector, buffer, q, uint, u, 64, 2); 79 | 80 | VDUP(vector2, , int, s, 16, 4, 0x55); 81 | VDUP(vector2, , int, s, 32, 2, 0x55); 82 | VDUP(vector2, , uint, u, 16, 4, 0x55); 83 | VDUP(vector2, , uint, u, 32, 2, 0x55); 84 | 85 | /* Choose multiplier arbitrarily */ 86 | TEST_VMLXL_N(INSN_NAME, int, s, 32, 16, 4, 0x11); 87 | TEST_VMLXL_N(INSN_NAME, int, s, 64, 32, 2, 0x22); 88 | TEST_VMLXL_N(INSN_NAME, uint, u, 32, 16, 4, 0x33); 89 | TEST_VMLXL_N(INSN_NAME, uint, u, 64, 32, 2, 0x33); 90 | 91 | dump_results_hex (TEST_MSG); 92 | } 93 | -------------------------------------------------------------------------------- /ref_vmls.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmls 27 | #define TEST_MSG "VMLS" 28 | 29 | #include "ref_vmla.c" 30 | -------------------------------------------------------------------------------- /ref_vmls_lane.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmls 27 | #define TEST_MSG "VMLS_LANE" 28 | 29 | #include "ref_vmla_lane.c" 30 | -------------------------------------------------------------------------------- /ref_vmls_n.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmls 27 | #define TEST_MSG "VMLS_N" 28 | 29 | #include "ref_vmla_n.c" 30 | -------------------------------------------------------------------------------- /ref_vmlsl.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmlsl 27 | #define TEST_MSG "VMLSL" 28 | 29 | #include "ref_vmlal.c" 30 | -------------------------------------------------------------------------------- /ref_vmlsl_lane.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmlsl_lane 27 | #define TEST_MSG "VMLSL_LANE" 28 | 29 | #include "ref_vmlal_lane.c" 30 | -------------------------------------------------------------------------------- /ref_vmlsl_n.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vmlsl_n 27 | #define TEST_MSG "VMLSL_N" 28 | 29 | #include "ref_vmlal_n.c" 30 | -------------------------------------------------------------------------------- /ref_vmovl.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMOVL" 35 | void exec_vmovl (void) 36 | { 37 | /* Basic test: vec128=vmovl(vec64), then store the result. */ 38 | #define TEST_VMOVL(T1, T2, W, W2, N) \ 39 | VECT_VAR(vector128, T1, W2, N) = \ 40 | vmovl_##T2##W(VECT_VAR(vector64, T1, W, N)); \ 41 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector128, T1, W2, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_64BITS_VARIANTS(vector64); 46 | DECL_VARIABLE_128BITS_VARIANTS(vector128); 47 | 48 | TEST_MACRO_64BITS_VARIANTS_2_5(VLOAD, vector64, buffer); 49 | 50 | clean_results (); 51 | 52 | TEST_VMOVL(int, s, 8, 16, 8); 53 | TEST_VMOVL(int, s, 16, 32, 4); 54 | TEST_VMOVL(int, s, 32, 64, 2); 55 | TEST_VMOVL(uint, u, 8, 16, 8); 56 | TEST_VMOVL(uint, u, 16, 32, 4); 57 | TEST_VMOVL(uint, u, 32, 64, 2); 58 | 59 | dump_results_hex (TEST_MSG); 60 | } 61 | -------------------------------------------------------------------------------- /ref_vmovn.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMOVN" 35 | void exec_vmovn (void) 36 | { 37 | /* Basic test: vec64=vmovn(vec128), then store the result. */ 38 | #define TEST_VMOVN(T1, T2, W, W2, N) \ 39 | VECT_VAR(vector64, T1, W2, N) = \ 40 | vmovn_##T2##W(VECT_VAR(vector128, T1, W, N)); \ 41 | vst1_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector64, T1, W2, N)) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_64BITS_VARIANTS(vector64); 46 | DECL_VARIABLE_128BITS_VARIANTS(vector128); 47 | 48 | TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); 49 | 50 | clean_results (); 51 | 52 | TEST_VMOVN(int, s, 16, 8, 8); 53 | TEST_VMOVN(int, s, 32, 16, 4); 54 | TEST_VMOVN(int, s, 64, 32, 2); 55 | TEST_VMOVN(uint, u, 16, 8, 8); 56 | TEST_VMOVN(uint, u, 32, 16, 4); 57 | TEST_VMOVN(uint, u, 64, 32, 2); 58 | 59 | dump_results_hex (TEST_MSG); 60 | } 61 | -------------------------------------------------------------------------------- /ref_vmul_lane.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMUL_LANE" 35 | void exec_vmul_lane (void) 36 | { 37 | #define DECL_VMUL(VAR) \ 38 | DECL_VARIABLE(VAR, int, 16, 4); \ 39 | DECL_VARIABLE(VAR, int, 32, 2); \ 40 | DECL_VARIABLE(VAR, uint, 16, 4); \ 41 | DECL_VARIABLE(VAR, uint, 32, 2); \ 42 | DECL_VARIABLE(VAR, float, 32, 2); \ 43 | DECL_VARIABLE(VAR, int, 16, 8); \ 44 | DECL_VARIABLE(VAR, int, 32, 4); \ 45 | DECL_VARIABLE(VAR, uint, 16, 8); \ 46 | DECL_VARIABLE(VAR, uint, 32, 4); \ 47 | DECL_VARIABLE(VAR, float, 32, 4) 48 | 49 | /* vector_res = vmul_lane(vector,vector2,lane), then store the result. */ 50 | #define TEST_VMUL_LANE(Q, T1, T2, W, N, N2, L) \ 51 | VECT_VAR(vector_res, T1, W, N) = \ 52 | vmul##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N), \ 53 | VECT_VAR(vector2, T1, W, N2), \ 54 | L); \ 55 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ 56 | VECT_VAR(vector_res, T1, W, N)) 57 | 58 | /* With ARM RVCT, we need to declare variables before any executable 59 | statement */ 60 | DECL_VMUL(vector); 61 | DECL_VMUL(vector_res); 62 | 63 | DECL_VARIABLE(vector2, int, 16, 4); 64 | DECL_VARIABLE(vector2, int, 32, 2); 65 | DECL_VARIABLE(vector2, uint, 16, 4); 66 | DECL_VARIABLE(vector2, uint, 32, 2); 67 | DECL_VARIABLE(vector2, float, 32, 2); 68 | 69 | clean_results (); 70 | 71 | /* Initialize vector from pre-initialized values */ 72 | VLOAD(vector, buffer, , int, s, 16, 4); 73 | VLOAD(vector, buffer, , int, s, 32, 2); 74 | VLOAD(vector, buffer, , uint, u, 16, 4); 75 | VLOAD(vector, buffer, , uint, u, 32, 2); 76 | VLOAD(vector, buffer, , float, f, 32, 2); 77 | VLOAD(vector, buffer, q, int, s, 16, 8); 78 | VLOAD(vector, buffer, q, int, s, 32, 4); 79 | VLOAD(vector, buffer, q, uint, u, 16, 8); 80 | VLOAD(vector, buffer, q, uint, u, 32, 4); 81 | VLOAD(vector, buffer, q, float, f, 32, 4); 82 | 83 | /* Initialize vector2 */ 84 | VDUP(vector2, , int, s, 16, 4, 0x4); 85 | VDUP(vector2, , int, s, 32, 2, 0x22); 86 | VDUP(vector2, , uint, u, 16, 4, 0x444); 87 | VDUP(vector2, , uint, u, 32, 2, 0x532); 88 | VDUP(vector2, , float, f, 32, 2, 22.8f); 89 | 90 | /* Choose lane arbitrarily */ 91 | TEST_VMUL_LANE(, int, s, 16, 4, 4, 2); 92 | TEST_VMUL_LANE(, int, s, 32, 2, 2, 1); 93 | TEST_VMUL_LANE(, uint, u, 16, 4, 4, 2); 94 | TEST_VMUL_LANE(, uint, u, 32, 2, 2, 1); 95 | TEST_VMUL_LANE(, float, f, 32, 2, 2, 1); 96 | TEST_VMUL_LANE(q, int, s, 16, 8, 4, 2); 97 | TEST_VMUL_LANE(q, int, s, 32, 4, 2, 0); 98 | TEST_VMUL_LANE(q, uint, u, 16, 8, 4, 2); 99 | TEST_VMUL_LANE(q, uint, u, 32, 4, 2, 1); 100 | TEST_VMUL_LANE(q, float, f, 32, 4, 2, 0); 101 | 102 | /* FIXME: only a subset of the result buffers are used, but we 103 | output all of them */ 104 | dump_results_hex (TEST_MSG); 105 | } 106 | -------------------------------------------------------------------------------- /ref_vmul_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMUL_N" 35 | void exec_vmul_n (void) 36 | { 37 | #define DECL_VMUL(VAR) \ 38 | DECL_VARIABLE(VAR, int, 16, 4); \ 39 | DECL_VARIABLE(VAR, int, 32, 2); \ 40 | DECL_VARIABLE(VAR, uint, 16, 4); \ 41 | DECL_VARIABLE(VAR, uint, 32, 2); \ 42 | DECL_VARIABLE(VAR, float, 32, 2); \ 43 | DECL_VARIABLE(VAR, int, 16, 8); \ 44 | DECL_VARIABLE(VAR, int, 32, 4); \ 45 | DECL_VARIABLE(VAR, uint, 16, 8); \ 46 | DECL_VARIABLE(VAR, uint, 32, 4); \ 47 | DECL_VARIABLE(VAR, float, 32, 4) 48 | 49 | /* vector_res = vmul_n(vector,val), then store the result. */ 50 | #define TEST_VMUL_N(Q, T1, T2, W, N, L) \ 51 | VECT_VAR(vector_res, T1, W, N) = \ 52 | vmul##Q##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 53 | L); \ 54 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \ 55 | VECT_VAR(vector_res, T1, W, N)) 56 | 57 | /* With ARM RVCT, we need to declare variables before any executable 58 | statement */ 59 | DECL_VMUL(vector); 60 | DECL_VMUL(vector_res); 61 | 62 | clean_results (); 63 | 64 | /* Initialize vector from pre-initialized values */ 65 | VLOAD(vector, buffer, , int, s, 16, 4); 66 | VLOAD(vector, buffer, , int, s, 32, 2); 67 | VLOAD(vector, buffer, , uint, u, 16, 4); 68 | VLOAD(vector, buffer, , uint, u, 32, 2); 69 | VLOAD(vector, buffer, , float, f, 32, 2); 70 | VLOAD(vector, buffer, q, int, s, 16, 8); 71 | VLOAD(vector, buffer, q, int, s, 32, 4); 72 | VLOAD(vector, buffer, q, uint, u, 16, 8); 73 | VLOAD(vector, buffer, q, uint, u, 32, 4); 74 | VLOAD(vector, buffer, q, float, f, 32, 4); 75 | 76 | /* Choose multiplier arbitrarily */ 77 | TEST_VMUL_N(, int, s, 16, 4, 0x11); 78 | TEST_VMUL_N(, int, s, 32, 2, 0x22); 79 | TEST_VMUL_N(, uint, u, 16, 4, 0x33); 80 | TEST_VMUL_N(, uint, u, 32, 2, 0x44); 81 | TEST_VMUL_N(, float, f, 32, 2, 22.3f); 82 | TEST_VMUL_N(q, int, s, 16, 8, 0x55); 83 | TEST_VMUL_N(q, int, s, 32, 4, 0x66); 84 | TEST_VMUL_N(q, uint, u, 16, 8, 0x77); 85 | TEST_VMUL_N(q, uint, u, 32, 4, 0x88); 86 | TEST_VMUL_N(q, float, f, 32, 4, 88.9f); 87 | 88 | /* FIXME: only a subset of the result buffers are used, but we 89 | output all of them */ 90 | dump_results_hex (TEST_MSG); 91 | } 92 | -------------------------------------------------------------------------------- /ref_vmull.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMULL" 35 | void exec_vmull (void) 36 | { 37 | /* Basic test: y=vmull(x,x), then store the result. */ 38 | #define TEST_VMULL(T1, T2, W, W2, N) \ 39 | VECT_VAR(vector_res, T1, W2, N) = \ 40 | vmull_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | VECT_VAR(vector, T1, W, N)); \ 42 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | DECL_VARIABLE(vector, int, 8, 8); 47 | DECL_VARIABLE(vector, int, 16, 4); 48 | DECL_VARIABLE(vector, int, 32, 2); 49 | DECL_VARIABLE(vector, uint, 8, 8); 50 | DECL_VARIABLE(vector, uint, 16, 4); 51 | DECL_VARIABLE(vector, uint, 32, 2); 52 | DECL_VARIABLE(vector, poly, 8, 8); 53 | DECL_VARIABLE(vector_res, int, 16, 8); 54 | DECL_VARIABLE(vector_res, int, 32, 4); 55 | DECL_VARIABLE(vector_res, int, 64, 2); 56 | DECL_VARIABLE(vector_res, uint, 16, 8); 57 | DECL_VARIABLE(vector_res, uint, 32, 4); 58 | DECL_VARIABLE(vector_res, uint, 64, 2); 59 | DECL_VARIABLE(vector_res, poly, 16, 8); 60 | 61 | clean_results (); 62 | 63 | VLOAD(vector, buffer, , int, s, 8, 8); 64 | VLOAD(vector, buffer, , int, s, 16, 4); 65 | VLOAD(vector, buffer, , int, s, 32, 2); 66 | VLOAD(vector, buffer, , uint, u, 8, 8); 67 | VLOAD(vector, buffer, , uint, u, 16, 4); 68 | VLOAD(vector, buffer, , uint, u, 32, 2); 69 | VLOAD(vector, buffer, , poly, p, 8, 8); 70 | 71 | TEST_VMULL(int, s, 8, 16, 8); 72 | TEST_VMULL(int, s, 16, 32, 4); 73 | TEST_VMULL(int, s, 32, 64, 2); 74 | TEST_VMULL(uint, u, 8, 16, 8); 75 | TEST_VMULL(uint, u, 16, 32, 4); 76 | TEST_VMULL(uint, u, 32, 64, 2); 77 | TEST_VMULL(poly, p, 8, 16, 8); 78 | 79 | /* FIXME: only a few result buffers are used, but we output all of them */ 80 | dump_results_hex (TEST_MSG); 81 | } 82 | -------------------------------------------------------------------------------- /ref_vmull_lane.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VMULL_LANE" 35 | void exec_vmull_lane (void) 36 | { 37 | /* vector_res = vmull_lane(vector,vector2,lane), then store the result. */ 38 | #define TEST_VMULL_LANE(T1, T2, W, W2, N, L) \ 39 | VECT_VAR(vector_res, T1, W2, N) = \ 40 | vmull##_lane_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | VECT_VAR(vector2, T1, W, N), \ 42 | L); \ 43 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 44 | 45 | /* With ARM RVCT, we need to declare variables before any executable 46 | statement */ 47 | DECL_VARIABLE(vector, int, 16, 4); 48 | DECL_VARIABLE(vector, int, 32, 2); 49 | DECL_VARIABLE(vector, uint, 16, 4); 50 | DECL_VARIABLE(vector, uint, 32, 2); 51 | DECL_VARIABLE(vector2, int, 16, 4); 52 | DECL_VARIABLE(vector2, int, 32, 2); 53 | DECL_VARIABLE(vector2, uint, 16, 4); 54 | DECL_VARIABLE(vector2, uint, 32, 2); 55 | 56 | DECL_VARIABLE(vector_res, int, 32, 4); 57 | DECL_VARIABLE(vector_res, int, 64, 2); 58 | DECL_VARIABLE(vector_res, uint, 32, 4); 59 | DECL_VARIABLE(vector_res, uint, 64, 2); 60 | 61 | clean_results (); 62 | 63 | /* Initialize vector */ 64 | VDUP(vector, , int, s, 16, 4, 0x1000); 65 | VDUP(vector, , int, s, 32, 2, 0x1000); 66 | VDUP(vector, , uint, u, 16, 4, 0x1000); 67 | VDUP(vector, , uint, u, 32, 2, 0x1000); 68 | 69 | /* Initialize vector2 */ 70 | VDUP(vector2, , int, s, 16, 4, 0x4); 71 | VDUP(vector2, , int, s, 32, 2, 0x2); 72 | VDUP(vector2, , uint, u, 16, 4, 0x4); 73 | VDUP(vector2, , uint, u, 32, 2, 0x2); 74 | 75 | /* Choose lane arbitrarily */ 76 | TEST_VMULL_LANE(int, s, 16, 32, 4, 2); 77 | TEST_VMULL_LANE(int, s, 32, 64, 2, 1); 78 | TEST_VMULL_LANE(uint, u, 16, 32, 4, 2); 79 | TEST_VMULL_LANE(uint, u, 32, 64, 2, 1); 80 | 81 | /* FIXME: only a subset of the result buffers are used, but we 82 | output all of them */ 83 | dump_results_hex (TEST_MSG); 84 | } 85 | -------------------------------------------------------------------------------- /ref_vmull_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN_NAME vmull 35 | #define TEST_MSG "VMULL_N" 36 | void exec_vmull_n (void) 37 | { 38 | int i; 39 | 40 | /* vector_res = vmull_n(vector,val), then store the result. */ 41 | #define TEST_VMULL_N1(INSN, T1, T2, W, W2, N, L) \ 42 | VECT_VAR(vector_res, T1, W2, N) = \ 43 | INSN##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 44 | L); \ 45 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 46 | 47 | #define TEST_VMULL_N(INSN, T1, T2, W, W2, N, L) \ 48 | TEST_VMULL_N1(INSN, T1, T2, W, W2, N, L) 49 | 50 | /* With ARM RVCT, we need to declare variables before any executable 51 | statement */ 52 | DECL_VARIABLE(vector, int, 16, 4); 53 | DECL_VARIABLE(vector, int, 32, 2); 54 | DECL_VARIABLE(vector, uint, 16, 4); 55 | DECL_VARIABLE(vector, uint, 32, 2); 56 | 57 | DECL_VARIABLE(vector_res, int, 32, 4); 58 | DECL_VARIABLE(vector_res, int, 64, 2); 59 | DECL_VARIABLE(vector_res, uint, 32, 4); 60 | DECL_VARIABLE(vector_res, uint, 64, 2); 61 | 62 | clean_results (); 63 | 64 | /* Initialize vector */ 65 | VDUP(vector, , int, s, 16, 4, 0x1000); 66 | VDUP(vector, , int, s, 32, 2, 0x1000); 67 | VDUP(vector, , uint, u, 16, 4, 0x1000); 68 | VDUP(vector, , uint, u, 32, 2, 0x1000); 69 | 70 | /* Choose multiplier arbitrarily */ 71 | TEST_VMULL_N(INSN_NAME, int, s, 16, 32, 4, 0x11); 72 | TEST_VMULL_N(INSN_NAME, int, s, 32, 64, 2, 0x22); 73 | TEST_VMULL_N(INSN_NAME, uint, u, 16, 32, 4, 0x33); 74 | TEST_VMULL_N(INSN_NAME, uint, u, 32, 64, 2, 0x44); 75 | 76 | fprintf(ref_file, "\n%s output:\n", TEST_MSG); 77 | fprintf(gcc_tests_file, "\n%s output:\n", TEST_MSG); 78 | DUMP(TEST_MSG, int, 32, 4, PRIx32); 79 | DUMP(TEST_MSG, int, 64, 2, PRIx64); 80 | DUMP(TEST_MSG, uint, 32, 4, PRIx32); 81 | DUMP(TEST_MSG, uint, 64, 2, PRIx64); 82 | } 83 | -------------------------------------------------------------------------------- /ref_vneg.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vneg 27 | #define TEST_MSG "VNEG/VNEGQ" 28 | 29 | /* Extra tests for functions requiring floating-point types */ 30 | void exec_vneg_f32(void); 31 | #define EXTRA_TESTS exec_vneg_f32 32 | 33 | #include "ref_v_unary_op.c" 34 | 35 | void exec_vneg_f32(void) 36 | { 37 | int i; 38 | 39 | DECL_VARIABLE(vector, float, 32, 2); 40 | DECL_VARIABLE(vector, float, 32, 4); 41 | 42 | DECL_VARIABLE(vector_res, float, 32, 2); 43 | DECL_VARIABLE(vector_res, float, 32, 4); 44 | 45 | VDUP(vector, , float, f, 32, 2, 2.3f); 46 | VDUP(vector, q, float, f, 32, 4, 3.4f); 47 | 48 | TEST_UNARY_OP(INSN_NAME, , float, f, 32, 2); 49 | TEST_UNARY_OP(INSN_NAME, q, float, f, 32, 4); 50 | 51 | fprintf(ref_file, "\nfloat32:\n"); 52 | DUMP_FP(TEST_MSG, float, 32, 2, PRIx32); 53 | DUMP_FP(TEST_MSG, float, 32, 4, PRIx32); 54 | } 55 | -------------------------------------------------------------------------------- /ref_vorn.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vorn 27 | #define TEST_MSG "VORN/VORNQ" 28 | 29 | #include "ref_v_binary_op.c" 30 | -------------------------------------------------------------------------------- /ref_vorr.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vorr 27 | #define TEST_MSG "VORR/VORRQ" 28 | 29 | #include "ref_v_binary_op.c" 30 | -------------------------------------------------------------------------------- /ref_vpadd.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vpadd 36 | #define TEST_MSG "VPADD" 37 | #endif 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=OP(x), then store the result. */ 45 | #define TEST_VPADD1(INSN, T1, T2, W, N) \ 46 | VECT_VAR(vector_res, T1, W, N) = \ 47 | INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ 48 | VECT_VAR(vector, T1, W, N)); \ 49 | vst1##_##T2##W(VECT_VAR(result, T1, W, N), \ 50 | VECT_VAR(vector_res, T1, W, N)) 51 | 52 | #define TEST_VPADD(INSN, T1, T2, W, N) \ 53 | TEST_VPADD1(INSN, T1, T2, W, N) \ 54 | 55 | /* With ARM RVCT, we need to declare variables before any executable 56 | statement */ 57 | 58 | /* No need for 64 bits variants */ 59 | DECL_VARIABLE(vector, int, 8, 8); 60 | DECL_VARIABLE(vector, int, 16, 4); 61 | DECL_VARIABLE(vector, int, 32, 2); 62 | DECL_VARIABLE(vector, uint, 8, 8); 63 | DECL_VARIABLE(vector, uint, 16, 4); 64 | DECL_VARIABLE(vector, uint, 32, 2); 65 | DECL_VARIABLE(vector, float, 32, 2); 66 | 67 | DECL_VARIABLE(vector_res, int, 8, 8); 68 | DECL_VARIABLE(vector_res, int, 16, 4); 69 | DECL_VARIABLE(vector_res, int, 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, float, 32, 2); 74 | 75 | clean_results (); 76 | 77 | /* Initialize input "vector" from "buffer" */ 78 | VLOAD(vector, buffer, , int, s, 8, 8); 79 | VLOAD(vector, buffer, , int, s, 16, 4); 80 | VLOAD(vector, buffer, , int, s, 32, 2); 81 | VLOAD(vector, buffer, , uint, u, 8, 8); 82 | VLOAD(vector, buffer, , uint, u, 16, 4); 83 | VLOAD(vector, buffer, , uint, u, 32, 2); 84 | VLOAD(vector, buffer, , float, f, 32, 2); 85 | 86 | /* Apply a binary operator named INSN_NAME */ 87 | TEST_VPADD(INSN_NAME, int, s, 8, 8); 88 | TEST_VPADD(INSN_NAME, int, s, 16, 4); 89 | TEST_VPADD(INSN_NAME, int, s, 32, 2); 90 | TEST_VPADD(INSN_NAME, uint, u, 8, 8); 91 | TEST_VPADD(INSN_NAME, uint, u, 16, 4); 92 | TEST_VPADD(INSN_NAME, uint, u, 32, 2); 93 | TEST_VPADD(INSN_NAME, float, f, 32, 2); 94 | 95 | dump_results_hex (TEST_MSG); 96 | } 97 | -------------------------------------------------------------------------------- /ref_vpmax.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vpmax 27 | #define TEST_MSG "VPMAX" 28 | 29 | #include "ref_vpadd.c" 30 | -------------------------------------------------------------------------------- /ref_vpmin.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vpmin 27 | #define TEST_MSG "VPMIN" 28 | 29 | #include "ref_vpadd.c" 30 | -------------------------------------------------------------------------------- /ref_vqabs.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vqabs 27 | #define TEST_MSG "VQABS/VQABSQ" 28 | 29 | /* Extra tests for functions requiring corner cases tests */ 30 | void vqabs_extra(void); 31 | #define EXTRA_TESTS vqabs_extra 32 | 33 | #include "ref_v_unary_sat_op.c" 34 | 35 | void vqabs_extra() 36 | { 37 | /* No need for 64 bits variants */ 38 | DECL_VARIABLE(vector, int, 8, 8); 39 | DECL_VARIABLE(vector, int, 16, 4); 40 | DECL_VARIABLE(vector, int, 32, 2); 41 | DECL_VARIABLE(vector, int, 8, 16); 42 | DECL_VARIABLE(vector, int, 16, 8); 43 | DECL_VARIABLE(vector, int, 32, 4); 44 | 45 | DECL_VARIABLE(vector_res, int, 8, 8); 46 | DECL_VARIABLE(vector_res, int, 16, 4); 47 | DECL_VARIABLE(vector_res, int, 32, 2); 48 | DECL_VARIABLE(vector_res, int, 8, 16); 49 | DECL_VARIABLE(vector_res, int, 16, 8); 50 | DECL_VARIABLE(vector_res, int, 32, 4); 51 | 52 | clean_results (); 53 | 54 | /* Initialize input "vector" with max negative values to check 55 | saturation */ 56 | VDUP(vector, , int, s, 8, 8, 0x80); 57 | VDUP(vector, , int, s, 16, 4, 0x8000); 58 | VDUP(vector, , int, s, 32, 2, 0x80000000); 59 | VDUP(vector, q, int, s, 8, 16, 0x80); 60 | VDUP(vector, q, int, s, 16, 8, 0x8000); 61 | VDUP(vector, q, int, s, 32, 4, 0x80000000); 62 | 63 | /* Apply a unary operator named INSN_NAME */ 64 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 65 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8); 66 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4); 67 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2); 68 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16); 69 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8); 70 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4); 71 | 72 | dump_results_hex (TEST_MSG); 73 | } 74 | -------------------------------------------------------------------------------- /ref_vqdmlal.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vqdmlal 36 | #define TEST_MSG "VQDMLAL" 37 | #endif 38 | 39 | 40 | #define FNNAME1(NAME) void exec_ ## NAME (void) 41 | #define FNNAME(NAME) FNNAME1(NAME) 42 | 43 | FNNAME (INSN_NAME) 44 | { 45 | /* vector_res = OP(vector, vector3, vector4), 46 | then store the result. */ 47 | #define TEST_VQDMLXL1(INSN, T1, T2, W, W2, N) \ 48 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ 49 | VECT_VAR(vector_res, T1, W, N) = \ 50 | INSN##_##T2##W2(VECT_VAR(vector, T1, W, N), \ 51 | VECT_VAR(vector3, T1, W2, N), \ 52 | VECT_VAR(vector4, T1, W2, N)); \ 53 | vst1q_##T2##W(VECT_VAR(result, T1, W, N), \ 54 | VECT_VAR(vector_res, T1, W, N)); \ 55 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_##T2##W2), \ 56 | xSTR(T1), W, N) 57 | 58 | #define TEST_VQDMLXL(INSN, T1, T2, W, W2, N) \ 59 | TEST_VQDMLXL1(INSN, T1, T2, W, W2, N) 60 | 61 | /* With ARM RVCT, we need to declare variables before any executable 62 | statement */ 63 | DECL_VARIABLE(vector, int, 32, 4); 64 | DECL_VARIABLE(vector3, int, 16, 4); 65 | DECL_VARIABLE(vector4, int, 16, 4); 66 | DECL_VARIABLE(vector_res, int, 32, 4); 67 | DECL_VARIABLE(vector, int, 64, 2); 68 | DECL_VARIABLE(vector3, int, 32, 2); 69 | DECL_VARIABLE(vector4, int, 32, 2); 70 | DECL_VARIABLE(vector_res, int, 64, 2); 71 | 72 | clean_results (); 73 | 74 | VLOAD(vector, buffer, q, int, s, 32, 4); 75 | VLOAD(vector, buffer, q, int, s, 64, 2); 76 | 77 | VDUP(vector3, , int, s, 16, 4, 0x55); 78 | VDUP(vector4, , int, s, 16, 4, 0xBB); 79 | VDUP(vector3, , int, s, 32, 2, 0x55); 80 | VDUP(vector4, , int, s, 32, 2, 0xBB); 81 | 82 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 83 | TEST_VQDMLXL(INSN_NAME, int, s, 32, 16, 4); 84 | TEST_VQDMLXL(INSN_NAME, int, s, 64, 32, 2); 85 | dump_results_hex (TEST_MSG); 86 | 87 | 88 | VDUP(vector3, , int, s, 16, 4, 0x8000); 89 | VDUP(vector4, , int, s, 16, 4, 0x8000); 90 | VDUP(vector3, , int, s, 32, 2, 0x80000000); 91 | VDUP(vector4, , int, s, 32, 2, 0x80000000); 92 | 93 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 94 | TEST_MSG " (check mul cumulative saturation)"); 95 | TEST_VQDMLXL(INSN_NAME, int, s, 32, 16, 4); 96 | TEST_VQDMLXL(INSN_NAME, int, s, 64, 32, 2); 97 | dump_results_hex2 (TEST_MSG, " (check mul cumulative saturation)"); 98 | } 99 | -------------------------------------------------------------------------------- /ref_vqdmlal_n.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vqdmlal_n 36 | #define TEST_MSG "VQDMLAL_N" 37 | #endif 38 | 39 | #define FNNAME1(NAME) void exec_ ## NAME (void) 40 | #define FNNAME(NAME) FNNAME1(NAME) 41 | 42 | FNNAME (INSN_NAME) 43 | { 44 | /* vector_res = vqdmlxl_n(vector, vector3, val), 45 | then store the result. */ 46 | #define TEST_VQDMLXL_N1(INSN, T1, T2, W, W2, N, V) \ 47 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ 48 | VECT_VAR(vector_res, T1, W, N) = \ 49 | INSN##_##T2##W2(VECT_VAR(vector, T1, W, N), \ 50 | VECT_VAR(vector3, T1, W2, N), \ 51 | V); \ 52 | vst1q_##T2##W(VECT_VAR(result, T1, W, N), \ 53 | VECT_VAR(vector_res, T1, W, N)); \ 54 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_##T2##W2), \ 55 | xSTR(T1), W, N) 56 | 57 | #define TEST_VQDMLXL_N(INSN, T1, T2, W, W2, N, V) \ 58 | TEST_VQDMLXL_N1(INSN, T1, T2, W, W2, N, V) 59 | 60 | /* With ARM RVCT, we need to declare variables before any executable 61 | statement */ 62 | DECL_VARIABLE(vector, int, 32, 4); 63 | DECL_VARIABLE(vector3, int, 16, 4); 64 | DECL_VARIABLE(vector_res, int, 32, 4); 65 | 66 | DECL_VARIABLE(vector, int, 64, 2); 67 | DECL_VARIABLE(vector3, int, 32, 2); 68 | DECL_VARIABLE(vector_res, int, 64, 2); 69 | 70 | clean_results (); 71 | 72 | VLOAD(vector, buffer, q, int, s, 32, 4); 73 | VLOAD(vector, buffer, q, int, s, 64, 2); 74 | 75 | VDUP(vector3, , int, s, 16, 4, 0x55); 76 | VDUP(vector3, , int, s, 32, 2, 0x55); 77 | 78 | /* Choose val arbitrarily */ 79 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 80 | TEST_VQDMLXL_N(INSN_NAME, int, s, 32, 16, 4, 0x22); 81 | TEST_VQDMLXL_N(INSN_NAME, int, s, 64, 32, 2, 0x33); 82 | 83 | dump_results_hex (TEST_MSG); 84 | 85 | VDUP(vector3, , int, s, 16, 4, 0x8000); 86 | VDUP(vector3, , int, s, 32, 2, 0x80000000); 87 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 88 | TEST_MSG " (check mul cumulative saturation)"); 89 | TEST_VQDMLXL_N(INSN_NAME, int, s, 32, 16, 4, 0x8000); 90 | TEST_VQDMLXL_N(INSN_NAME, int, s, 64, 32, 2, 0x80000000); 91 | dump_results_hex2 (TEST_MSG, " (check mul cumulative saturation)"); 92 | } 93 | -------------------------------------------------------------------------------- /ref_vqdmlsl.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vqdmlsl 27 | #define TEST_MSG "VQDMLSL" 28 | 29 | #include "ref_vqdmlal.c" 30 | -------------------------------------------------------------------------------- /ref_vqdmlsl_lane.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vqdmlsl_lane 27 | #define TEST_MSG "VQDMLSL_LANE" 28 | 29 | #include "ref_vqdmlal_lane.c" 30 | -------------------------------------------------------------------------------- /ref_vqdmlsl_n.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vqdmlsl_n 27 | #define TEST_MSG "VQDMLSL_N" 28 | 29 | #include "ref_vqdmlal_n.c" 30 | -------------------------------------------------------------------------------- /ref_vqdmull.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN vqdmull 35 | #define TEST_MSG "VQDMULL" 36 | #define FNNAME1(NAME) void exec_ ## NAME (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN) 40 | { 41 | /* Basic test: y=vqdmull(x,x), then store the result. */ 42 | #define TEST_VQDMULL2(INSN, T1, T2, W, W2, N) \ 43 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W2, N)); \ 44 | VECT_VAR(vector_res, T1, W2, N) = \ 45 | INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ 46 | VECT_VAR(vector2, T1, W, N)); \ 47 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), \ 48 | VECT_VAR(vector_res, T1, W2, N)); \ 49 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_##T2##W), \ 50 | xSTR(T1), W, N) 51 | 52 | /* Two auxliary macros are necessary to expand INSN */ 53 | #define TEST_VQDMULL1(INSN, T1, T2, W, W2, N) \ 54 | TEST_VQDMULL2(INSN, T1, T2, W, W2, N) 55 | 56 | #define TEST_VQDMULL(T1, T2, W, W2, N) \ 57 | TEST_VQDMULL1(INSN, T1, T2, W, W2, N) 58 | 59 | 60 | /* With ARM RVCT, we need to declare variables before any executable 61 | statement */ 62 | DECL_VARIABLE(vector, int, 16, 4); 63 | DECL_VARIABLE(vector, int, 32, 2); 64 | DECL_VARIABLE(vector2, int, 16, 4); 65 | DECL_VARIABLE(vector2, int, 32, 2); 66 | DECL_VARIABLE(vector_res, int, 32, 4); 67 | DECL_VARIABLE(vector_res, int, 64, 2); 68 | 69 | clean_results (); 70 | 71 | VLOAD(vector, buffer, , int, s, 16, 4); 72 | VLOAD(vector, buffer, , int, s, 32, 2); 73 | VLOAD(vector2, buffer, , int, s, 16, 4); 74 | VLOAD(vector2, buffer, , int, s, 32, 2); 75 | 76 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 77 | TEST_VQDMULL(int, s, 16, 32, 4); 78 | TEST_VQDMULL(int, s, 32, 64, 2); 79 | 80 | /* FIXME: only a few result buffers are used, but we output all of them */ 81 | dump_results_hex (TEST_MSG); 82 | 83 | 84 | VDUP(vector, , int, s, 16, 4, 0x8000); 85 | VDUP(vector2, , int, s, 16, 4, 0x8000); 86 | VDUP(vector, , int, s, 32, 2, 0x80000000); 87 | VDUP(vector2, , int, s, 32, 2, 0x80000000); 88 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 89 | TEST_MSG " (check mul cumulative saturation)"); 90 | TEST_VQDMULL(int, s, 16, 32, 4); 91 | TEST_VQDMULL(int, s, 32, 64, 2); 92 | dump_results_hex2 (TEST_MSG, " (check mul cumulative saturation)"); 93 | } 94 | -------------------------------------------------------------------------------- /ref_vqdmull_lane.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN vqdmull 35 | #define TEST_MSG "VQDMULL_LANE" 36 | #define FNNAME1(NAME) void exec_ ## NAME ## _lane (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN) 40 | { 41 | int i; 42 | 43 | /* vector_res = vqdmull_lane(vector,vector2,lane), then store the result. */ 44 | #define TEST_VQDMULL_LANE2(INSN, T1, T2, W, W2, N, L) \ 45 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W2, N)); \ 46 | VECT_VAR(vector_res, T1, W2, N) = \ 47 | INSN##_lane_##T2##W(VECT_VAR(vector, T1, W, N), \ 48 | VECT_VAR(vector2, T1, W, N), \ 49 | L); \ 50 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), \ 51 | VECT_VAR(vector_res, T1, W2, N)); \ 52 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_lane_##T2##W), \ 53 | xSTR(T1), W, N) 54 | 55 | /* Two auxliary macros are necessary to expand INSN */ 56 | #define TEST_VQDMULL_LANE1(INSN, T1, T2, W, W2, N, L) \ 57 | TEST_VQDMULL_LANE2(INSN, T1, T2, W, W2, N, L) 58 | 59 | #define TEST_VQDMULL_LANE(T1, T2, W, W2, N, L) \ 60 | TEST_VQDMULL_LANE1(INSN, T1, T2, W, W2, N, L) 61 | 62 | 63 | /* With ARM RVCT, we need to declare variables before any executable 64 | statement */ 65 | DECL_VARIABLE(vector, int, 16, 4); 66 | DECL_VARIABLE(vector, int, 32, 2); 67 | DECL_VARIABLE(vector2, int, 16, 4); 68 | DECL_VARIABLE(vector2, int, 32, 2); 69 | 70 | DECL_VARIABLE(vector_res, int, 32, 4); 71 | DECL_VARIABLE(vector_res, int, 64, 2); 72 | 73 | clean_results (); 74 | 75 | /* Initialize vector */ 76 | VDUP(vector, , int, s, 16, 4, 0x1000); 77 | VDUP(vector, , int, s, 32, 2, 0x1000); 78 | 79 | /* Initialize vector2 */ 80 | VDUP(vector2, , int, s, 16, 4, 0x4); 81 | VDUP(vector2, , int, s, 32, 2, 0x2); 82 | 83 | /* Choose lane arbitrarily */ 84 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 85 | TEST_VQDMULL_LANE(int, s, 16, 32, 4, 2); 86 | TEST_VQDMULL_LANE(int, s, 32, 64, 2, 1); 87 | 88 | 89 | fprintf(ref_file, "\n%s output:\n", TEST_MSG); 90 | fprintf(gcc_tests_file, "\n%s output:\n", TEST_MSG); 91 | DUMP(TEST_MSG, int, 32, 4, PRIx32); 92 | DUMP(TEST_MSG, int, 64, 2, PRIx64); 93 | 94 | 95 | 96 | VDUP(vector, , int, s, 16, 4, 0x8000); 97 | VDUP(vector2, , int, s, 16, 4, 0x8000); 98 | VDUP(vector, , int, s, 32, 2, 0x80000000); 99 | VDUP(vector2, , int, s, 32, 2, 0x80000000); 100 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 101 | TEST_MSG " (check mul cumulative saturation)"); 102 | TEST_VQDMULL_LANE(int, s, 16, 32, 4, 2); 103 | TEST_VQDMULL_LANE(int, s, 32, 64, 2, 1); 104 | 105 | fprintf (ref_file, "\n%s output:\n", 106 | TEST_MSG " (check mul cumulative saturation)"); 107 | DUMP(TEST_MSG, int, 32, 4, PRIx32); 108 | DUMP(TEST_MSG, int, 64, 2, PRIx64); 109 | } 110 | -------------------------------------------------------------------------------- /ref_vqdmull_n.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN vqdmull 35 | #define TEST_MSG "VQDMULL_N" 36 | #define FNNAME1(NAME) void exec_ ## NAME ## _n (void) 37 | #define FNNAME(NAME) FNNAME1(NAME) 38 | 39 | FNNAME (INSN) 40 | { 41 | int i; 42 | 43 | /* vector_res = vqdmull_n(vector,val), then store the result. */ 44 | #define TEST_VQDMULL_N2(INSN, T1, T2, W, W2, N, L) \ 45 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W2, N)); \ 46 | VECT_VAR(vector_res, T1, W2, N) = \ 47 | INSN##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 48 | L); \ 49 | vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), \ 50 | VECT_VAR(vector_res, T1, W2, N)); \ 51 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_n_##T2##W), \ 52 | xSTR(T1), W, N) 53 | 54 | /* Two auxliary macros are necessary to expand INSN */ 55 | #define TEST_VQDMULL_N1(INSN, T1, T2, W, W2, N, L) \ 56 | TEST_VQDMULL_N2(INSN, T1, T2, W, W2, N, L) 57 | 58 | #define TEST_VQDMULL_N(T1, T2, W, W2, N, L) \ 59 | TEST_VQDMULL_N1(INSN, T1, T2, W, W2, N, L) 60 | 61 | 62 | /* With ARM RVCT, we need to declare variables before any executable 63 | statement */ 64 | DECL_VARIABLE(vector, int, 16, 4); 65 | DECL_VARIABLE(vector, int, 32, 2); 66 | DECL_VARIABLE(vector2, int, 16, 4); 67 | DECL_VARIABLE(vector2, int, 32, 2); 68 | 69 | DECL_VARIABLE(vector_res, int, 32, 4); 70 | DECL_VARIABLE(vector_res, int, 64, 2); 71 | 72 | clean_results (); 73 | 74 | /* Initialize vector */ 75 | VDUP(vector, , int, s, 16, 4, 0x1000); 76 | VDUP(vector, , int, s, 32, 2, 0x1000); 77 | 78 | /* Initialize vector2 */ 79 | VDUP(vector2, , int, s, 16, 4, 0x4); 80 | VDUP(vector2, , int, s, 32, 2, 0x2); 81 | 82 | /* Choose multiplier arbitrarily */ 83 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 84 | TEST_VQDMULL_N(int, s, 16, 32, 4, 0x22); 85 | TEST_VQDMULL_N(int, s, 32, 64, 2, 0x55); 86 | 87 | fprintf(ref_file, "\n%s output:\n", TEST_MSG); 88 | fprintf(gcc_tests_file, "\n%s output:\n", TEST_MSG); 89 | DUMP(TEST_MSG, int, 32, 4, PRIx32); 90 | DUMP(TEST_MSG, int, 64, 2, PRIx64); 91 | 92 | 93 | VDUP(vector, , int, s, 16, 4, 0x8000); 94 | VDUP(vector, , int, s, 32, 2, 0x80000000); 95 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 96 | TEST_MSG " (check mul cumulative saturation)"); 97 | TEST_VQDMULL_N(int, s, 16, 32, 4, 0x8000); 98 | TEST_VQDMULL_N(int, s, 32, 64, 2, 0x80000000); 99 | 100 | fprintf(ref_file, "\n%s output:\n", 101 | TEST_MSG " (check mul cumulative saturation)"); 102 | DUMP(TEST_MSG, int, 32, 4, PRIx32); 103 | DUMP(TEST_MSG, int, 64, 2, PRIx64); 104 | } 105 | -------------------------------------------------------------------------------- /ref_vqmovun.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, 2010, 2011, 2012 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define INSN_NAME vqmovun 35 | #define TEST_MSG "VQMOVUN" 36 | 37 | #define FNNAME1(NAME) void exec_ ## NAME (void) 38 | #define FNNAME(NAME) FNNAME1(NAME) 39 | 40 | FNNAME (INSN_NAME) 41 | { 42 | /* Basic test: y=OP(x), then store the result. */ 43 | #define TEST_UNARY_OP1(INSN, T1, T2, W, W2, N) \ 44 | Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \ 45 | VECT_VAR(vector_res, T1, W, N) = \ 46 | INSN##_s##W2(VECT_VAR(vector, int, W2, N)); \ 47 | vst1##_##T2##W(VECT_VAR(result, T1, W, N), \ 48 | VECT_VAR(vector_res, T1, W, N)); \ 49 | dump_neon_cumulative_sat(TEST_MSG, xSTR(INSN##_s##W2), \ 50 | xSTR(T1), W, N) 51 | 52 | #define TEST_UNARY_OP(INSN, T1, T2, W, W2, N) \ 53 | TEST_UNARY_OP1(INSN, T1, T2, W, W2, N) \ 54 | 55 | /* With ARM RVCT, we need to declare variables before any executable 56 | statement */ 57 | 58 | /* No need for 64 bits variants */ 59 | DECL_VARIABLE(vector, int, 16, 8); 60 | DECL_VARIABLE(vector, int, 32, 4); 61 | DECL_VARIABLE(vector, int, 64, 2); 62 | 63 | DECL_VARIABLE(vector_res, uint, 8, 8); 64 | DECL_VARIABLE(vector_res, uint, 16, 4); 65 | DECL_VARIABLE(vector_res, uint, 32, 2); 66 | 67 | clean_results (); 68 | 69 | /* Fill input vector with arbitrary values */ 70 | VDUP(vector, q, int, s, 16, 8, 0x34); 71 | VDUP(vector, q, int, s, 32, 4, 0x5678); 72 | VDUP(vector, q, int, s, 64, 2, 0x12345678); 73 | 74 | /* Apply a unary operator named INSN_NAME */ 75 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 76 | TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8); 77 | TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4); 78 | TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2); 79 | 80 | dump_results_hex (TEST_MSG); 81 | 82 | /* Fill input vector with negative values */ 83 | VDUP(vector, q, int, s, 16, 8, 0x8234); 84 | VDUP(vector, q, int, s, 32, 4, 0x87654321); 85 | VDUP(vector, q, int, s, 64, 2, 0x8765432187654321LL); 86 | 87 | /* Apply a unary operator named INSN_NAME */ 88 | fprintf(ref_file, "\n%s cumulative saturation output:\n", 89 | TEST_MSG " (negative input)"); 90 | TEST_UNARY_OP(INSN_NAME, uint, u, 8, 16, 8); 91 | TEST_UNARY_OP(INSN_NAME, uint, u, 16, 32, 4); 92 | TEST_UNARY_OP(INSN_NAME, uint, u, 32, 64, 2); 93 | 94 | dump_results_hex2 (TEST_MSG, " (negative input)"); 95 | } 96 | -------------------------------------------------------------------------------- /ref_vqneg.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vqneg 27 | #define TEST_MSG "VQNEG/VQNEGQ" 28 | 29 | /* Extra tests for functions requiring corner cases tests */ 30 | void vqneg_extra(void); 31 | #define EXTRA_TESTS vqneg_extra 32 | 33 | #include "ref_v_unary_sat_op.c" 34 | 35 | void vqneg_extra() 36 | { 37 | /* No need for 64 bits variants */ 38 | DECL_VARIABLE(vector, int, 8, 8); 39 | DECL_VARIABLE(vector, int, 16, 4); 40 | DECL_VARIABLE(vector, int, 32, 2); 41 | DECL_VARIABLE(vector, int, 8, 16); 42 | DECL_VARIABLE(vector, int, 16, 8); 43 | DECL_VARIABLE(vector, int, 32, 4); 44 | 45 | DECL_VARIABLE(vector_res, int, 8, 8); 46 | DECL_VARIABLE(vector_res, int, 16, 4); 47 | DECL_VARIABLE(vector_res, int, 32, 2); 48 | DECL_VARIABLE(vector_res, int, 8, 16); 49 | DECL_VARIABLE(vector_res, int, 16, 8); 50 | DECL_VARIABLE(vector_res, int, 32, 4); 51 | 52 | clean_results (); 53 | 54 | /* Initialize input "vector" with max negative values to check 55 | saturation */ 56 | VDUP(vector, , int, s, 8, 8, 0x80); 57 | VDUP(vector, , int, s, 16, 4, 0x8000); 58 | VDUP(vector, , int, s, 32, 2, 0x80000000); 59 | VDUP(vector, q, int, s, 8, 16, 0x80); 60 | VDUP(vector, q, int, s, 16, 8, 0x8000); 61 | VDUP(vector, q, int, s, 32, 4, 0x80000000); 62 | 63 | /* Apply a unary operator named INSN_NAME */ 64 | fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG); 65 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8); 66 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4); 67 | TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2); 68 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16); 69 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8); 70 | TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4); 71 | 72 | dump_results_hex (TEST_MSG); 73 | } 74 | -------------------------------------------------------------------------------- /ref_vraddhn.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vraddhn 27 | #define TEST_MSG "VRADDHN" 28 | 29 | #include "ref_vaddhn.c" 30 | -------------------------------------------------------------------------------- /ref_vrev.c: -------------------------------------------------------------------------------- 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 | /* Template file for unary operator validation */ 27 | 28 | #if defined(__arm__) || defined(__aarch64__) 29 | #include 30 | #else 31 | #include "stm-arm-neon.h" 32 | #endif 33 | 34 | #include "stm-arm-neon-ref.h" 35 | 36 | void exec_vrev (void) 37 | { 38 | /* Basic test: y=vrev(x), then store the result. */ 39 | #define TEST_VREV(Q, T1, T2, W, N, W2) \ 40 | VECT_VAR(vector_res, T1, W, N) = \ 41 | vrev##W2##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \ 42 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 49 | 50 | clean_results (); 51 | 52 | /* Initialize input "vector" from "buffer" */ 53 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 54 | VLOAD(vector, buffer, , float, f, 32, 2); 55 | VLOAD(vector, buffer, q, float, f, 32, 4); 56 | 57 | /* Check vrev in each of the existing combinations */ 58 | #define TEST_MSG "VREV16" 59 | TEST_VREV(, int, s, 8, 8, 16); 60 | TEST_VREV(, uint, u, 8, 8, 16); 61 | TEST_VREV(, poly, p, 8, 8, 16); 62 | TEST_VREV(q, int, s, 8, 16, 16); 63 | TEST_VREV(q, uint, u, 8, 16, 16); 64 | TEST_VREV(q, poly, p, 8, 16, 16); 65 | dump_results_hex (TEST_MSG); 66 | 67 | #undef TEST_MSG 68 | #define TEST_MSG "VREV32" 69 | TEST_VREV(, int, s, 8, 8, 32); 70 | TEST_VREV(, int, s, 16, 4, 32); 71 | TEST_VREV(, uint, u, 8, 8, 32); 72 | TEST_VREV(, uint, u, 16, 4, 32); 73 | TEST_VREV(, poly, p, 8, 8, 32); 74 | TEST_VREV(, poly, p, 16, 4, 32); 75 | TEST_VREV(q, int, s, 8, 16, 32); 76 | TEST_VREV(q, int, s, 16, 8, 32); 77 | TEST_VREV(q, uint, u, 8, 16, 32); 78 | TEST_VREV(q, uint, u, 16, 8, 32); 79 | TEST_VREV(q, poly, p, 8, 16, 32); 80 | TEST_VREV(q, poly, p, 16, 8, 32); 81 | dump_results_hex (TEST_MSG); 82 | 83 | #undef TEST_MSG 84 | #define TEST_MSG "VREV64" 85 | TEST_VREV(, int, s, 8, 8, 64); 86 | TEST_VREV(, int, s, 16, 4, 64); 87 | TEST_VREV(, int, s, 32, 2, 64); 88 | TEST_VREV(, uint, u, 8, 8, 64); 89 | TEST_VREV(, uint, u, 16, 4, 64); 90 | TEST_VREV(, uint, u, 32, 2, 64); 91 | TEST_VREV(, poly, p, 8, 8, 64); 92 | TEST_VREV(, poly, p, 16, 4, 64); 93 | TEST_VREV(q, int, s, 8, 16, 64); 94 | TEST_VREV(q, int, s, 16, 8, 64); 95 | TEST_VREV(q, int, s, 32, 4, 64); 96 | TEST_VREV(q, uint, u, 8, 16, 64); 97 | TEST_VREV(q, uint, u, 16, 8, 64); 98 | TEST_VREV(q, uint, u, 32, 4, 64); 99 | TEST_VREV(q, poly, p, 8, 16, 64); 100 | TEST_VREV(q, poly, p, 16, 8, 64); 101 | 102 | TEST_VREV(, float, f, 32, 2, 64); 103 | TEST_VREV(q, float, f, 32, 4, 64); 104 | 105 | dump_results_hex (TEST_MSG); 106 | } 107 | -------------------------------------------------------------------------------- /ref_vrhadd.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vrhadd 27 | #define TEST_MSG "VRHADD/VRHADDQ" 28 | 29 | #define NO_FLOAT_VARIANT 30 | 31 | #include "ref_vmax.c" 32 | -------------------------------------------------------------------------------- /ref_vrsubhn.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vrsubhn 27 | #define TEST_MSG "VRSUBHN" 28 | 29 | #include "ref_vaddhn.c" 30 | -------------------------------------------------------------------------------- /ref_vset_lane.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSET_LANE/VSET_LANEQ" 35 | void exec_vset_lane (void) 36 | { 37 | /* vec=vset_lane(val, vec, lane), then store the result. */ 38 | #define TEST_VSET_LANE_HERE(Q, T1, T2, W, N, V, L) \ 39 | VECT_VAR(vector, T1, W, N) = \ 40 | vset##Q##_lane_##T2##W(V, \ 41 | VECT_VAR(vector, T1, W, N), \ 42 | L); \ 43 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector, T1, W, N)) 44 | 45 | /* With ARM RVCT, we need to declare variables before any executable 46 | statement */ 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | 49 | clean_results (); 50 | 51 | /* Initialize input "vector" from "buffer" */ 52 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 53 | VLOAD(vector, buffer, , float, f, 32, 2); 54 | VLOAD(vector, buffer, q, float, f, 32, 4); 55 | 56 | /* Choose value and lane arbitrarily */ 57 | TEST_VSET_LANE_HERE(, int, s, 8, 8, 0x11, 7); 58 | TEST_VSET_LANE_HERE(, int, s, 16, 4, 0x22, 3); 59 | TEST_VSET_LANE_HERE(, int, s, 32, 2, 0x33, 1); 60 | TEST_VSET_LANE_HERE(, int, s, 64, 1, 0x44, 0); 61 | TEST_VSET_LANE_HERE(, uint, u, 8, 8, 0x55, 6); 62 | TEST_VSET_LANE_HERE(, uint, u, 16, 4, 0x66, 2); 63 | TEST_VSET_LANE_HERE(, uint, u, 32, 2, 0x77, 1); 64 | TEST_VSET_LANE_HERE(, uint, u, 64, 1, 0x88, 0); 65 | TEST_VSET_LANE_HERE(, poly, p, 8, 8, 0x55, 6); 66 | TEST_VSET_LANE_HERE(, poly, p, 16, 4, 0x66, 2); 67 | TEST_VSET_LANE_HERE(, float, f, 32, 2, 33.2f, 1); 68 | 69 | TEST_VSET_LANE_HERE(q, int, s, 8, 16, 0x99, 15); 70 | TEST_VSET_LANE_HERE(q, int, s, 16, 8, 0xAA, 5); 71 | TEST_VSET_LANE_HERE(q, int, s, 32, 4, 0xBB, 3); 72 | TEST_VSET_LANE_HERE(q, int, s, 64, 2, 0xCC, 1); 73 | TEST_VSET_LANE_HERE(q, uint, u, 8, 16, 0xDD, 14); 74 | TEST_VSET_LANE_HERE(q, uint, u, 16, 8, 0xEE, 6); 75 | TEST_VSET_LANE_HERE(q, uint, u, 32, 4, 0xFF, 2); 76 | TEST_VSET_LANE_HERE(q, uint, u, 64, 2, 0x11, 1); 77 | TEST_VSET_LANE_HERE(q, poly, p, 8, 16, 0xDD, 14); 78 | TEST_VSET_LANE_HERE(q, poly, p, 16, 8, 0xEE, 6); 79 | TEST_VSET_LANE_HERE(q, float, f, 32, 4, 11.2f, 3); 80 | 81 | dump_results_hex (TEST_MSG); 82 | } 83 | -------------------------------------------------------------------------------- /ref_vshl.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSHL/VSHLQ" 35 | void exec_vshl (void) 36 | { 37 | /* Basic test: v3=vshl(v1,v2), then store the result. */ 38 | #define TEST_VSHL(T3, Q, T1, T2, W, N) \ 39 | VECT_VAR(vector_res, T1, W, N) = \ 40 | vshl##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | VECT_VAR(vector_shift, T3, W, N)); \ 42 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | DECL_VARIABLE_ALL_VARIANTS(vector); 47 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 48 | 49 | DECL_VARIABLE_SIGNED_VARIANTS(vector_shift); 50 | 51 | clean_results (); 52 | 53 | /* Initialize input "vector" from "buffer" */ 54 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 55 | 56 | /* Choose init value arbitrarily, will be used as shift amount */ 57 | VDUP(vector_shift, , int, s, 8, 8, 1); 58 | VDUP(vector_shift, , int, s, 16, 4, 3); 59 | VDUP(vector_shift, , int, s, 32, 2, 8); 60 | VDUP(vector_shift, , int, s, 64, 1, 3); 61 | VDUP(vector_shift, q, int, s, 8, 16, 5); 62 | VDUP(vector_shift, q, int, s, 16, 8, 12); 63 | VDUP(vector_shift, q, int, s, 32, 4, 30); 64 | VDUP(vector_shift, q, int, s, 64, 2, 63); 65 | 66 | TEST_MACRO_ALL_VARIANTS_1_5(TEST_VSHL, int); 67 | 68 | dump_results_hex (TEST_MSG); 69 | 70 | /* Test large shift amount */ 71 | VDUP(vector_shift, , int, s, 8, 8, 8); 72 | VDUP(vector_shift, , int, s, 16, 4, 16); 73 | VDUP(vector_shift, , int, s, 32, 2, 32); 74 | VDUP(vector_shift, , int, s, 64, 1, 64); 75 | VDUP(vector_shift, q, int, s, 8, 16, 8); 76 | VDUP(vector_shift, q, int, s, 16, 8, 17); 77 | VDUP(vector_shift, q, int, s, 32, 4, 33); 78 | VDUP(vector_shift, q, int, s, 64, 2, 65); 79 | 80 | TEST_MACRO_ALL_VARIANTS_1_5(TEST_VSHL, int); 81 | 82 | dump_results_hex2 (TEST_MSG, " (large shift amount)"); 83 | 84 | 85 | /* Test negative shift amount */ 86 | VDUP(vector_shift, , int, s, 8, 8, -1); 87 | VDUP(vector_shift, , int, s, 16, 4, -1); 88 | VDUP(vector_shift, , int, s, 32, 2, -2); 89 | VDUP(vector_shift, , int, s, 64, 1, -4); 90 | VDUP(vector_shift, q, int, s, 8, 16, -2); 91 | VDUP(vector_shift, q, int, s, 16, 8, -5); 92 | VDUP(vector_shift, q, int, s, 32, 4, -3); 93 | VDUP(vector_shift, q, int, s, 64, 2, -5); 94 | 95 | TEST_MACRO_ALL_VARIANTS_1_5(TEST_VSHL, int); 96 | 97 | dump_results_hex2 (TEST_MSG, " (negative shift amount)"); 98 | } 99 | -------------------------------------------------------------------------------- /ref_vshl_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSHL_N" 35 | void exec_vshl_n (void) 36 | { 37 | /* Basic test: v2=vshl_n(v1,v), then store the result. */ 38 | #define TEST_VSHL_N(Q, T1, T2, W, N, V) \ 39 | VECT_VAR(vector_res, T1, W, N) = \ 40 | vshl##Q##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | V); \ 42 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 49 | 50 | clean_results (); 51 | 52 | /* Initialize input "vector" from "buffer" */ 53 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 54 | 55 | /* Choose shift amount arbitrarily */ 56 | TEST_VSHL_N(, int, s, 8, 8, 1); 57 | TEST_VSHL_N(, int, s, 16, 4, 1); 58 | TEST_VSHL_N(, int, s, 32, 2, 3); 59 | TEST_VSHL_N(, int, s, 64, 1, 2); 60 | TEST_VSHL_N(, uint, u, 8, 8, 2); 61 | TEST_VSHL_N(, uint, u, 16, 4, 4); 62 | TEST_VSHL_N(, uint, u, 32, 2, 3); 63 | TEST_VSHL_N(, uint, u, 64, 1, 1); 64 | 65 | TEST_VSHL_N(q, int, s, 8, 16, 5); 66 | TEST_VSHL_N(q, int, s, 16, 8, 1); 67 | TEST_VSHL_N(q, int, s, 32, 4, 2); 68 | TEST_VSHL_N(q, int, s, 64, 2, 2); 69 | TEST_VSHL_N(q, uint, u, 8, 16, 2); 70 | TEST_VSHL_N(q, uint, u, 16, 8, 3); 71 | TEST_VSHL_N(q, uint, u, 32, 4, 2); 72 | TEST_VSHL_N(q, uint, u, 64, 2, 1); 73 | 74 | dump_results_hex (TEST_MSG); 75 | } 76 | -------------------------------------------------------------------------------- /ref_vshll_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSHLL_N" 35 | void exec_vshll_n (void) 36 | { 37 | /* Basic test: v2=vshll_n(v1,v), then store the result. */ 38 | #define TEST_VSHLL_N(T1, T2, W, W2, N, V) \ 39 | VECT_VAR(vector_res, T1, W2, N) = \ 40 | vshll##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | V); \ 42 | vst1q##_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 49 | 50 | clean_results (); 51 | 52 | /* Initialize input "vector" from "buffer" */ 53 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 54 | 55 | /* Choose shift amount arbitrarily */ 56 | TEST_VSHLL_N(int, s, 8, 16, 8, 1); 57 | TEST_VSHLL_N(int, s, 16, 32, 4, 1); 58 | TEST_VSHLL_N(int, s, 32, 64, 2, 3); 59 | TEST_VSHLL_N(uint, u, 8, 16, 8, 2); 60 | TEST_VSHLL_N(uint, u, 16, 32, 4, 4); 61 | TEST_VSHLL_N(uint, u, 32, 64, 2, 3); 62 | 63 | dump_results_hex (TEST_MSG); 64 | } 65 | -------------------------------------------------------------------------------- /ref_vshr_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSHR_N" 35 | void exec_vshr_n (void) 36 | { 37 | /* Basic test: y=vshr_n(x,v), then store the result. */ 38 | #define TEST_VSHR_N(Q, T1, T2, W, N, V) \ 39 | VECT_VAR(vector_res, T1, W, N) = \ 40 | vshr##Q##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | V); \ 42 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | 47 | DECL_VARIABLE_ALL_VARIANTS(vector); 48 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 49 | 50 | clean_results (); 51 | 52 | /* Initialize input "vector" from "buffer" */ 53 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 54 | 55 | /* Choose shift amount arbitrarily */ 56 | TEST_VSHR_N(, int, s, 8, 8, 1); 57 | TEST_VSHR_N(, int, s, 16, 4, 12); 58 | TEST_VSHR_N(, int, s, 32, 2, 2); 59 | TEST_VSHR_N(, int, s, 64, 1, 32); 60 | TEST_VSHR_N(, uint, u, 8, 8, 2); 61 | TEST_VSHR_N(, uint, u, 16, 4, 3); 62 | TEST_VSHR_N(, uint, u, 32, 2, 5); 63 | TEST_VSHR_N(, uint, u, 64, 1, 33); 64 | 65 | TEST_VSHR_N(q, int, s, 8, 16, 1); 66 | TEST_VSHR_N(q, int, s, 16, 8, 12); 67 | TEST_VSHR_N(q, int, s, 32, 4, 2); 68 | TEST_VSHR_N(q, int, s, 64, 2, 32); 69 | TEST_VSHR_N(q, uint, u, 8, 16, 2); 70 | TEST_VSHR_N(q, uint, u, 16, 8, 3); 71 | TEST_VSHR_N(q, uint, u, 32, 4, 5); 72 | TEST_VSHR_N(q, uint, u, 64, 2, 33); 73 | 74 | /* FIXME: only a few result buffers are used, but we output all of them */ 75 | dump_results_hex (TEST_MSG); 76 | } 77 | -------------------------------------------------------------------------------- /ref_vshrn_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSHRN_N" 35 | void exec_vshrn_n (void) 36 | { 37 | /* Basic test: y=vshrn_n(x,v), then store the result. */ 38 | #define TEST_VSHRN_N(T1, T2, W, W2, N, V) \ 39 | VECT_VAR(vector_res, T1, W2, N) = \ 40 | vshrn_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | V); \ 42 | vst1_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 43 | 44 | /* With ARM RVCT, we need to declare variables before any executable 45 | statement */ 46 | 47 | /* vector is twice as large as vector_res */ 48 | DECL_VARIABLE(vector, int, 16, 8); 49 | DECL_VARIABLE(vector, int, 32, 4); 50 | DECL_VARIABLE(vector, int, 64, 2); 51 | DECL_VARIABLE(vector, uint, 16, 8); 52 | DECL_VARIABLE(vector, uint, 32, 4); 53 | DECL_VARIABLE(vector, uint, 64, 2); 54 | 55 | DECL_VARIABLE(vector_res, int, 8, 8); 56 | DECL_VARIABLE(vector_res, int, 16, 4); 57 | DECL_VARIABLE(vector_res, int, 32, 2); 58 | DECL_VARIABLE(vector_res, uint, 8, 8); 59 | DECL_VARIABLE(vector_res, uint, 16, 4); 60 | DECL_VARIABLE(vector_res, uint, 32, 2); 61 | 62 | clean_results (); 63 | 64 | VLOAD(vector, buffer, q, int, s, 16, 8); 65 | VLOAD(vector, buffer, q, int, s, 32, 4); 66 | VLOAD(vector, buffer, q, int, s, 64, 2); 67 | VLOAD(vector, buffer, q, uint, u, 16, 8); 68 | VLOAD(vector, buffer, q, uint, u, 32, 4); 69 | VLOAD(vector, buffer, q, uint, u, 64, 2); 70 | 71 | /* Choose shift amount arbitrarily */ 72 | TEST_VSHRN_N(int, s, 16, 8, 8, 1); 73 | TEST_VSHRN_N(int, s, 32, 16, 4, 1); 74 | TEST_VSHRN_N(int, s, 64, 32, 2, 2); 75 | TEST_VSHRN_N(uint, u, 16, 8, 8, 2); 76 | TEST_VSHRN_N(uint, u, 32, 16, 4, 3); 77 | TEST_VSHRN_N(uint, u, 64, 32, 2, 3); 78 | 79 | /* FIXME: only a few result buffers are used, but we output all of them */ 80 | dump_results_hex (TEST_MSG); 81 | } 82 | -------------------------------------------------------------------------------- /ref_vsli_n.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsli 27 | #define TEST_MSG "VSLI_N" 28 | 29 | /* Extra tests for functions requiring corner cases tests */ 30 | void vsli_extra(void); 31 | #define EXTRA_TESTS vsli_extra 32 | 33 | #include "ref_vsXi_n.c" 34 | 35 | void vsli_extra(void) 36 | { 37 | /* Test cases with maximum shift amount (this amount is different 38 | from vsri). */ 39 | 40 | /* With ARM RVCT, we need to declare variables before any executable 41 | statement */ 42 | DECL_VARIABLE_ALL_VARIANTS(vector); 43 | DECL_VARIABLE_ALL_VARIANTS(vector2); 44 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 45 | 46 | clean_results (); 47 | 48 | /* Initialize input "vector" from "buffer" */ 49 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 50 | 51 | /* Fill input vector2 with arbitrary values */ 52 | VDUP(vector2, , int, s, 8, 8, 2); 53 | VDUP(vector2, , int, s, 16, 4, -4); 54 | VDUP(vector2, , int, s, 32, 2, 3); 55 | VDUP(vector2, , int, s, 64, 1, 100); 56 | VDUP(vector2, , uint, u, 8, 8, 20); 57 | VDUP(vector2, , uint, u, 16, 4, 30); 58 | VDUP(vector2, , uint, u, 32, 2, 40); 59 | VDUP(vector2, , uint, u, 64, 1, 2); 60 | VDUP(vector2, , poly, p, 8, 8, 20); 61 | VDUP(vector2, , poly, p, 16, 4, 30); 62 | VDUP(vector2, q, int, s, 8, 16, -10); 63 | VDUP(vector2, q, int, s, 16, 8, -20); 64 | VDUP(vector2, q, int, s, 32, 4, -30); 65 | VDUP(vector2, q, int, s, 64, 2, 24); 66 | VDUP(vector2, q, uint, u, 8, 16, 12); 67 | VDUP(vector2, q, uint, u, 16, 8, 3); 68 | VDUP(vector2, q, uint, u, 32, 4, 55); 69 | VDUP(vector2, q, uint, u, 64, 2, 3); 70 | VDUP(vector2, q, poly, p, 8, 16, 12); 71 | VDUP(vector2, q, poly, p, 16, 8, 3); 72 | 73 | /* Use maximum allowed shift amount */ 74 | TEST_VSXI_N(INSN_NAME, , int, s, 8, 8, 7); 75 | TEST_VSXI_N(INSN_NAME, , int, s, 16, 4, 15); 76 | TEST_VSXI_N(INSN_NAME, , int, s, 32, 2, 31); 77 | TEST_VSXI_N(INSN_NAME, , int, s, 64, 1, 63); 78 | TEST_VSXI_N(INSN_NAME, , uint, u, 8, 8, 7); 79 | TEST_VSXI_N(INSN_NAME, , uint, u, 16, 4, 15); 80 | TEST_VSXI_N(INSN_NAME, , uint, u, 32, 2, 31); 81 | TEST_VSXI_N(INSN_NAME, , uint, u, 64, 1, 63); 82 | TEST_VSXI_N(INSN_NAME, , poly, p, 8, 8, 7); 83 | TEST_VSXI_N(INSN_NAME, , poly, p, 16, 4, 15); 84 | TEST_VSXI_N(INSN_NAME, q, int, s, 8, 16, 7); 85 | TEST_VSXI_N(INSN_NAME, q, int, s, 16, 8, 15); 86 | TEST_VSXI_N(INSN_NAME, q, int, s, 32, 4, 31); 87 | TEST_VSXI_N(INSN_NAME, q, int, s, 64, 2, 63); 88 | TEST_VSXI_N(INSN_NAME, q, uint, u, 8, 16, 7); 89 | TEST_VSXI_N(INSN_NAME, q, uint, u, 16, 8, 15); 90 | TEST_VSXI_N(INSN_NAME, q, uint, u, 32, 4, 31); 91 | TEST_VSXI_N(INSN_NAME, q, uint, u, 64, 2, 63); 92 | TEST_VSXI_N(INSN_NAME, q, poly, p, 8, 16, 7); 93 | TEST_VSXI_N(INSN_NAME, q, poly, p, 16, 8, 15); 94 | 95 | dump_results_hex2 (TEST_MSG, "max shift amount"); 96 | } 97 | -------------------------------------------------------------------------------- /ref_vsra_n.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VSRA_N" 35 | void exec_vsra_n (void) 36 | { 37 | /* Basic test: y=vsra_n(x,v), then store the result. */ 38 | #define TEST_VSRA_N(Q, T1, T2, W, N, V) \ 39 | VECT_VAR(vector_res, T1, W, N) = \ 40 | vsra##Q##_n_##T2##W(VECT_VAR(vector, T1, W, N), \ 41 | VECT_VAR(vector2, T1, W, N), \ 42 | V); \ 43 | vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) 44 | 45 | /* With ARM RVCT, we need to declare variables before any executable 46 | statement */ 47 | 48 | DECL_VARIABLE_ALL_VARIANTS(vector); 49 | DECL_VARIABLE_ALL_VARIANTS(vector2); 50 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 51 | 52 | clean_results (); 53 | 54 | /* Initialize input "vector" from "buffer" */ 55 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 56 | 57 | /* Choose arbitrary initialization values */ 58 | VDUP(vector2, , int, s, 8, 8, 0x11); 59 | VDUP(vector2, , int, s, 16, 4, 0x22); 60 | VDUP(vector2, , int, s, 32, 2, 0x33); 61 | VDUP(vector2, , int, s, 64, 1, 0x44); 62 | VDUP(vector2, , uint, u, 8, 8, 0x55); 63 | VDUP(vector2, , uint, u, 16, 4, 0x66); 64 | VDUP(vector2, , uint, u, 32, 2, 0x77); 65 | VDUP(vector2, , uint, u, 64, 1, 0x88); 66 | 67 | VDUP(vector2, q, int, s, 8, 16, 0x11); 68 | VDUP(vector2, q, int, s, 16, 8, 0x22); 69 | VDUP(vector2, q, int, s, 32, 4, 0x33); 70 | VDUP(vector2, q, int, s, 64, 2, 0x44); 71 | VDUP(vector2, q, uint, u, 8, 16, 0x55); 72 | VDUP(vector2, q, uint, u, 16, 8, 0x66); 73 | VDUP(vector2, q, uint, u, 32, 4, 0x77); 74 | VDUP(vector2, q, uint, u, 64, 2, 0x88); 75 | 76 | /* Choose shift amount arbitrarily */ 77 | TEST_VSRA_N(, int, s, 8, 8, 1); 78 | TEST_VSRA_N(, int, s, 16, 4, 12); 79 | TEST_VSRA_N(, int, s, 32, 2, 2); 80 | TEST_VSRA_N(, int, s, 64, 1, 32); 81 | TEST_VSRA_N(, uint, u, 8, 8, 2); 82 | TEST_VSRA_N(, uint, u, 16, 4, 3); 83 | TEST_VSRA_N(, uint, u, 32, 2, 5); 84 | TEST_VSRA_N(, uint, u, 64, 1, 33); 85 | 86 | TEST_VSRA_N(q, int, s, 8, 16, 1); 87 | TEST_VSRA_N(q, int, s, 16, 8, 12); 88 | TEST_VSRA_N(q, int, s, 32, 4, 2); 89 | TEST_VSRA_N(q, int, s, 64, 2, 32); 90 | TEST_VSRA_N(q, uint, u, 8, 16, 2); 91 | TEST_VSRA_N(q, uint, u, 16, 8, 3); 92 | TEST_VSRA_N(q, uint, u, 32, 4, 5); 93 | TEST_VSRA_N(q, uint, u, 64, 2, 33); 94 | 95 | /* FIXME: only a few result buffers are used, but we output all of them */ 96 | dump_results_hex (TEST_MSG); 97 | } 98 | -------------------------------------------------------------------------------- /ref_vsri_n.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsri 27 | #define TEST_MSG "VSRI_N" 28 | 29 | /* Extra tests for functions requiring corner cases tests */ 30 | void vsri_extra(void); 31 | #define EXTRA_TESTS vsri_extra 32 | 33 | #include "ref_vsXi_n.c" 34 | 35 | void vsri_extra(void) 36 | { 37 | /* Test cases with maximum shift amount (this amount is different 38 | from vsli). */ 39 | 40 | /* With ARM RVCT, we need to declare variables before any executable 41 | statement */ 42 | DECL_VARIABLE_ALL_VARIANTS(vector); 43 | DECL_VARIABLE_ALL_VARIANTS(vector2); 44 | DECL_VARIABLE_ALL_VARIANTS(vector_res); 45 | 46 | clean_results (); 47 | 48 | /* Initialize input "vector" from "buffer" */ 49 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 50 | 51 | /* Fill input vector2 with arbitrary values */ 52 | VDUP(vector2, , int, s, 8, 8, 2); 53 | VDUP(vector2, , int, s, 16, 4, -4); 54 | VDUP(vector2, , int, s, 32, 2, 3); 55 | VDUP(vector2, , int, s, 64, 1, 100); 56 | VDUP(vector2, , uint, u, 8, 8, 20); 57 | VDUP(vector2, , uint, u, 16, 4, 30); 58 | VDUP(vector2, , uint, u, 32, 2, 40); 59 | VDUP(vector2, , uint, u, 64, 1, 2); 60 | VDUP(vector2, , poly, p, 8, 8, 20); 61 | VDUP(vector2, , poly, p, 16, 4, 30); 62 | VDUP(vector2, q, int, s, 8, 16, -10); 63 | VDUP(vector2, q, int, s, 16, 8, -20); 64 | VDUP(vector2, q, int, s, 32, 4, -30); 65 | VDUP(vector2, q, int, s, 64, 2, 24); 66 | VDUP(vector2, q, uint, u, 8, 16, 12); 67 | VDUP(vector2, q, uint, u, 16, 8, 3); 68 | VDUP(vector2, q, uint, u, 32, 4, 55); 69 | VDUP(vector2, q, uint, u, 64, 2, 3); 70 | VDUP(vector2, q, poly, p, 8, 16, 12); 71 | VDUP(vector2, q, poly, p, 16, 8, 3); 72 | 73 | /* Use maximum allowed shift amount */ 74 | TEST_VSXI_N(INSN_NAME, , int, s, 8, 8, 8); 75 | TEST_VSXI_N(INSN_NAME, , int, s, 16, 4, 16); 76 | TEST_VSXI_N(INSN_NAME, , int, s, 32, 2, 32); 77 | TEST_VSXI_N(INSN_NAME, , int, s, 64, 1, 64); 78 | TEST_VSXI_N(INSN_NAME, , uint, u, 8, 8, 8); 79 | TEST_VSXI_N(INSN_NAME, , uint, u, 16, 4, 16); 80 | TEST_VSXI_N(INSN_NAME, , uint, u, 32, 2, 32); 81 | TEST_VSXI_N(INSN_NAME, , uint, u, 64, 1, 64); 82 | TEST_VSXI_N(INSN_NAME, , poly, p, 8, 8, 8); 83 | TEST_VSXI_N(INSN_NAME, , poly, p, 16, 4, 16); 84 | TEST_VSXI_N(INSN_NAME, q, int, s, 8, 16, 8); 85 | TEST_VSXI_N(INSN_NAME, q, int, s, 16, 8, 16); 86 | TEST_VSXI_N(INSN_NAME, q, int, s, 32, 4, 32); 87 | TEST_VSXI_N(INSN_NAME, q, int, s, 64, 2, 64); 88 | TEST_VSXI_N(INSN_NAME, q, uint, u, 8, 16, 8); 89 | TEST_VSXI_N(INSN_NAME, q, uint, u, 16, 8, 16); 90 | TEST_VSXI_N(INSN_NAME, q, uint, u, 32, 4, 32); 91 | TEST_VSXI_N(INSN_NAME, q, uint, u, 64, 2, 64); 92 | TEST_VSXI_N(INSN_NAME, q, poly, p, 8, 16, 8); 93 | TEST_VSXI_N(INSN_NAME, q, poly, p, 16, 8, 16); 94 | 95 | dump_results_hex2 (TEST_MSG, " max shift amount"); 96 | } 97 | -------------------------------------------------------------------------------- /ref_vst1_lane.c: -------------------------------------------------------------------------------- 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 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #define TEST_MSG "VST1_LANE/VST1_LANEQ" 35 | void exec_vst1_lane (void) 36 | { 37 | #define TEST_VST1_LANE(Q, T1, T2, W, N, L) \ 38 | VECT_VAR(vector, T1, W, N) = \ 39 | vld1##Q##_##T2##W(VECT_VAR(buffer, T1, W, N)); \ 40 | vst1##Q##_lane_##T2##W(VECT_VAR(result, T1, W, N), \ 41 | VECT_VAR(vector, T1, W, N), L) 42 | 43 | /* With ARM RVCT, we need to declare variables before any executable 44 | statement */ 45 | DECL_VARIABLE_ALL_VARIANTS(vector); 46 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 47 | DECL_VARIABLE(vector, float, 16, 4); 48 | DECL_VARIABLE(vector, float, 16, 8); 49 | #endif 50 | 51 | clean_results (); 52 | 53 | /* Choose lane arbitrarily */ 54 | TEST_VST1_LANE(, int, s, 8, 8, 7); 55 | TEST_VST1_LANE(, int, s, 16, 4, 3); 56 | TEST_VST1_LANE(, int, s, 32, 2, 1); 57 | TEST_VST1_LANE(, int, s, 64, 1, 0); 58 | TEST_VST1_LANE(, uint, u, 8, 8, 6); 59 | TEST_VST1_LANE(, uint, u, 16, 4, 2); 60 | TEST_VST1_LANE(, uint, u, 32, 2, 0); 61 | TEST_VST1_LANE(, uint, u, 64, 1, 0); 62 | TEST_VST1_LANE(, poly, p, 8, 8, 6); 63 | TEST_VST1_LANE(, poly, p, 16, 4, 2); 64 | TEST_VST1_LANE(, float, f, 32, 2, 1); 65 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 66 | TEST_VST1_LANE(, float, f, 16, 4, 2); 67 | #endif 68 | 69 | TEST_VST1_LANE(q, int, s, 8, 16, 15); 70 | TEST_VST1_LANE(q, int, s, 16, 8, 5); 71 | TEST_VST1_LANE(q, int, s, 32, 4, 1); 72 | TEST_VST1_LANE(q, int, s, 64, 2, 1); 73 | TEST_VST1_LANE(q, uint, u, 8, 16, 10); 74 | TEST_VST1_LANE(q, uint, u, 16, 8, 4); 75 | TEST_VST1_LANE(q, uint, u, 32, 4, 3); 76 | TEST_VST1_LANE(q, uint, u, 64, 2, 0); 77 | TEST_VST1_LANE(q, poly, p, 8, 16, 10); 78 | TEST_VST1_LANE(q, poly, p, 16, 8, 4); 79 | TEST_VST1_LANE(q, float, f, 32, 4, 1); 80 | #if defined(__ARM_FP16_FORMAT_IEEE) && ( ((__ARM_FP & 0x2) != 0) || ((__ARM_NEON_FP16_INTRINSICS & 1) != 0) ) 81 | TEST_VST1_LANE(q, float, f, 16, 8, 5); 82 | #endif 83 | 84 | dump_results_hex (TEST_MSG); 85 | } 86 | -------------------------------------------------------------------------------- /ref_vsub.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsub 27 | #define TEST_MSG "VSUB/VSUBQ" 28 | 29 | /* Extra tests for functions requiring floating-point types */ 30 | void exec_vsub_f32(void); 31 | #define EXTRA_TESTS exec_vsub_f32 32 | 33 | #include "ref_v_binary_op.c" 34 | 35 | void exec_vsub_f32(void) 36 | { 37 | int i; 38 | 39 | DECL_VARIABLE(vector, float, 32, 2); 40 | DECL_VARIABLE(vector, float, 32, 4); 41 | 42 | DECL_VARIABLE(vector2, float, 32, 2); 43 | DECL_VARIABLE(vector2, float, 32, 4); 44 | 45 | DECL_VARIABLE(vector_res, float, 32, 2); 46 | DECL_VARIABLE(vector_res, float, 32, 4); 47 | 48 | VDUP(vector, , float, f, 32, 2, 2.3f); 49 | VDUP(vector, q, float, f, 32, 4, 3.4f); 50 | 51 | VDUP(vector2, , float, f, 32, 2, 4.5f); 52 | VDUP(vector2, q, float, f, 32, 4, 5.6f); 53 | 54 | TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2); 55 | TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4); 56 | 57 | fprintf(ref_file, "\nfloat32:\n"); 58 | DUMP_FP(TEST_MSG, float, 32, 2, PRIx32); 59 | DUMP_FP(TEST_MSG, float, 32, 4, PRIx32); 60 | } 61 | -------------------------------------------------------------------------------- /ref_vsubhn.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsubhn 27 | #define TEST_MSG "VSUBHN" 28 | 29 | #include "ref_vaddhn.c" 30 | -------------------------------------------------------------------------------- /ref_vsubl.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsubl 27 | #define TEST_MSG "VSUBL" 28 | 29 | #include "ref_vaddl.c" 30 | -------------------------------------------------------------------------------- /ref_vsubw.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vsubw 27 | #define TEST_MSG "VSUBW" 28 | 29 | #include "ref_vaddw.c" 30 | -------------------------------------------------------------------------------- /ref_vtrn.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vtrn 27 | #define TEST_MSG "VTRN/VTRNQ" 28 | 29 | #include "ref_vuzp.c" 30 | -------------------------------------------------------------------------------- /ref_vtst.c: -------------------------------------------------------------------------------- 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 | #if defined(__arm__) || defined(__aarch64__) 27 | #include 28 | #else 29 | #include "stm-arm-neon.h" 30 | #endif 31 | 32 | #include "stm-arm-neon-ref.h" 33 | 34 | #ifndef INSN_NAME 35 | #define INSN_NAME vtst 36 | #define TEST_MSG "VTST/VTSTQ" 37 | #endif 38 | 39 | /* Can't use the standard ref_v_binary_op.c template because vtst has 40 | no 64 bits variant, and outputs are always of uint type */ 41 | #define FNNAME1(NAME) void exec_ ## NAME (void) 42 | #define FNNAME(NAME) FNNAME1(NAME) 43 | 44 | FNNAME (INSN_NAME) 45 | { 46 | /* Basic test: y=OP(x,x), then store the result. */ 47 | #define TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ 48 | VECT_VAR(vector_res, uint, W, N) = \ 49 | INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \ 50 | VECT_VAR(vector2, T1, W, N)); \ 51 | vst1##Q##_u##W(VECT_VAR(result, uint, W, N), \ 52 | VECT_VAR(vector_res, uint, W, N)) 53 | 54 | #define TEST_BINARY_OP(INSN, Q, T1, T2, W, N) \ 55 | TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \ 56 | 57 | /* With ARM RVCT, we need to declare variables before any executable 58 | statement */ 59 | DECL_VARIABLE_ALL_VARIANTS(vector); 60 | DECL_VARIABLE_ALL_VARIANTS(vector2); 61 | DECL_VARIABLE_UNSIGNED_VARIANTS(vector_res); 62 | 63 | 64 | clean_results (); 65 | 66 | /* Initialize input "vector" from "buffer" */ 67 | TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); 68 | 69 | /* Choose init value arbitrarily, will be used as comparison value */ 70 | VDUP(vector2, , int, s, 8, 8, 15); 71 | VDUP(vector2, , int, s, 16, 4, 5); 72 | VDUP(vector2, , int, s, 32, 2, 1); 73 | VDUP(vector2, , uint, u, 8, 8, 15); 74 | VDUP(vector2, , uint, u, 16, 4, 5); 75 | VDUP(vector2, , uint, u, 32, 2, 1); 76 | VDUP(vector2, q, int, s, 8, 16, 15); 77 | VDUP(vector2, q, int, s, 16, 8, 5); 78 | VDUP(vector2, q, int, s, 32, 4, 1); 79 | VDUP(vector2, q, uint, u, 8, 16, 15); 80 | VDUP(vector2, q, uint, u, 16, 8, 5); 81 | VDUP(vector2, q, uint, u, 32, 4, 1); 82 | 83 | #define TEST_MACRO_NO64BIT_VARIANT_1_5(MACRO, VAR, T1, T2) \ 84 | MACRO(VAR, , T1, T2, 8, 8); \ 85 | MACRO(VAR, , T1, T2, 16, 4); \ 86 | MACRO(VAR, , T1, T2, 32, 2); \ 87 | MACRO(VAR, q, T1, T2, 8, 16); \ 88 | MACRO(VAR, q, T1, T2, 16, 8); \ 89 | MACRO(VAR, q, T1, T2, 32, 4) 90 | 91 | /* Split the test, as both signed and unsigned variants output their 92 | result in an unsigned form (thus the same output variable is used 93 | in these tests) */ 94 | TEST_MACRO_NO64BIT_VARIANT_1_5(TEST_BINARY_OP, INSN_NAME, int, s); 95 | dump_results_hex2 (TEST_MSG, " (signed input)"); 96 | 97 | TEST_MACRO_NO64BIT_VARIANT_1_5(TEST_BINARY_OP, INSN_NAME, uint, u); 98 | dump_results_hex2 (TEST_MSG, " (unsigned input)"); 99 | } 100 | -------------------------------------------------------------------------------- /ref_vzip.c: -------------------------------------------------------------------------------- 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 | #define INSN_NAME vzip 27 | #define TEST_MSG "VZIP/VZIPQ" 28 | 29 | #include "ref_vuzp.c" 30 | -------------------------------------------------------------------------------- /retarget.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Copyright (C) ARM Limited, 2005. All rights reserved. 3 | */ 4 | 5 | #if defined(__cplusplus) 6 | #include 7 | #else 8 | #include 9 | #endif 10 | #include 11 | 12 | // Heap base from scatter file 13 | extern int Image$$HEAP$$ZI$$Base; 14 | //#pragma import(__use_two_region_memory) 15 | 16 | extern void core_init(void); 17 | 18 | /* 19 | The functions below are patched onto main. 20 | */ 21 | 22 | extern void $Super$$main(void); 23 | 24 | void $Sub$$main(void) 25 | { 26 | core_init(); // does some extra setup work 27 | 28 | $Super$$main(); // calls the original function 29 | } 30 | 31 | 32 | /* 33 | This function re-implements the C Library semihosted function. The stack pointer 34 | has aready been set and is passed back to the function, The base of the heap is 35 | set from the scatter file 36 | */ 37 | __value_in_regs struct __initial_stackheap __user_initial_stackheap( 38 | unsigned R0, unsigned SP, unsigned R2, unsigned SL) 39 | { 40 | struct __initial_stackheap config; 41 | 42 | config.heap_base = (unsigned int)&Image$$HEAP$$ZI$$Base; // placed by scatterfile 43 | config.stack_base = SP; // inherit SP from the execution environment 44 | 45 | return config; 46 | } 47 | -------------------------------------------------------------------------------- /scatter.scat: -------------------------------------------------------------------------------- 1 | ;; Copyright ARM Ltd 2005. All rights reserved. 2 | 3 | ROM_LOAD 0x2000 4 | { 5 | 6 | ROM_EXEC 0x2000 7 | { 8 | init.o (CortexA8, +First) ; Create Translation Table 9 | * (InRoot$$Sections) ; this section must be in a root region 10 | } 11 | 12 | I-TCM 0x30000 FIXED ; 0x1E000 ; built at 0x100 to avoid vector space 13 | { ; assumes 32K I-TCM 14 | 15 | * (+RO) ; any remaining code inc C lib. 16 | } 17 | 18 | D-TCM 0x230000 FIXED ; 0x40000 ; 8 Kb of D-TCM used for RW/ZI 19 | { 20 | * (+RW,+ZI) 21 | } 22 | 23 | HEAP 0x4E0000 EMPTY 0x100000 {} ; 8Kb Heap follows direcly after RW/ZI 24 | 25 | STACK 0x300000 EMPTY -0x8000 {} ; 32KB Stack, starts after DTCM block. 26 | 27 | TTB 0x20000 EMPTY 0x4000 {} ; place translation table at 0x28000, 16Kb required 28 | 29 | } 30 | --------------------------------------------------------------------------------