This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Optimize certain end of loop conditions into min/max operation


On Fri, 18 Sep 2015, Michael Collison wrote:

Can you elaborate on merging the patterns using 'ext' as mentioned in your post? I don't see any documentation or examples.

https://gcc.gnu.org/onlinedocs/gccint/The-Language.html
"for" lets you iterate on several variables at the same time.

For instance,

(for bitop (bit_and bit_ior)
     rbitop (bit_ior bit_and)
 (simplify
  (bitop:c (rbitop:c @0 @1) (bit_not@2 @0))
  (bitop @1 @2)))

expands to

(simplify
 (bit_and:c (bit_ior:c @0 @1) (bit_not@2 @0))
 (bit_and @1 @2))
(simplify
 (bit_ior:c (bit_and:c @0 @1) (bit_not@2 @0))
 (bit_ior @1 @2))

there are other examples using

(for cmp (eq ne)
     icmp (ne eq)

or

(for cmp (simple_comparison)
     scmp (swapped_simple_comparison)

and you can have repetitions

(for logs (LOG LOG
	   LOG2 LOG2
	   LOG10 LOG10)
     exps (SQRT CBRT)

(the iteration wraps around for exps).

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]