* cfghooks.c (verify_flow_info): Disable check that all probabilities
[official-gcc.git] / gcc / testsuite / gcc.target / bfin / frmul.c
blob61930bae5529b74ed79f9932f68ebd5b7cb5e830
1 extern void abort (void);
2 extern void exit (int);
4 typedef short __v2hi __attribute ((vector_size(4)));
5 typedef __v2hi fract2x16;
6 typedef short fract16;
8 #define GETVECT(HILO1,HILO2,IN1,IN2) \
9 __builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \
10 (HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2))
11 #define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4) \
12 __builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \
13 GETVECT (HL3, HL4, IN2, IN2))
15 #define FUNC(HL1, HL2, HL3, HL4) \
16 fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\
17 { \
18 return DOTEST(a, b, HL1, HL2, HL3, HL4);\
21 FUNC (0, 0, 0, 0)
22 FUNC (1, 0, 0, 0)
23 FUNC (0, 1, 0, 0)
24 FUNC (1, 1, 0, 0)
25 FUNC (0, 0, 1, 0)
26 FUNC (1, 0, 1, 0)
27 FUNC (0, 1, 1, 0)
28 FUNC (1, 1, 1, 0)
29 FUNC (0, 0, 0, 1)
30 FUNC (1, 0, 0, 1)
31 FUNC (0, 1, 0, 1)
32 FUNC (1, 1, 0, 1)
33 FUNC (0, 0, 1, 1)
34 FUNC (1, 0, 1, 1)
35 FUNC (0, 1, 1, 1)
36 FUNC (1, 1, 1, 1)
38 #define RES1 0x1400
39 #define RES2 0x1e00
40 #define RES3 0x1c00
41 #define RES4 0x2a00
44 int main ()
46 fract2x16 a, b, c;
47 fract16 t1, t2;
48 a = __builtin_bfin_compose_2x16 (0x3000, 0x2000);
49 b = __builtin_bfin_compose_2x16 (0x7000, 0x5000);
51 c = foo0000 (a, b);
52 t1 = __builtin_bfin_extract_lo (c);
53 t2 = __builtin_bfin_extract_hi (c);
54 if (t1 != RES1 || t2 != RES1)
55 abort ();
57 c = foo1000 (a, b);
58 t1 = __builtin_bfin_extract_lo (c);
59 t2 = __builtin_bfin_extract_hi (c);
60 if (t1 != RES2 || t2 != RES1)
61 abort ();
63 c = foo0100 (a, b);
64 t1 = __builtin_bfin_extract_lo (c);
65 t2 = __builtin_bfin_extract_hi (c);
66 if (t1 != RES1 || t2 != RES2)
67 abort ();
69 c = foo1100 (a, b);
70 t1 = __builtin_bfin_extract_lo (c);
71 t2 = __builtin_bfin_extract_hi (c);
72 if (t1 != RES2 || t2 != RES2)
73 abort ();
75 c = foo0010 (a, b);
76 t1 = __builtin_bfin_extract_lo (c);
77 t2 = __builtin_bfin_extract_hi (c);
78 if (t1 != RES3 || t2 != RES1)
79 abort ();
81 c = foo1010 (a, b);
82 t1 = __builtin_bfin_extract_lo (c);
83 t2 = __builtin_bfin_extract_hi (c);
84 if (t1 != RES4 || t2 != RES1)
85 abort ();
87 c = foo0110 (a, b);
88 t1 = __builtin_bfin_extract_lo (c);
89 t2 = __builtin_bfin_extract_hi (c);
90 if (t1 != RES3 || t2 != RES2)
91 abort ();
93 c = foo1110 (a, b);
94 t1 = __builtin_bfin_extract_lo (c);
95 t2 = __builtin_bfin_extract_hi (c);
96 if (t1 != RES4 || t2 != RES2)
97 abort ();
99 c = foo0001 (a, b);
100 t1 = __builtin_bfin_extract_lo (c);
101 t2 = __builtin_bfin_extract_hi (c);
102 if (t1 != RES1 || t2 != RES3)
103 abort ();
105 c = foo1001 (a, b);
106 t1 = __builtin_bfin_extract_lo (c);
107 t2 = __builtin_bfin_extract_hi (c);
108 if (t1 != RES2 || t2 != RES3)
109 abort ();
111 c = foo0101 (a, b);
112 t1 = __builtin_bfin_extract_lo (c);
113 t2 = __builtin_bfin_extract_hi (c);
114 if (t1 != RES1 || t2 != RES4)
115 abort ();
117 c = foo1101 (a, b);
118 t1 = __builtin_bfin_extract_lo (c);
119 t2 = __builtin_bfin_extract_hi (c);
120 if (t1 != RES2 || t2 != RES4)
121 abort ();
123 c = foo0011 (a, b);
124 t1 = __builtin_bfin_extract_lo (c);
125 t2 = __builtin_bfin_extract_hi (c);
126 if (t1 != RES3 || t2 != RES3)
127 abort ();
129 c = foo1011 (a, b);
130 t1 = __builtin_bfin_extract_lo (c);
131 t2 = __builtin_bfin_extract_hi (c);
132 if (t1 != RES4 || t2 != RES3)
133 abort ();
135 c = foo0111 (a, b);
136 t1 = __builtin_bfin_extract_lo (c);
137 t2 = __builtin_bfin_extract_hi (c);
138 if (t1 != RES3 || t2 != RES4)
139 abort ();
141 c = foo1111 (a, b);
142 t1 = __builtin_bfin_extract_lo (c);
143 t2 = __builtin_bfin_extract_hi (c);
144 if (t1 != RES4 || t2 != RES4)
145 abort ();
147 exit (0);