aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/riscv/pr107455-2.c
blob: 91106bb5d805f3aa3891794b0618f2623f5c3a21 (plain)
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
/* { dg-do compile } */
/* { dg-options "-O2 -dp" } */
/* This was extracted from coremark.  */


typedef signed short ee_s16;
typedef struct list_data_s
{
    ee_s16 data16;
    ee_s16 idx;
} list_data;

typedef struct list_head_s
{
    struct list_head_s *next;
    struct list_data_s *info;
} list_head;


list_head *
core_list_find(list_head *list, list_data *info)
{
    if (info->idx >= 0)
    {
        while (list && (list->info->idx != info->idx))
            list = list->next;
        return list;
    }
    else
    {
        while (list && ((list->info->data16 & 0xff) != info->data16))
            list = list->next;
        return list;
    }
}

/* There was an unnecessary assignment to the return value until
   recently.  Scan for that in the resulting output.  */
/* { dg-final { scan-assembler-not "li\\ta0,0" } } */