Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / bfin / mul-combine.c
blob2a811b332a887e6a9e906876d483ba1c2ac4ae92
1 /* Make sure combine eliminates all unnecessary instructions for the
2 sixteen cases of hi/lo multiplications. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2" } */
7 /* { dg-final { scan-assembler-not "<<" } } */
8 /* { dg-final { scan-assembler-not "PACK" } } */
10 extern void abort (void);
11 extern void exit (int);
13 typedef short __v2hi __attribute ((vector_size(4)));
14 typedef __v2hi fract2x16;
15 typedef short fract16;
17 #define GETVECT(HILO1,HILO2,IN1,IN2) \
18 __builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \
19 (HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2))
20 #define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4) \
21 __builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \
22 GETVECT (HL3, HL4, IN2, IN2))
24 #define FUNC(HL1, HL2, HL3, HL4) \
25 fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\
26 { \
27 return DOTEST(a, b, HL1, HL2, HL3, HL4);\
30 FUNC (0, 0, 0, 0)
31 FUNC (1, 0, 0, 0)
32 FUNC (0, 1, 0, 0)
33 FUNC (1, 1, 0, 0)
34 FUNC (0, 0, 1, 0)
35 FUNC (1, 0, 1, 0)
36 FUNC (0, 1, 1, 0)
37 FUNC (1, 1, 1, 0)
38 FUNC (0, 0, 0, 1)
39 FUNC (1, 0, 0, 1)
40 FUNC (0, 1, 0, 1)
41 FUNC (1, 1, 0, 1)
42 FUNC (0, 0, 1, 1)
43 FUNC (1, 0, 1, 1)
44 FUNC (0, 1, 1, 1)
45 FUNC (1, 1, 1, 1)