Re: [Mesa-dev] [PATCH v3 134/133] nir/opcodes: Add algebraic properties metadata

2014-12-20 Thread Roland Scheidegger
Am 20.12.2014 um 03:02 schrieb Matt Turner: > On Fri, Dec 19, 2014 at 5:04 PM, Jason Ekstrand wrote: >> v3: fmin and fmax technically aren't commutative or associative. Things >> get funny when one of the arguments is a NaN. > > I have a difficult time believing that the GLSL definitions of

Re: [Mesa-dev] [PATCH v3 134/133] nir/opcodes: Add algebraic properties metadata

2014-12-20 Thread Marek Olšák
Hi Jason, The DX10 version of min/max is indeed commutative. However, GLSL specs define min/max using a conditional assignment: mix(x) = y < x ? y : x; max(x) = x < y ? y : x; which means that if either argument is NaN, x is returned., which means that you can combine open-coded min/max function

Re: [Mesa-dev] [PATCH v3 134/133] nir/opcodes: Add algebraic properties metadata

2014-12-19 Thread Jason Ekstrand
On Fri, Dec 19, 2014 at 6:02 PM, Matt Turner wrote: > > On Fri, Dec 19, 2014 at 5:04 PM, Jason Ekstrand > wrote: > > v3: fmin and fmax technically aren't commutative or associative. Things > > get funny when one of the arguments is a NaN. > > I have a difficult time believing that the GLSL d

Re: [Mesa-dev] [PATCH v3 134/133] nir/opcodes: Add algebraic properties metadata

2014-12-19 Thread Matt Turner
On Fri, Dec 19, 2014 at 5:04 PM, Jason Ekstrand wrote: > v3: fmin and fmax technically aren't commutative or associative. Things > get funny when one of the arguments is a NaN. I have a difficult time believing that the GLSL definitions of min() and max() intentionally have that effect. To

[Mesa-dev] [PATCH v3 134/133] nir/opcodes: Add algebraic properties metadata

2014-12-19 Thread Jason Ekstrand
This commit adds some algebraic properties to the metadata of each opcode in NIR. In particular, you now know, just from the metadata, if a given opcode is commutative or associative. This will be useful for algebraic transformation passes that want to be able to match a + b as well as b + a in o