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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* Check that sign/zero extensions are emitted where needed when the
tst Rm,Rn instruction is used. */
/* { dg-do compile } */
/* { dg-options "-O1" } */
/* { dg-final { scan-assembler-times "tst\tr" 8 } } */
/* { dg-final { scan-assembler-times "mov.b" 4 } } */
/* { dg-final { scan-assembler-times "mov.w" 4 } } */
/* { dg-final { scan-assembler-times "extu.b" 4 } } */
/* { dg-final { scan-assembler-times "extu.w" 2 } } */
int
test_00 (char* x, char* y)
{
/* 2x mov.b (sign extending) */
return *x & *y ? -40 : 60;
}
int
test_01 (short* x, short* y)
{
/* 2x mov.w (sign extending) */
return *x & *y ? -40 : 60;
}
int
test_02 (char x, char y)
{
/* 1x extu.b */
return x & y ? -40 : 60;
}
int
test_03 (short x, short y)
{
/* 1x extu.w */
return x & y ? -40 : 60;
}
int
test_04 (char* x, unsigned char y)
{
/* 1x mov.b, 1x extu.b */
return *x & y ? -40 : 60;
}
int
test_05 (short* x, unsigned char y)
{
/* 1x mov.w, 1x extu.b */
return *x & y ? -40 : 60;
}
int
test_06 (short x, short* y, int z, int w)
{
/* 1x mov.w, 1x extu.w */
return x & y[0] ? z : w;
}
int
test_07 (char x, char* y, int z, int w)
{
/* 1x mov.b, 1x extu.b */
return x & y[0] ? z : w;
}
|