OSDN Git Service

Backport from 2012-03-26 mainline r185793.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / sh / pr49263.c
1 /* Verify that TST #imm, R0 instruction is generated if the constant
2    allows it.  Under some circumstances another compare instruction might
3    be selected, which is also fine.  Any AND instructions are considered
4    counter productive and fail the test.  */
5 /* { dg-do compile { target "sh*-*-*" } } */
6 /* { dg-options "-O2" } */
7 /* { dg-final { scan-assembler-not "and" } } */
8
9 #define make_func(__valtype__, __valget__, __tstval__, __suff__)\
10   int test_imm_##__tstval__##__suff__ (__valtype__ val) \
11     {\
12       return ((__valget__) & (0x##__tstval__  << 0)) ? -20 : -40;\
13     }
14
15 #define make_func_0_F(__valtype__, __valget__, __y__, __suff__)\
16   make_func (__valtype__, __valget__, __y__##0, __suff__)\
17   make_func (__valtype__, __valget__, __y__##1, __suff__)\
18   make_func (__valtype__, __valget__, __y__##2, __suff__)\
19   make_func (__valtype__, __valget__, __y__##3, __suff__)\
20   make_func (__valtype__, __valget__, __y__##4, __suff__)\
21   make_func (__valtype__, __valget__, __y__##5, __suff__)\
22   make_func (__valtype__, __valget__, __y__##6, __suff__)\
23   make_func (__valtype__, __valget__, __y__##7, __suff__)\
24   make_func (__valtype__, __valget__, __y__##8, __suff__)\
25   make_func (__valtype__, __valget__, __y__##9, __suff__)\
26   make_func (__valtype__, __valget__, __y__##A, __suff__)\
27   make_func (__valtype__, __valget__, __y__##B, __suff__)\
28   make_func (__valtype__, __valget__, __y__##C, __suff__)\
29   make_func (__valtype__, __valget__, __y__##D, __suff__)\
30   make_func (__valtype__, __valget__, __y__##E, __suff__)\
31   make_func (__valtype__, __valget__, __y__##F, __suff__)\
32
33 #define make_funcs_0_FF(__valtype__, __valget__, __suff__)\
34   make_func_0_F (__valtype__, __valget__, 0, __suff__)\
35   make_func_0_F (__valtype__, __valget__, 1, __suff__)\
36   make_func_0_F (__valtype__, __valget__, 2, __suff__)\
37   make_func_0_F (__valtype__, __valget__, 3, __suff__)\
38   make_func_0_F (__valtype__, __valget__, 4, __suff__)\
39   make_func_0_F (__valtype__, __valget__, 5, __suff__)\
40   make_func_0_F (__valtype__, __valget__, 6, __suff__)\
41   make_func_0_F (__valtype__, __valget__, 7, __suff__)\
42   make_func_0_F (__valtype__, __valget__, 8, __suff__)\
43   make_func_0_F (__valtype__, __valget__, 9, __suff__)\
44   make_func_0_F (__valtype__, __valget__, A, __suff__)\
45   make_func_0_F (__valtype__, __valget__, B, __suff__)\
46   make_func_0_F (__valtype__, __valget__, C, __suff__)\
47   make_func_0_F (__valtype__, __valget__, D, __suff__)\
48   make_func_0_F (__valtype__, __valget__, E, __suff__)\
49   make_func_0_F (__valtype__, __valget__, F, __suff__)\
50
51 make_funcs_0_FF (signed char*, *val, int8_mem)
52 make_funcs_0_FF (signed char, val, int8_reg)
53
54 make_funcs_0_FF (unsigned char*, *val, uint8_mem)
55 make_funcs_0_FF (unsigned char, val, uint8_reg)
56
57 make_funcs_0_FF (short*, *val, int16_mem)
58 make_funcs_0_FF (short, val, int16_reg)
59
60 make_funcs_0_FF (unsigned short*, *val, uint16_mem)
61 make_funcs_0_FF (unsigned short, val, uint16_reg)
62
63 make_funcs_0_FF (int*, *val, int32_mem)
64 make_funcs_0_FF (int, val, int32_reg)
65
66 make_funcs_0_FF (unsigned int*, *val, uint32_mem)
67 make_funcs_0_FF (unsigned int, val, uint32_reg)
68
69 make_funcs_0_FF (long long*, *val, int64_lowword_mem)
70 make_funcs_0_FF (long long, val, int64_lowword_reg)
71
72 make_funcs_0_FF (unsigned long long*, *val, uint64_lowword_mem)
73 make_funcs_0_FF (unsigned long long, val, uint64_lowword_reg)
74
75 make_funcs_0_FF (long long*, *val >> 32, int64_highword_mem)
76 make_funcs_0_FF (long long, val >> 32, int64_highword_reg)
77
78 make_funcs_0_FF (unsigned long long*, *val >> 32, uint64_highword_mem)
79 make_funcs_0_FF (unsigned long long, val >> 32, uint64_highword_reg)
80
81 make_funcs_0_FF (long long*, *val >> 16, int64_midword_mem)
82 make_funcs_0_FF (long long, val >> 16, int64_midword_reg)
83
84 make_funcs_0_FF (unsigned long long*, *val >> 16, uint64_midword_mem)
85 make_funcs_0_FF (unsigned long long, val >> 16, uint64_midword_reg)
86