From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18334 invoked by alias); 14 Mar 2004 10:57:24 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 18323 invoked from network); 14 Mar 2004 10:57:23 -0000 Received: from unknown (HELO mtagate3.de.ibm.com) (195.212.29.152) by sources.redhat.com with SMTP; 14 Mar 2004 10:57:23 -0000 Received: from d12relay01.megacenter.de.ibm.com (d12relay01.megacenter.de.ibm.com [9.149.165.180]) by mtagate3.de.ibm.com (8.12.10/8.12.10) with ESMTP id i2EAvHxJ103682; Sun, 14 Mar 2004 10:57:17 GMT Received: from d12ml102.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12relay01.megacenter.de.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id i2EAvKXV280158; Sun, 14 Mar 2004 11:57:21 +0100 Subject: Fw: [lno] [RFC] if-conversion and auto vectorizer To: Andrew Pinski Cc: gcc@gcc.gnu.org, Devang Patel Message-ID: From: Dorit Naishlos Date: Sun, 14 Mar 2004 10:57:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-SW-Source: 2004-03/txt/msg00626.txt.bz2 > I will also be doing the following soon (after MIN/MAX becomes gimple > which has already be discussed and approved): I seem to have missed the MIN/MAX discussion thread. Do you have a link to that, or was it off the mailing list? just curious when is it planned to add the MIN/MAX tree codes to gimple and who is responsible for that? > But I have not thought about the if-conversions which you are asking > for yet. Since the ABS, MIN/MAX, etc. are special cases of the if-conversion we are proposing, it looks like there will be an overlap between what we plan to implement, and the transformations that will take place during phiopt, which made us wonder whether it would make sense to implement our transformation during phiopt as well. For example, in the case of ABS: bb0: x = src[i] if (x < 0) GOTO BB1 else GOTO BB2 bb1: x' = -x bb2: x'' = PHI dst[i] = x'' In the general case, the if-conversion we're proposing would transform it into: bb0: x = src[i] C = CMP (x < 0) x' = -x x'' = "SELECT" C, x', x dst[i] = x'' and in special cases (like ABS, saturation, etc) we would then (or before hand) detect the special pattern and further optimize it as follows: bb0: x = src[i] x'' = ABS x dst[i] = x'' Our main concern is that we don't know that this transformation is desirable in the general case - we know its desirable when it enables vectorization, but we're not sure we want to be blindly replacing IF-THEN-ELSE's with SELECT's (or COND_EXPR) all over the place (it would result in doing a lot of transform-IF-THEN-ELSE-into-SELECT during phiopt followed by expand-SELECT-into-IF-THEN-ELSE during RTL expand). Therefore, we originally thought of creating the "SELECT" patterns just before the vectorizer, in places that are candidate for vectorization (loops), and revert them back to if-then-else right after vectorization if they don't get vectorized. This way, "SELECT"s will only be present after vectorization, and only in vector form (operating on vector data types), which is somewhat less intrusive (only passes that come after vectorization may encounter SELECTs, and we also won't need to worry about expanding SELECTs back to if-the-else during RTL expand). However, considering that a lot of ifcvt functionality is going to take place in phiopt, maybe phiopt is the right place for our ifcvt after all? this way, there would be only one pass that performs all ifcvt-related opts, and no danger of duplicating work (we don't want to end up implementing a pass that will become obsolete as phiopt pass is being enhanced). Please advise... thanks, Dorit and Devang Andrew Pinski uc.edu> cc: "gcc@gcc.gnu.org list" , Dorit Naishlos/Haifa/IBM@IBMIL, Andrew Pinski 04/03/2004 22:12 Subject: Re: [lno] [RFC] if-conversion and auto vectorizer There are already some if-conversions on the tree-ssa right now, they are called PHI OPTs and in tree-ssa-phiopt.c, I am trying to add some more right now but they most likely will be added to the LNO branch after an other merge from the tree-ssa branch. Right now on the tree-ssa the following optimization is done: if (a == b) 1 else 0 into a == b Right now I add the following: if (a >= 0) a else -a into ABS (a). if (a != b) a else b into a. I will also be doing the following soon (after MIN/MAX becomes gimple which has already be discussed and approved): if (a >= b) a else b into MAX (a, b) if (a <= b) a else b into MIN (a, b). But I have not thought about the if-conversions which you are asking for yet. Thanks, Andrew Pinski