On Mon, Jun 27, 2011 at 7:17 PM, Kai Tietz <kti...@redhat.com> wrote: > Ups, missed to update patch.
You still modify the /* If the first argument is an SSA name that is itself a result of a typecast of an ADDR_EXPR to an integer, feed the ADDR_EXPR to the folder rather than the ssa name. */ block. Please merge the constant handling with the CONVERT_EXPR_CODE_P path instead. The above block is purely legacy and should probably be entirely dropped. Richard. > Kai > > ----- Original Message ----- > From: "Kai Tietz" <kti...@redhat.com> > To: "Richard Guenther" <richard.guent...@gmail.com> > Cc: gcc-patches@gcc.gnu.org > Sent: Monday, June 27, 2011 7:04:04 PM > Subject: Re: [patch tree-optimization]: Try to sink type-casts for binary > and/or/xor operations > > Hi, > > so I modified patch to use int_fits_type_p() for integer CST checking. Well, > this approach is - as discussed on IRC suboptimal - as my intial approach was > for and-operations with precision type > precision type-x and unsigned type-x > for constant values bigger then (type-x)~0. > But well, those we miss now by int_fits_type_p() approach, too. And also we > miss now the cases for that type is signed and type-x is unsigned with same > precision. > > Anyway ... here is the updated patch > > Regards, > Kai > > ----- Original Message ----- > From: "Richard Guenther" <richard.guent...@gmail.com> > To: "Kai Tietz" <kti...@redhat.com> > Cc: gcc-patches@gcc.gnu.org > Sent: Monday, June 27, 2011 4:08:41 PM > Subject: Re: [patch tree-optimization]: Try to sink type-casts for binary > and/or/xor operations > > On Mon, Jun 27, 2011 at 3:46 PM, Kai Tietz <kti...@redhat.com> wrote: >> Hello, >> >> this patch sink type conversions in forward-propagate for the following >> patterns: >> - ((type) X) op ((type) Y): If X and Y have compatible types. >> - ((type) X) op CST: If the conversion of (type) ((type-x) CST) == CST and X >> has integral type. >> - CST op ((type) X): If the conversion of (type) ((type-x) CST) == CST and X >> has integral type. > > See IRC comments. > >> Additionally it fixes another issue shown by this type-sinking in bswap >> detection. The bswap pattern matching algorithm goes for the first hit, and >> not tries to seek for best hit. So we search here two times. First for di >> case (if present) and then for si mode case. > > Please split this piece out. I suppose either walking over stmts backwards > or simply handling __builtin_bswap in find_bswap_1 would be a better > fix than yours. > > Richard. > >> ChangeLog >> >> 2011-06-27 Kai Tietz <kti...@redhat.com> >> >> * tree-ssa-forwprop.c (simplify_bitwise_binary): Improve >> type sinking. >> * tree-ssa-math-opts.c (execute_optimize_bswap): Separate >> search for di/si mode patterns for finding widest match. >> >> Bootstrapped and regression tested for x86_64-pc-linux-gnu. Ok for apply? >> >> Regards, >> Kai >> >