From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15490 invoked by alias); 25 Apr 2006 19:07:58 -0000 Received: (qmail 15423 invoked by uid 48); 25 Apr 2006 19:07:53 -0000 Date: Tue, 25 Apr 2006 19:07:00 -0000 Message-ID: <20060425190753.15422.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/27313] Does not emit conditional moves for stores In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "dwarak dot rajagopal at amd dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-04/txt/msg02231.txt.bz2 List-Id: ------- Comment #3 from dwarak dot rajagopal at amd dot com 2006-04-25 19:07 ------- Yes this is true. The example I posted was a simplest case where it fails. Below mmight be a typical case where you have to do two stores. int cmov(int* A ,int B ,int C ,int* D ,int* E ,int F ,int g) { int k,f; for (k = 1; k <= 1000; k++) { A[k] = B+C; D[k] = C; /* D[k] may alias with A[k] */ g = D[k-1] + E[k-1]; if (g > A[k]) A[k]=g; /* This is not converted to cmov*/ f += g; } return f; } In this case, you cannot reduce the number of stores (becasue D[k] may alias with A[k]) but you still want the if conversion to take place. I think it is good to have a mechanism to track if a memory is already been written in ifcvt. I'm not sure how it can be done at this level though. -Dwarak (In reply to comment #2) > The other way of getting this is to have the code converted so there is only > one store instead of two: > > int cmov(int* A ,int B ,int C ,int* D ,int* E ,int F ,int g) { > int k,f; > for (k = 1; k <= 1000; k++) { > int t = B+C; > g = D[k-1] + E[k-1]; > if (g > t) t=g; /* This is not converted to cmov*/ > A[K] = t; > f += g; > } > return f; > } > Which is most likely better anyways as one it is smaller. > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27313