Bug 80037

Summary: i965: Figure out how to remove copy-propagated MOV x, (abs)x
Product: Mesa Reporter: Matt Turner <mattst88>
Component: Drivers/DRI/i965Assignee: Ian Romanick <idr>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: itoral
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 77547    

Description Matt Turner 2014-06-14 21:28:22 UTC
Some psychonauts shaders do pow(abs(x), y), which generates

mov vgrf10:F, |vgrf10|:F
pow vgrf53:F, vgrf10:F, vgrf55:F

We copy propagate from the MOV into the POW:

mov vgrf10:F, |vgrf10|:F
pow vgrf53:F, |vgrf10|:F, vgrf55:F

but since vgrf10 is used after the MOV, dead code elimination isn't able to recognize that it's no longer used and so we can't remove it.

We could probably handle this in copy-propagation. After copy-propagating a MOV x, (abs)x instruction we'd check if its value has been propagated into all uses of the MOV's destination, and if so remove the MOV.
Comment 1 Iago Toral 2014-09-11 10:09:44 UTC
(In reply to comment #0)
> Some psychonauts shaders do pow(abs(x), y), which generates
> 
> mov vgrf10:F, |vgrf10|:F
> pow vgrf53:F, vgrf10:F, vgrf55:F
> 
> We copy propagate from the MOV into the POW:
> 
> mov vgrf10:F, |vgrf10|:F
> pow vgrf53:F, |vgrf10|:F, vgrf55:F

This is not happening for me. What I get is something like this:

mov(8)          g11<1>F         (abs)g7<4,4,1>.xF
math pow(8)     g13<1>F         g11<8,8,1>F     g12<8,8,1>F


This was on SNB... is abs copy propagation only happening for specific hardware generations?
Comment 2 Matt Turner 2014-09-11 15:45:59 UTC
Yes, since SNB can't do source modifiers on math instructions.
Comment 3 Matt Turner 2015-02-11 23:25:48 UTC
I think the register renaming pass has solved this.

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.