blob: e0ef53fac4f0881292b87819ce5d8a87677cf4d2 [file] [log] [blame]
Christophe Lyon073831a2011-01-24 17:37:40 +01001/*
2
3Copyright (c) 2009, 2010, 2011 STMicroelectronics
4Written by Christophe Lyon
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE 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 */
30void vqabs_extra(void);
31#define EXTRA_TESTS vqabs_extra
32
33#include "ref_v_unary_sat_op.c"
34
35void 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 */
Christophe Lyonf2053672014-12-16 10:26:00 +010056 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);
Christophe Lyon073831a2011-01-24 17:37:40 +010062
63 /* Apply a unary operator named INSN_NAME */
Christophe Lyon4a6e5cc2014-06-03 22:47:52 +020064 fprintf(ref_file, "\n%s cumulative saturation output:\n", TEST_MSG);
Christophe Lyon073831a2011-01-24 17:37:40 +010065 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}