[PATCH][GCC] Algorithmic optimization in match and simplify

Marc Glisse marc.glisse@inria.fr
Fri Aug 28 18:13:00 GMT 2015


(not a review, I haven't even read the whole patch)

On Fri, 28 Aug 2015, Andre Vieira wrote:

> 2015-08-03  Andre Vieira  <andre.simoesdiasvieira@arm.com>
>
>  * match.pd: Added new patterns:
>    ((X {&,<<,>>} C0) {|,^} C1) {^,|} C2)
>    (X {|,^,&} C0) {<<,>>} C1 -> (X {<<,>>} C1) {|,^,&} (C0 {<<,>>} C1)

+(for op0 (rshift rshift lshift lshift bit_and bit_and)
+ op1 (bit_ior bit_xor bit_ior bit_xor bit_ior bit_xor)
+ op2 (bit_xor bit_ior bit_xor bit_ior bit_xor bit_ior)

You can nest for-loops, it seems clearer as:
(for op0 (rshift lshift bit_and)
  (for op1 (bit_ior bit_xor)
       op2 (bit_xor bit_ior)

+(simplify
+ (op2:c
+  (op1:c
+   (op0 @0 INTEGER_CST@1) INTEGER_CST@2) INTEGER_CST@3)

I suspect you will want more :s (single_use) and less :c (canonicalization 
should put constants in second position).

+	C1 = wi::bit_and_not (C1,C2);

Space after ','.

Having wide_int_storage in many places is surprising, I can't find similar 
code anywhere else in gcc.


-- 
Marc Glisse



More information about the Gcc-patches mailing list