[Mesa-dev] [PATCH 1/2] nvc0/ir: detect AND/SHR pairs and convert into EXTBF
imirkin at alum.mit.edu
Tue Aug 18 19:00:22 PDT 2015
On Tue, Aug 18, 2015 at 9:57 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Tue, Aug 18, 2015 at 6:49 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Some shaders appear to extract bits using shift/and combos. Detect
>> (some) of those and convert to EXTBF instead.
> What is EXTBF? Extract byte to float?
> I ask because Unigine Heaven has shaders that pack 3x byte-integers
> into one component of a vec4 and extracts them with shifts/ands and
> converts them to floats, and i965 could do the extraction and
> conversion in a single instruction. I'm curious if this is the same
> thing you're optimizing.
> I thought about adding an extract_byte(src, byte_num) operation, but
> i965's copy propagation caused me some headache and I shelved it.
Yes, I think it's the same shader... it's doing a texelFetch() and
then grabbing bytes 0, 1, 2 off that.
The generated shader code after the second patch does:
/*05d0*/ TLD.LL.P R0, R24, 0x0, 2D, 0x3;
/*05d8*/ TEXDEPBAR 0x0;
/*05e0*/ I2F.F32.U8 R2, R1;
/*05e8*/ FFMA.FTZ R2, R2, R15, R19;
/*05f0*/ I2F.F32.U8 R8, R1.B1;
/*05f8*/ FFMA.FTZ R8, R8, R15, R19;
/*0608*/ I2F.F32.U8 R1, R1.B2;
I'll let you guess what these things mean. TLD = texelfetch :)
More information about the mesa-dev