summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/bfin/mul-combine.c
blob: 2a811b332a887e6a9e906876d483ba1c2ac4ae92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Make sure combine eliminates all unnecessary instructions for the
   sixteen cases of hi/lo multiplications.  */

/* { dg-do compile } */
/* { dg-options "-O2" } */

/* { dg-final { scan-assembler-not "<<" } } */
/* { dg-final { scan-assembler-not "PACK" } } */

extern void abort (void);
extern void exit (int);

typedef short  __v2hi __attribute ((vector_size(4)));
typedef __v2hi fract2x16;
typedef short fract16;

#define GETVECT(HILO1,HILO2,IN1,IN2)					\
  __builtin_bfin_compose_2x16 ((HILO2) ? __builtin_bfin_extract_hi (IN1) : __builtin_bfin_extract_lo (IN1), \
			  (HILO1) ? __builtin_bfin_extract_hi (IN2) : __builtin_bfin_extract_lo (IN2))
#define DOTEST(IN1, IN2, HL1, HL2, HL3, HL4)					\
  __builtin_bfin_multr_fr2x16 (GETVECT (HL1, HL2, IN1, IN1), \
			  GETVECT (HL3, HL4, IN2, IN2))

#define FUNC(HL1, HL2, HL3, HL4) \
  fract2x16 foo ## HL1 ## HL2 ## HL3 ## HL4 (fract2x16 a, fract2x16 b)\
  { \
    return DOTEST(a, b, HL1, HL2, HL3, HL4);\
  }

FUNC (0, 0, 0, 0)
FUNC (1, 0, 0, 0)
FUNC (0, 1, 0, 0)
FUNC (1, 1, 0, 0)
FUNC (0, 0, 1, 0)
FUNC (1, 0, 1, 0)
FUNC (0, 1, 1, 0)
FUNC (1, 1, 1, 0)
FUNC (0, 0, 0, 1)
FUNC (1, 0, 0, 1)
FUNC (0, 1, 0, 1)
FUNC (1, 1, 0, 1)
FUNC (0, 0, 1, 1)
FUNC (1, 0, 1, 1)
FUNC (0, 1, 1, 1)
FUNC (1, 1, 1, 1)