Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/pr111334.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 unsigned
5 util_next_power_of_two (unsigned x)
6 {
7 return (1 << __builtin_clz (x - 1));
8 }
9
10 extern int create_vec_from_array (void);
11
12 struct ac_shader_args {
13 struct {
14 unsigned char offset;
15 unsigned char size;
16 } args[384];
17 };
18
19 struct isel_context {
20 const struct ac_shader_args* args;
21 int arg_temps[384];
22 };
23
24
25 void
26 add_startpgm (struct isel_context* ctx, unsigned short arg_count)
27 {
28
29 for (unsigned i = 0, arg = 0; i < arg_count; i++)
30 {
31 unsigned size = ctx->args->args[i].size;
32 unsigned reg = ctx->args->args[i].offset;
33
34 if (reg % ( 4 < util_next_power_of_two (size)
35 ? 4 : util_next_power_of_two (size)))
36 ctx->arg_temps[i] = create_vec_from_array ();
37 }
38 }
39