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 } */
6 /* { dg-options "-O2" } */
7 /* { dg-final { scan-assembler-not "and" } } */
8 /* { dg-final { scan-assembler-not "extu" } } */
9 /* { dg-final { scan-assembler-not "exts" } } */
11 #define make_func(__valtype__, __valget__, __tstval__, __suff__)\
12 int test_imm_##__tstval__##__suff__ (__valtype__ val) \
14 return ((__valget__) & (0x##__tstval__ << 0)) ? -20 : -40;\
17 #define make_func_0_F(__valtype__, __valget__, __y__, __suff__)\
18 make_func (__valtype__, __valget__, __y__##0, __suff__)\
19 make_func (__valtype__, __valget__, __y__##1, __suff__)\
20 make_func (__valtype__, __valget__, __y__##2, __suff__)\
21 make_func (__valtype__, __valget__, __y__##3, __suff__)\
22 make_func (__valtype__, __valget__, __y__##4, __suff__)\
23 make_func (__valtype__, __valget__, __y__##5, __suff__)\
24 make_func (__valtype__, __valget__, __y__##6, __suff__)\
25 make_func (__valtype__, __valget__, __y__##7, __suff__)\
26 make_func (__valtype__, __valget__, __y__##8, __suff__)\
27 make_func (__valtype__, __valget__, __y__##9, __suff__)\
28 make_func (__valtype__, __valget__, __y__##A, __suff__)\
29 make_func (__valtype__, __valget__, __y__##B, __suff__)\
30 make_func (__valtype__, __valget__, __y__##C, __suff__)\
31 make_func (__valtype__, __valget__, __y__##D, __suff__)\
32 make_func (__valtype__, __valget__, __y__##E, __suff__)\
33 make_func (__valtype__, __valget__, __y__##F, __suff__)\
35 #define make_funcs_0_FF(__valtype__, __valget__, __suff__)\
36 make_func_0_F (__valtype__, __valget__, 0, __suff__)\
37 make_func_0_F (__valtype__, __valget__, 1, __suff__)\
38 make_func_0_F (__valtype__, __valget__, 2, __suff__)\
39 make_func_0_F (__valtype__, __valget__, 3, __suff__)\
40 make_func_0_F (__valtype__, __valget__, 4, __suff__)\
41 make_func_0_F (__valtype__, __valget__, 5, __suff__)\
42 make_func_0_F (__valtype__, __valget__, 6, __suff__)\
43 make_func_0_F (__valtype__, __valget__, 7, __suff__)\
44 make_func_0_F (__valtype__, __valget__, 8, __suff__)\
45 make_func_0_F (__valtype__, __valget__, 9, __suff__)\
46 make_func_0_F (__valtype__, __valget__, A, __suff__)\
47 make_func_0_F (__valtype__, __valget__, B, __suff__)\
48 make_func_0_F (__valtype__, __valget__, C, __suff__)\
49 make_func_0_F (__valtype__, __valget__, D, __suff__)\
50 make_func_0_F (__valtype__, __valget__, E, __suff__)\
51 make_func_0_F (__valtype__, __valget__, F, __suff__)\
53 make_funcs_0_FF (signed char*, *val, int8_mem)
54 make_funcs_0_FF (signed char, val
, int8_reg
)
56 make_funcs_0_FF (unsigned char*, *val
, uint8_mem
)
57 make_funcs_0_FF (unsigned char, val
, uint8_reg
)
59 make_funcs_0_FF (short*, *val
, int16_mem
)
60 make_funcs_0_FF (short, val
, int16_reg
)
62 make_funcs_0_FF (unsigned short*, *val
, uint16_mem
)
63 make_funcs_0_FF (unsigned short, val
, uint16_reg
)
65 make_funcs_0_FF (int*, *val
, int32_mem
)
66 make_funcs_0_FF (int, val
, int32_reg
)
68 make_funcs_0_FF (unsigned int*, *val
, uint32_mem
)
69 make_funcs_0_FF (unsigned int, val
, uint32_reg
)
71 make_funcs_0_FF (long long*, *val
, int64_lowword_mem
)
72 make_funcs_0_FF (long long, val
, int64_lowword_reg
)
74 make_funcs_0_FF (unsigned long long*, *val
, uint64_lowword_mem
)
75 make_funcs_0_FF (unsigned long long, val
, uint64_lowword_reg
)
77 make_funcs_0_FF (long long*, *val
>> 32, int64_highword_mem
)
78 make_funcs_0_FF (long long, val
>> 32, int64_highword_reg
)
80 make_funcs_0_FF (unsigned long long*, *val
>> 32, uint64_highword_mem
)
81 make_funcs_0_FF (unsigned long long, val
>> 32, uint64_highword_reg
)
83 make_funcs_0_FF (long long*, *val
>> 16, int64_midword_mem
)
84 make_funcs_0_FF (long long, val
>> 16, int64_midword_reg
)
86 make_funcs_0_FF (unsigned long long*, *val
>> 16, uint64_midword_mem
)
87 make_funcs_0_FF (unsigned long long, val
>> 16, uint64_midword_reg
)