2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target vsx_hw } */
4 /* { dg-options "-mvsx -O2" } */
16 static vector
signed char
17 vabss_char (vector
signed char arg
)
19 return vec_abss (arg
);
22 static vector
signed short
23 vabss_short (vector
signed short arg
)
25 return vec_abss (arg
);
28 static vector
signed int
29 vabss_int (vector
signed int arg
)
31 return vec_abss (arg
);
35 main (int argc
, char *argv
[])
38 vector
signed char val_char
;
39 vector
signed char expected_char
;
40 vector
signed char result_char
;
41 vector
signed short val_short
;
42 vector
signed short expected_short
;
43 vector
signed short result_short
;
44 vector
signed int val_int
;
45 vector
signed int expected_int
;
46 vector
signed int result_int
;
49 val_char
= (vector
signed char) {-7, 6, -5, 4, -3, 1, 0, -0, 1, -2, 3, -5, 6, -7};
50 expected_char
= (vector
signed char) {7, 6, 5, 4, 3, 1, 0, 0, 1, 2, 3, 5, 6, 7};
52 result_char
= vabss_char (val_char
);
54 for (i
= 0; i
< 16; i
++)
55 if (result_char
[i
] != expected_char
[i
])
57 printf("ERROR: vec_abss() result_char[%d] = %d, not expected_char[%d] = %d\n",
58 i
, result_char
[i
], i
, expected_char
[i
]);
64 val_short
= (vector
signed short) {-0, 1, -2, 3, 4, -5, 6, -7};
65 expected_short
= (vector
signed short) {0, 1, 2, 3, 4, 5, 6, 7};
67 result_short
= vabss_short (val_short
);
69 for (i
= 0; i
< 8; i
++)
70 if (result_short
[i
] != expected_short
[i
])
72 printf("ERROR: vec_abss() result_short[%d] = %d, not expected_short[%d] = %d\n",
73 i
, result_short
[i
], i
, expected_short
[i
]);
79 val_int
= (vector
signed int) {-7, 6, -5, 4};
80 expected_int
= (vector
signed int) {7, 6, 5, 4};
82 result_int
= vabss_int (val_int
);
84 for (i
= 0; i
< 4; i
++)
85 if (result_int
[i
] != expected_int
[i
])
87 printf("ERROR: vec_abss() result_int[%d] = %d, not expected_int[%d] = %d\n",
88 i
, result_int
[i
], i
, expected_int
[i
]);