* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / pr44832.c
blobb57e525ea9ca117427e4e803fbb61b7c38904e2e
1 /* PR debug/44832 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fcompare-debug" } */
4 /* { dg-options "-O2 -fcompare-debug -fno-short-enums" {target short_enums} } */
5 /* { dg-require-effective-target int32plus } */
7 struct rtx_def;
8 typedef struct rtx_def *rtx;
9 typedef const struct rtx_def *const_rtx;
10 struct rtvec_def;
11 typedef struct rtvec_def *rtvec;
12 extern int ix86_isa_flags;
14 enum machine_mode
16 VOIDmode,
17 V8HImode,
18 V16QImode,
19 V4SImode,
20 V2DImode,
21 V32QImode,
22 MAX_MACHINE_MODE,
24 NUM_MACHINE_MODES = MAX_MACHINE_MODE
26 extern unsigned char mode_size[NUM_MACHINE_MODES];
27 extern const unsigned char mode_inner[NUM_MACHINE_MODES];
28 extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
29 enum rtx_code {
31 CONST_INT ,
33 CONST_FIXED ,
35 CONST_DOUBLE
38 union rtunion_def
40 rtvec rt_rtvec;
42 typedef union rtunion_def rtunion;
43 struct rtx_def {
45 __extension__ enum rtx_code code: 16;
47 __extension__ enum machine_mode mode : 8;
49 union u {
50 rtunion fld[1];
51 } u;
53 struct rtvec_def {
54 rtx elem[1];
56 extern int rtx_equal_p (const_rtx, const_rtx);
57 extern rtx gen_reg_rtx (enum machine_mode);
59 extern void
60 ix86_expand_vector_init_concat (enum machine_mode mode,
61 rtx target, rtx *ops, int n);
63 static void
64 ix86_expand_vector_init_general (unsigned char mmx_ok, enum machine_mode mode,
65 rtx target, rtx vals)
67 rtx ops[32], op0, op1;
68 enum machine_mode half_mode = VOIDmode;
69 int n, i;
71 switch (mode)
73 case V4SImode:
74 case V2DImode:
75 n = mode_nunits[mode];
76 ix86_expand_vector_init_concat (mode, target, ops, n);
77 return;
79 case V32QImode:
80 goto half;
81 half:
83 typedef int eger;
84 if (mode != V4SImode)
85 ops[0] = 0;
87 n = mode_nunits[mode];
88 for (i = 0; i < n; i++)
89 ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
90 op0 = gen_reg_rtx (VOIDmode);
91 return;
93 case V16QImode:
94 if (!((ix86_isa_flags & (1 << 19)) != 0))
95 break;
97 case V8HImode:
98 if (!((ix86_isa_flags & (1 << 17)) != 0))
99 break;
101 n = mode_nunits[mode];
102 for (i = 0; i < n; i++)
103 ops[i] = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
104 return;
106 default:
111 int n_words;
113 n_words = ((unsigned short) mode_size[mode]) / 4;
115 if (n_words == 4)
116 ix86_expand_vector_init_general (0, V4SImode, 0, 0);
121 void
122 ix86_expand_vector_init (unsigned char mmx_ok, rtx target, rtx vals)
124 enum machine_mode mode = ((enum machine_mode) (target)->mode);
125 enum machine_mode inner_mode = ((enum machine_mode) mode_inner[mode]);
126 int n_elts = mode_nunits[mode];
127 int n_var = 0, one_var = -1;
128 unsigned char all_same = 1, all_const_zero = 1;
129 int i;
130 rtx x;
132 for (i = 0; i < n_elts; ++i)
134 x = (((((vals)->u.fld[0]).rt_rtvec))->elem[i]);
135 if (!((((enum rtx_code) (x)->code) == CONST_INT)
136 || ((enum rtx_code) (x)->code) == CONST_DOUBLE
137 || ((enum rtx_code) (x)->code) == CONST_FIXED))
138 n_var++, one_var = i;
139 else
140 all_const_zero = 0;
141 if (i > 0 && !rtx_equal_p (x, (((((vals)->u.fld[0]).rt_rtvec))->elem[0])))
142 all_same = 0;
146 if (n_var == 0)
148 return;
151 if (all_same)
152 return;
154 if (n_var == 1)
156 if (all_const_zero)
157 return;
161 ix86_expand_vector_init_general (mmx_ok, mode, target, vals);