------- Comment #12 from wilson at gcc dot gnu dot org 2006-02-28 02:13 ------- This looks like an assembler problem to me, and a known one at that.
The assembly code in question, somewhat simplified, is .pred.rel.mutex p8, p9 (p9) cmp4.lt p6, p7 = 1, r38 (p8) cmp4.gt p6, p7 = -1, r38 ;; (p6) addl r14 = 1, r0 (p7) mov r14 = r0 The assembler should be able to figure out that this is safe. Unfortunately, the dependency violation checking code in the assembler was never finished. The problem is far harder than we originally thought, and the current code can't handle complicated nested cases like this. I estimate that fixing the general problem is 1 month of work if I do the job, and 2 months if anyone else does it. Since IA-64 work is a hobby for me, it is unlikely I will tackle a job this large. Maybe this specific problem is simpler to fix than the general case, but I'm reluctant to go that way. I would prefer that the code be rewritten from scratch, properly, rather than add hacks for special cases. I suspect that the problem does not occur with gcc-4.x, because somewhere along the line, someone made it stupider in order to fix a bug, and it no longer generates the complicated nested DV cases that the assembler can't handle. Trying "grep ') cmp' test.s | wc" with the two testcases to find predicated compare instructions gives 32 for the gcc-3.4 compiled one, and 11 for the gcc-4.0 compiled one. Actually, looking closely, I do see one possible problematic sequence in the gcc-4.0 output, but it is immediately followed by a branch, and this forces the compiler to insert a .pred.rel.mutex directive at the target label. Thus the gcc-4.0 output assembles cleanly, but this may just be a happy accident. As a workaround, we could modify the compiler to try to detect nested DV cases, and emit extra unnecessary .pred.rel.mutex directives for them. This would work around the assembler bug. This isn't the best solution, but may be simpler than trying to fix the assembler. -- wilson at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wilson at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26436