1 /* Check that sign/zero extensions are emitted where needed when the
2 tst Rm,Rn instruction is used. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler-times "tst\tr" 8 } } */
6 /* { dg-final { scan-assembler-times "mov.b" 4 } } */
7 /* { dg-final { scan-assembler-times "mov.w" 4 } } */
8 /* { dg-final { scan-assembler-times "extu.b" 4 } } */
9 /* { dg-final { scan-assembler-times "extu.w" 2 } } */
12 test_00 (char* x
, char* y
)
14 /* 2x mov.b (sign extending) */
15 return *x
& *y
? -40 : 60;
19 test_01 (short* x
, short* y
)
21 /* 2x mov.w (sign extending) */
22 return *x
& *y
? -40 : 60;
26 test_02 (char x
, char y
)
29 return x
& y
? -40 : 60;
33 test_03 (short x
, short y
)
36 return x
& y
? -40 : 60;
40 test_04 (char* x
, unsigned char y
)
42 /* 1x mov.b, 1x extu.b */
43 return *x
& y
? -40 : 60;
47 test_05 (short* x
, unsigned char y
)
49 /* 1x mov.w, 1x extu.b */
50 return *x
& y
? -40 : 60;
54 test_06 (short x
, short* y
, int z
, int w
)
56 /* 1x mov.w, 1x extu.w */
57 return x
& y
[0] ? z
: w
;
61 test_07 (char x
, char* y
, int z
, int w
)
63 /* 1x mov.b, 1x extu.b */
64 return x
& y
[0] ? z
: w
;