Debian Codegraph @

gcc/testsuite/gcc.c-torture/compile/pr35869.c

raw
1 struct texture_stage_op
2 {
3 unsigned int carg1, carg2, carg0;
4 unsigned int aarg1, aarg2, aarg0;
5 unsigned int dst;
6 };
7
8 static const char *debug_register(unsigned int reg) {
9 switch(reg) {
10 case 0x8921: return "GL_REG_0_ATI";
11 case 0x8923: return "GL_REG_2_ATI";
12 case 0x0: return "GL_ZERO";
13 case 0x1: return "GL_ONE";
14 default: return "Unknown register\n";
15 }
16 }
17
18 static unsigned int find_tmpreg(struct texture_stage_op op[8]) {
19 int i;
20 int tex_used[8];
21
22 for(i = 0; i < 8; i++) {
23 if(op[i].carg1 == 0x00000002 ) {
24 tex_used[i] = 1;
25 }
26 }
27
28 for(i = 1; i < 6; i++) {
29 if(!tex_used[i]) {
30 return 0x8921 + i;
31 }
32 }
33 return 0;
34 }
35
36 extern void f(const char*);
37
38 void g() {
39 struct texture_stage_op op[8];
40 unsigned int tmparg = find_tmpreg(op);
41 unsigned int dstreg;
42
43 if(tmparg == 0x0) return;
44 dstreg = tmparg;
45 f(debug_register(dstreg));
46 return;
47 }