From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18458 invoked by alias); 27 Apr 2009 17:05:00 -0000 Received: (qmail 13985 invoked by uid 48); 27 Apr 2009 17:04:38 -0000 Date: Mon, 27 Apr 2009 17:05:00 -0000 From: "rsa at us dot ibm dot com" To: glibc-bugs@sources.redhat.com Message-ID: <20090427170435.10107.rsa@us.ibm.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/10107] New: 32-bit PowerPC POWER6 memcpy uses erroneous cmpldi but should use cmplwi X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00180.txt.bz2 The 32-bit PowerPC POWER6 memcpy uses the cmpldi insn when it should use a cmplwi. /* Compare the contents of register 'r5' to the value '16' where r5 */ /* holds '12'. */ cmpldi cr1,5,16 This doesn't normally prove to be a problem except when the 'length' parameter to memcpy, held in register r5 is a computed value and the result has the high 32-bits of the register populated with junk due 64-bit operation (in the error case a rlwinm insn),e.g. 0x1007c240 : rlwinm r9,r0,0,0,29 0x1007c244 : addi r5,r9,16 0x1007c248 : bl 0x100dc750 This causes the cmpldi to result in 'greater' than when comparing '12' to '16' which is erroneous. The correction instruction is cmplwi which ignores the high 32-bits or 'r5': cmplwi cr1,5,16 I'll supply a patch and a testcase shortly. -- Summary: 32-bit PowerPC POWER6 memcpy uses erroneous cmpldi but should use cmplwi Product: glibc Version: 2.9 Status: NEW Severity: normal Priority: P1 Component: libc AssignedTo: rsa at us dot ibm dot com ReportedBy: rsa at us dot ibm dot com CC: glibc-bugs at sources dot redhat dot com GCC build triplet: powerpc-linux GCC host triplet: powerpc-linux GCC target triplet: powerpc-linux http://sourceware.org/bugzilla/show_bug.cgi?id=10107 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.