PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr70232.c
blob6cc987a722a83ca467a810ea8ada63ba3f3867ec
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -w -fdump-tree-vrp1-details -fdump-tree-vrp2-details -fdump-tree-dom2-details -fdump-tree-dom3-details" } */
4 /* All the threads found by the FSM threader should have too
5 many statements to be profitable. */
6 /* { dg-final { scan-tree-dump-not "Registering FSM " "dom2"} } */
7 /* { dg-final { scan-tree-dump-not "Registering FSM " "dom3"} } */
8 /* { dg-final { scan-tree-dump-not "Registering FSM " "vrp1"} } */
9 /* { dg-final { scan-tree-dump-not "Registering FSM " "vrp2"} } */
11 typedef _Bool bool;
12 typedef unsigned char uint8_t;
13 typedef unsigned long uint32_t;
14 typedef unsigned long long uint64_t;
15 typedef unsigned int size_t;
17 enum {
18 false = 0,
19 true = 1
22 struct list_head {
23 struct list_head *next, *prev;
27 extern void * memcpy(void *, const void *, size_t);
28 extern int memcmp(const void *,const void *,size_t);
29 extern void * memset(void *, int, size_t);
30 extern void __memzero(void *ptr, size_t n);
32 static inline uint64_t wwn_to_uint64_t(uint8_t *wwn)
34 return (uint64_t)wwn[0] << 56 | (uint64_t)wwn[1] << 48 |
35 (uint64_t)wwn[2] << 40 | (uint64_t)wwn[3] << 32 |
36 (uint64_t)wwn[4] << 24 | (uint64_t)wwn[5] << 16 |
37 (uint64_t)wwn[6] << 8 | (uint64_t)wwn[7];
40 struct lpfc_name {
41 union {
42 uint8_t wwn[8];
43 } u;
46 struct lpfc_hba {
47 uint32_t cfg_fof;
48 uint32_t cfg_oas_flags;
49 struct list_head luns;
52 struct lpfc_device_id {
53 struct lpfc_name vport_wwpn;
54 struct lpfc_name target_wwpn;
55 uint64_t lun;
58 struct lpfc_device_data {
59 struct list_head listentry;
60 struct lpfc_device_id device_id;
61 bool oas_enabled;
62 bool available;
65 bool
66 lpfc_find_next_oas_lun(struct lpfc_hba *phba, struct lpfc_name *vport_wwpn,
67 struct lpfc_name *target_wwpn, uint64_t *starting_lun,
68 struct lpfc_name *found_vport_wwpn,
69 struct lpfc_name *found_target_wwpn,
70 uint64_t *found_lun,
71 uint32_t *found_lun_status)
74 struct lpfc_device_data *lun_info;
75 struct lpfc_device_id *device_id;
76 uint64_t lun;
77 bool found = false;
79 if (__builtin_expect(!!(!phba), 0) || !vport_wwpn || !target_wwpn ||
80 !starting_lun || !found_vport_wwpn ||
81 !found_target_wwpn || !found_lun || !found_lun_status ||
82 (*starting_lun == -1u) ||
83 !phba->cfg_fof)
84 return false;
86 lun = *starting_lun;
87 *found_lun = -1;
88 *starting_lun = -1;
92 for (lun_info = ({ const typeof( ((typeof(*lun_info) *)0)->listentry ) *__mptr = ((&phba->luns)->next); (typeof(*lun_info) *)( (char *)__mptr - __builtin_offsetof(typeof(*lun_info), listentry) );}); &lun_info->listentry != (&phba->luns); lun_info = ({ const typeof( ((typeof(*(lun_info)) *)0)->listentry ) *__mptr = ((lun_info)->listentry.next); (typeof(*(lun_info)) *)( (char *)__mptr - __builtin_offsetof(typeof(*(lun_info)), listentry) );})) {
93 if (((wwn_to_uint64_t(vport_wwpn->u.wwn) == 0) ||
94 (memcmp(&lun_info->device_id.vport_wwpn, vport_wwpn,
95 sizeof(struct lpfc_name)) == 0)) &&
96 ((wwn_to_uint64_t(target_wwpn->u.wwn) == 0) ||
97 (memcmp(&lun_info->device_id.target_wwpn, target_wwpn,
98 sizeof(struct lpfc_name)) == 0)) &&
99 (lun_info->oas_enabled)) {
100 device_id = &lun_info->device_id;
101 if ((!found) && ((lun == 0) || (device_id->lun == lun))) {
102 *found_lun = device_id->lun;
103 memcpy(found_vport_wwpn, &device_id->vport_wwpn, sizeof(struct lpfc_name));
104 memcpy(found_target_wwpn, &device_id->target_wwpn, sizeof(struct lpfc_name));
105 if (lun_info->available)
106 *found_lun_status = 0x01;
107 else
108 *found_lun_status = 0;
109 if (phba->cfg_oas_flags & 0x01)
110 ({ void *__p = (vport_wwpn); size_t __n = sizeof(struct lpfc_name); if ((__n) != 0) { if (__builtin_constant_p((0x0)) && (0x0) == 0) __memzero((__p),(__n)); else memset((__p),(0x0),(__n)); } (__p); })
112 if (phba->cfg_oas_flags & 0x02)
113 ({ void *__p = (target_wwpn); size_t __n = sizeof(struct lpfc_name); if ((__n) != 0) { if (__builtin_constant_p((0x0)) && (0x0) == 0) __memzero((__p),(__n)); else memset((__p),(0x0),(__n)); } (__p); })
115 found = true;
116 } else if (found) {
117 *starting_lun = device_id->lun;
118 memcpy(vport_wwpn, &device_id->vport_wwpn,
119 sizeof(struct lpfc_name));
120 memcpy(target_wwpn, &device_id->target_wwpn,
121 sizeof(struct lpfc_name));
122 break;
126 return found;