[Mesa-dev] [PATCH 11/11] glsl: Optimize X / X == 1

2014-08-07 Thread thomashelland90
From: Thomas Helland Shows no changes for shader-db. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 21bf332..a49752d 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/s

[Mesa-dev] [PATCH 10/11] glsl: Optimize X + neg(X) == 0 and the other way around

2014-08-07 Thread thomashelland90
From: Thomas Helland Since we lower A - B to A + neg(B) on some architectures lets add a optimization for this pattern. This yields some gains in a shader-db run with extra shaders added from Team Fortress 2 and Portal. helped: shaders/tf2/1684.shader_test fs16: 62 -> 60 (-3.23%) helpe

[Mesa-dev] [PATCH v3 09/11] glsl: Optimize logic operation A || (A && B)

2014-08-07 Thread thomashelland90
From: Thomas Helland Let's cut the needless A && B here. v1 -> v2: Correct the comments, return A instead of A && B v2 -> v3: Rebase on top of this series Signed-off-by: Thomas Helland --- This was originally posted here: http://lists.freedesktop.org/archives/mesa-dev/2014-July/063129.html v2

[Mesa-dev] [PATCH v2 05/11] glsl: Optimize log(x) + log(y) == log(x*y)

2014-08-07 Thread thomashelland90
From: Thomas Helland And the log2() equivalent. v1 -> v2: Correct trailing whitespace Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cp

[Mesa-dev] [PATCH v2 08/11] glsl: Optimize A - neg(B) = A + B

2014-08-07 Thread thomashelland90
From: Thomas Helland v1 -> v2: Drop the neg(A) - B == neg(A+B) part Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 0ecadbe..c673495 100644 --- a/src/glsl/opt_algeb

[Mesa-dev] [PATCH 06/11] glsl: Optimize exp(x) * exp(y) == exp(x*y)

2014-08-07 Thread thomashelland90
From: Thomas Helland And it's exp2() equivalent. Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 141b930..0e21ff8 100644 --- a/s

[Mesa-dev] [PATCH v2 04/11] glsl: Optimize (A || B) && A == A

2014-08-07 Thread thomashelland90
From: Thomas Helland And it's cousins v1 -> v2: Correct indentation Correct returned operand from second if statement Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_a

[Mesa-dev] [PATCH v2 07/11] glsl: Optimize some more pow() special cases

2014-08-07 Thread thomashelland90
From: Thomas Helland Specifically x^-1 = rcp(x) .0^x = 0 .x^0 = 1 v1 -> v2: Correct indentation Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/glsl/opt_al

[Mesa-dev] [PATCH 03/11] glsl: Optimize !A && A == 0

2014-08-07 Thread thomashelland90
From: Thomas Helland Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 67326c5..cdabdb8 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/sr

[Mesa-dev] [PATCH v2 02/11] glsl: Optimize !A || A == 1

2014-08-07 Thread thomashelland90
From: Thomas Helland v1 -> v2: Correct indentation Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c179d53..67326c5 100644 ---

[Mesa-dev] [PATCH v2 01/11] glsl: Optimize X - X == 0

2014-08-07 Thread thomashelland90
From: Thomas Helland v1 -> v2: Corrected indentation. Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..c179d53 100644 --- a/src/gl

[Mesa-dev] [PATCH 00/11] glsl: Collection of algebraic optimizations

2014-08-07 Thread thomashelland90
From: Thomas Helland Some of these patches have been posted to the list before. Eric showed interest in these being merged, so I addressed his points. Pathces 1 - 7 I've added Eric's R-B on. Patch 8 drops the part that people had doubt on. Patch 9 has been posted before, and seemed to be accept

[Mesa-dev] [PATCH 00/10] [RFC] Probably useless algebraic optimizations

2014-07-14 Thread thomashelland90
From: Thomas Helland When writing that A || (A && B) patch some days ago I also wrote some other patches that have no impact on my collection of shaders. (shader-db + Some TF2 and Portal-shaders). No reduction in instruction count, and no significant increase in compilation time. I decided to pu

[Mesa-dev] [PATCH 06/10] glsl: Optimize max(8, sin(x)) == 8 and similar

2014-07-14 Thread thomashelland90
From: Thomas Helland This also only handles floats. ir_unop_saturate should also be added when the support for this lands in the ir. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 38 ++ 1 file changed, 38 insertions(+) diff --git a/src/glsl

[Mesa-dev] [PATCH 03/10] glsl: Optimize !A && A == 0

2014-07-14 Thread thomashelland90
From: Thomas Helland Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 385f0a2..748fd05 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @

[Mesa-dev] [PATCH 01/10] glsl: Optimize X - X -> 0

2014-07-14 Thread thomashelland90
From: Thomas Helland Silly optimization indeed, but who knows. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..c179d53 100644 --- a/src/glsl/opt_algebraic.

[Mesa-dev] [PATCH 10/10] glsl: Optimize some more pow() special cases

2014-07-14 Thread thomashelland90
From: Thomas Helland Specifically x^-1 = rcp(x) .0^x = 0 .x^0 = 1 Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index fba9de6..1

[Mesa-dev] [PATCH 02/10] glsl: Optimize !A || A == 1

2014-07-14 Thread thomashelland90
From: Thomas Helland Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c179d53..385f0a2 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic

[Mesa-dev] [PATCH 08/10] glsl: Optimize exp(x)*exp(y) == exp(x+y)

2014-07-14 Thread thomashelland90
From: Thomas Helland And it's exp2() equivalent. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index e2abf5f..2361d0f 100644 --- a/src/glsl/opt_algebraic.cpp

[Mesa-dev] [PATCH 05/10] glsl: Optimize min(-8, sin(x)) == -8 and similar

2014-07-14 Thread thomashelland90
From: Thomas Helland This patch is a bit sketchy. It only handles float-constants, otherwise it bails. Also, ir_unop_saturate should be added here when support for it lands in the ir. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 37 + 1 fil

[Mesa-dev] [PATCH 09/10] glsl: Optimize A - neg(B) == A + B

2014-07-14 Thread thomashelland90
From: Thomas Helland ...and neg(A) - B == neg(A + B) Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 2361d0f..fba9de6 100644 --- a/src/glsl/opt_algebraic.cpp ++

[Mesa-dev] [PATCH 07/10] glsl: Optimize log(x) + log(y) == log(x*y)

2014-07-14 Thread thomashelland90
From: Thomas Helland And the log2() equivalent. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index deaa49e..e2abf5f 100644 --- a/src/glsl/opt_algebraic.cpp

[Mesa-dev] [PATCH 04/10] glsl: Optimize (A || B) && A == A

2014-07-14 Thread thomashelland90
From: Thomas Helland And it's cousins Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 748fd05..230fb1b 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/gl

[Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B) v2

2014-07-12 Thread thomashelland90
From: Thomas Helland Let's cut the needless A && B here. Gives some effect on a clean shader-db with some extra shaders from TF2 and portal. helped: shaders/tf2/2042.shader_test fs16:23 -> 21 (-8.70%) helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 (-8.70%) helped: shaders/tf2

[Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B)

2014-07-10 Thread thomashelland90
From: Thomas Helland Let's cut the needless A && B here. Gives some effect on a clean shader-db with some extra shaders from TF2 and portal. helped: shaders/tf2/2042.shader_test fs16:23 -> 21 (-8.70%) helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 (-8.70%) hel

[Mesa-dev] [PATCH 09/11] glsl: Remove unused include from ir_constant_expression.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_constant_expression.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 8afe8f7..7b4a2

[Mesa-dev] [PATCH 07/11] glsl: Remove unused include from hir_field_selection.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system Signed-off-by: Thomas Helland --- src/glsl/hir_field_selection.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 1e92c89..0fa9768 100644 -

[Mesa-dev] [PATCH 10/11] glsl: Remove unused include in ir.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 8fed768..10c0006 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -23,

[Mesa-dev] [PATCH 06/11] glsl: Remove unused include from glsl_symbol_table.h

2014-06-09 Thread thomashelland90
From: Thomas Helland Only function-defs use glsl_type so forward declare instead. Compile-tested on my Ivy-bridge system. IWYU also suggests removing #include , and this compiles fine. I'm not familiar enough with memory management in C/C++ that I feel comfortable removing this. Insights would b

[Mesa-dev] [PATCH 11/11] glsl: Remove unused include in expr.flatt.

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_expression_flattening.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index c1cadb

[Mesa-dev] [PATCH 08/11] glsl: Remove unused include from ir_basic_block.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_basic_block.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index 426fda2..74ee4b6 100644 --- a/src/gls

[Mesa-dev] [PATCH 04/11] glsl: Remove unused include from builtin_variables.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/builtin_variables.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 9b35850..e22b083 100644 --- a/

[Mesa-dev] [PATCH 00/11] glsl: Remove unused includes found with IWYU

2014-06-09 Thread thomashelland90
From: Thomas Helland This series removes some unused includes in the glsl-directory. These were found with Google's include-what-you-use plugin for clang. Patches have been compile-tested and a quick glxgears-run has been done. I have not done a full piglit-run, let me know if that's wanted. Oh,

[Mesa-dev] [PATCH 03/11] glsl: Remove unused include in ast_to_hir.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Comment says it's for struct gl_extensions. Grepping for gl_extensions shows no uses. Tested by compiling on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ast_to_hir.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ast_to_

[Mesa-dev] [PATCH 02/11] glsl: Remove unused includes in link_uniform_block_active_visitor.h

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU, compile-tested on my Ivy-bridge system. This is not used in the header, and is included in the source. Signed-off-by: Thomas Helland --- src/glsl/link_uniform_block_active_visitor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/link_uniform

[Mesa-dev] [PATCH 05/11] glsl: Remove unused include from glsl_types.cpp

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Added comment about core.h being used for MAX2. Signed-off-by: Thomas Helland --- src/glsl/glsl_types.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl

[Mesa-dev] [PATCH 01/11] glsl: Remove unused includes in link_uniform_init.

2014-06-09 Thread thomashelland90
From: Thomas Helland Found with IWYU, confirmed with grepping for "hash" and "symbol". No negative effects on compilation. IWYU also reported core.h and linker.h could be removed, but I'm unsure if those are false positives. Signed-off-by: Thomas Helland --- src/glsl/link_uniform_initializers