From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23507 invoked by alias); 27 Mar 2003 03:56:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23488 invoked by uid 71); 27 Mar 2003 03:56:01 -0000 Resent-Date: 27 Mar 2003 03:56:01 -0000 Resent-Message-ID: <20030327035601.23487.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, dean-gcc@arctic.org Received: (qmail 22330 invoked by uid 48); 27 Mar 2003 03:54:16 -0000 Message-Id: <20030327035416.22329.qmail@sources.redhat.com> Date: Thu, 27 Mar 2003 05:06:00 -0000 From: dean-gcc@arctic.org Reply-To: dean-gcc@arctic.org To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/10233: 64-bit comparison only comparing bottom 32-bits X-SW-Source: 2003-03/txt/msg01870.txt.bz2 List-Id: >Number: 10233 >Category: optimization >Synopsis: 64-bit comparison only comparing bottom 32-bits >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Mar 27 03:56:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: dean-gcc@arctic.org >Release: gcc version 3.2.3 20030316 (Debian prerelease) >Organization: >Environment: debian unstable >Description: when i compile the below source with gcc 3.2.3 20030316 (debian prerelease), or with gcc version 3.3 20030129 (Debian prerelease) the result is code which only compares the bottom half of the 64-bit value which i've asked it to compare. notice the "movd %mm1,%esi" to get the bottom 32... and mm1 is also stored to the stack, and the bottom 32-bits are compared. i think there's an offset by 4 missing somewhere. >How-To-Repeat: dean@zim:~/verification$ cat gccbug.c #include #include typedef union { uint64_t uq[1]; __m64 m; } mm_t __attribute__((aligned(8))); int foo(mm_t *p, const mm_t *q) { mm_t t; //asm("psllw $1,%0" : "=&y" (t.m) : "0" (p)); t.m = _mm_slli_pi16(p->m, 1); return t.uq[0] == q->uq[0]; } dean@zim:~/verification$ gcc -c -O3 -mmmx -Wall gccbug.c dean@zim:~/verification$ objdump -dr gccbug.o gccbug.o: file format elf32-i386 Disassembly of section .text: 00000000 : 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 57 push %edi 4: 56 push %esi 5: 53 push %ebx 6: 83 ec 0c sub $0xc,%esp 9: 8b 75 08 mov 0x8(%ebp),%esi c: 0f 6f 0e movq (%esi),%mm1 f: 8b 4d 0c mov 0xc(%ebp),%ecx 12: 0f 71 f1 01 psllw $0x1,%mm1 16: 8b 39 mov (%ecx),%edi 18: 8b 51 04 mov 0x4(%ecx),%edx 1b: 0f 7e ce movd %mm1,%esi 1e: 0f 7f 4d e8 movq %mm1,0xffffffe8(%ebp) 22: 31 d6 xor %edx,%esi 24: 8b 5d e8 mov 0xffffffe8(%ebp),%ebx 27: 31 fb xor %edi,%ebx 29: 89 f0 mov %esi,%eax 2b: 09 d8 or %ebx,%eax 2d: 0f 94 c2 sete %dl 30: 83 c4 0c add $0xc,%esp 33: 5b pop %ebx 34: 5e pop %esi 35: 0f b6 c2 movzbl %dl,%eax 38: 5f pop %edi 39: c9 leave 3a: c3 ret >Fix: >Release-Note: >Audit-Trail: >Unformatted: