Bug 87661

Summary: Move some literal constants to push constants
Product: Mesa Reporter: Ian Romanick <idr>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED MOVED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: All   
OS: All   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 77547    

Description Ian Romanick 2014-12-24 02:28:10 UTC
I have observed a shader that generates code like this:

mov(16)         g17<1>F         0.321569F                       { align1 1H };
cmp.ge.f0(16)   g15<1>D         -g10<8,8,1>F    0F              { align1 1H };
and.nz.f0(16)   null            g15<8,8,1>D     1D              { align1 1H compacted };
mov(16)         g19<1>F         0.498039F                       { align1 1H };
mov(16)         g21<1>F         0.223529F                       { align1 1H };
mov(16)         g23<1>F         1F                              { align1 1H };
(-f0) sel(16)   g120<1>F        g17<8,8,1>F     0.12549F        { align1 1H };
(-f0) sel(16)   g122<1>F        g19<8,8,1>F     0.27451F        { align1 1H };
(-f0) sel(16)   g124<1>F        g21<8,8,1>F     0.192157F       { align1 1H };
(-f0) sel(16)   g126<1>F        g23<8,8,1>F     0F              { align1 1H };

If one set of literal constants were moved to push constants, we could save 4 instructions.  The entire shader in question was only 15 instructions, so that would be worthwhile for that case.  In other cases it may be more problematic.
Comment 1 Eero Tamminen 2016-07-12 10:57:29 UTC
Ian, is this still an issue, and if yes, could you attach an example shader?
Comment 2 GitLab Migration User 2019-09-25 18:53:03 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1467.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.