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