2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr27861-1.c
blob8d6d791bcacc41e906a2b72ba83aeb5c3b645d12
1 /* PR target/27861 */
2 /* The following code used to cause an ICE during RTL expansion, as
3 expand shift was stripping the SUBREG of a rotate shift count, and
4 later producing a VAR_DECL tree whose DECL_RTL's mode didn't match
5 the VAR_DECL's type's mode. */
6 /* { dg-do compile } */
7 /* { dg-options "-O2" } */
9 typedef struct sim_state *SIM_DESC;
10 typedef enum
12 SIM_OPEN_STANDALONE, SIM_OPEN_DEBUG
14 SIM_RC;
15 typedef unsigned int unsigned32 __attribute__ ((__mode__ (__SI__)));
16 typedef unsigned int unsigned64 __attribute__ ((__mode__ (__DI__)));
17 typedef unsigned32 unsigned_address;
18 typedef unsigned_address address_word;
19 static __inline__ unsigned64
20 __attribute__ ((__unused__)) ROTR64 (unsigned64 val, int shift)
22 unsigned64 result;
23 result = (((val) >> (shift)) | ((val) << ((64) - (shift))));
24 return result;
26 typedef struct _sim_cpu sim_cpu;
27 enum
29 TRACE_MEMORY_IDX, TRACE_MODEL_IDX, TRACE_ALU_IDX, TRACE_CORE_IDX,
31 typedef struct _trace_data
33 char trace_flags[32];
35 TRACE_DATA;
36 typedef enum
38 nr_watchpoint_types,
40 watchpoint_type;
41 typedef struct _sim_watchpoints
43 TRACE_DATA trace_data;
45 sim_cpu_base;
46 struct _sim_cpu
48 sim_cpu_base base;
50 struct sim_state
52 sim_cpu cpu[1];
54 typedef address_word instruction_address;
55 void trace_result_word1 ();
56 int
57 do_dror (SIM_DESC sd, instruction_address cia, int MY_INDEX, unsigned64 x,
58 unsigned64 y)
60 unsigned64 result;
61 result = ROTR64 (x, y);
63 if ((((-1) & (1 << (TRACE_ALU_IDX))) != 0
64 && (((&(((&(sd)->cpu[0])))->base.trace_data))->
65 trace_flags)[TRACE_ALU_IDX] != 0))
66 trace_result_word1 (sd, ((&(sd)->cpu[0])), TRACE_ALU_IDX, (result));