Debian Codegraph @

gcc/testsuite/gcc.target/arc/delay-slot-limm.c

raw
1 /* We have encountered an issue that a "mov_s.ne" instruction *
2 * with an immediate value was put in the delay slot of a *
3 * branch: *
4 * *
5 * bne.d @.L1 # 33 [c=20 l=4] *branch_insn *
6 * mov_s.ne r0,7 # 35 [c=0 l=6] *movsi_ne/2 *
7 * *
8 * This is not sanctioned and must not happen. The test below *
9 * is a reduced version of the source code leading to the *
10 * problem. */
11
12 /* { dg-do compile } */
13 /* { dg-skip-if "" { ! { clmcpu } } } */
14 /* { dg-options "-mcpu=archs -Og" } */
15 typedef struct
16 {
17 struct
18 {
19 int length;
20 } table;
21 } room;
22
23 struct house
24 {
25 room *r;
26 };
27
28 int glob;
29
30 _Bool bar();
31
32 int func(struct house *h, int i, int whatever)
33 {
34 for (;;)
35 {
36 _Bool a;
37 if (h && h->r[i].table.length == glob)
38 {
39 if (whatever)
40 {
41 a = bar();
42 if (__builtin_expect(!a, 0))
43 return 7;
44 }
45 break;
46 }
47 }
48 return 0;
49 }
50
51 /* no 'mov_s.ne r,limm' in a delay slot */
52 /* { dg-final { scan-assembler-not "bne.d\.*\n\\s\+mov_s.ne\\s+r\[0-9\]+,7" } } */