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-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
6 /* { dg-final { scan-assembler-times "tst\tr" 8 } } */
7 /* { dg-final { scan-assembler-times "mov.b" 4 } } */
8 /* { dg-final { scan-assembler-times "mov.w" 4 } } */
9 /* { dg-final { scan-assembler-times "extu.b" 4 } } */
10 /* { dg-final { scan-assembler-times "extu.w" 2 } } */
13 test_00 (char* x
, char* y
)
15 /* 2x mov.b (sign extending) */
16 return *x
& *y
? -40 : 60;
20 test_01 (short* x
, short* y
)
22 /* 2x mov.w (sign extending) */
23 return *x
& *y
? -40 : 60;
27 test_02 (char x
, char y
)
30 return x
& y
? -40 : 60;
34 test_03 (short x
, short y
)
37 return x
& y
? -40 : 60;
41 test_04 (char* x
, unsigned char y
)
43 /* 1x mov.b, 1x extu.b */
44 return *x
& y
? -40 : 60;
48 test_05 (short* x
, unsigned char y
)
50 /* 1x mov.w, 1x extu.b */
51 return *x
& y
? -40 : 60;
55 test_06 (short x
, short* y
, int z
, int w
)
57 /* 1x mov.w, 1x extu.w */
58 return x
& y
[0] ? z
: w
;
62 test_07 (char x
, char* y
, int z
, int w
)
64 /* 1x mov.b, 1x extu.b */
65 return x
& y
[0] ? z
: w
;