Handle T_HRESULT types in CodeView records
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-vector-abss.c
blobeacb52dda362e29d9e5d7cbc3b4e6237c614f10d
1 /* { dg-do run } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target vsx_hw } */
4 /* { dg-options "-mvsx -O2" } */
7 #include <altivec.h>
8 #include <stdlib.h>
10 #ifdef DEBUG
11 #include <stdio.h>
12 #endif
14 void abort (void);
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);
34 int
35 main (int argc, char *argv[])
37 int i;
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;
48 /* CHAR */
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])
56 #ifdef DEBUG
57 printf("ERROR: vec_abss() result_char[%d] = %d, not expected_char[%d] = %d\n",
58 i, result_char[i], i, expected_char[i]);
59 #else
60 abort ();
61 #endif
63 /* SHORT */
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])
71 #ifdef DEBUG
72 printf("ERROR: vec_abss() result_short[%d] = %d, not expected_short[%d] = %d\n",
73 i, result_short[i], i, expected_short[i]);
74 #else
75 abort ();
76 #endif
78 /* INT */
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])
86 #ifdef DEBUG
87 printf("ERROR: vec_abss() result_int[%d] = %d, not expected_int[%d] = %d\n",
88 i, result_int[i], i, expected_int[i]);
89 #else
90 abort ();
91 #endif
93 return 0;