[Mesa-dev] [PATCH 1/3] R600: fix PHI value adding in the structurizer

Christian König deathsimple at vodafone.de
Fri Feb 8 05:13:20 PST 2013


Am 07.02.2013 04:00, schrieb Tom Stellard:
> Hi Christian,
>
> I'm still unable to get the glsl1-while-loop with continue test to pass
> on R600 with the new structurizer.  For this test, the structurizer is
> producing strange code and I'm not sure if it is correct.  I have
> attached the full before and after dumps to this email.  Here is the
> suspect block:
>
> ENDIF:                                            ; preds = %LOOP
>    %46 = bitcast float %temp.0 to i32
>    %47 = add i32 %46, 1
>    %48 = bitcast i32 %47 to float
>    %49 = bitcast float %48 to i32
>    %50 = icmp slt i32 5, %49
>    %51 = sext i1 %50 to i32
>    %52 = bitcast i32 %51 to float
>    %53 = bitcast float %52 to i32
>    %54 = icmp ne i32 %53, 0
>    %55 = xor i1 %54, true
>    %56 = xor i1 %54, true
>    %57 = call { i1, i64 } @llvm.SI.if(i1 %56)
>    %58 = extractvalue { i1, i64 } %57, 0
>    %59 = extractvalue { i1, i64 } %57, 1
>    %60 = call i64 @llvm.SI.if.break(i1 %55, %i64 %0)
>    br i1 %58, label %ENDIF20, label %Flow4
>
> Notice how @llvm.SI.if and llvm.SI.if.break use the same condition.  Is
> this correct?

Well I think the code is generated more or less correctly, but it's just 
very very suboptimal :(

It should detect that %ENDIF20 has the same condition as breaking the 
loop and so generate more simplified code. Also generating two loops (an 
inner and an outer) would be more efficient here than pressing 
everything into a single loop.

I have a pretty good idea how to do this, but probably need a week or 
two to get the algorithm complete right. Since the current code still 
fixes a number of bugs on SI I think it is a good idea to commit it 
anyway, and I take a deeper look into this problem next week or so.

Christian.


More information about the mesa-dev mailing list