From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 862 invoked by alias); 27 Oct 2010 15:46:04 -0000 Received: (qmail 848 invoked by uid 22791); 27 Oct 2010 15:46:03 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_VX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Oct 2010 15:45:59 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/46199] New: Insn length wrong for AVX instructions X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 27 Oct 2010 15:46:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg02311.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46199 Summary: Insn length wrong for AVX instructions Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org #include #define F(n,r1,r2,r3) \ void \ f##n (void) \ { \ register __m128d m1 __asm (#r1); \ register __m128d m2 __asm (#r2); \ register __m128d m3 __asm (#r3); \ asm volatile ("" : "=x" (m1), "=x" (m2)); \ m3 = _mm_xor_pd (m1, m2); \ asm volatile ("" : : "x" (m3)); \ } F (1, xmm4, xmm5, xmm6) F (2, xmm12, xmm5, xmm6) F (3, xmm4, xmm13, xmm6) F (4, xmm4, xmm5, xmm14) F (5, xmm12, xmm13, xmm6) F (6, xmm12, xmm5, xmm14) F (7, xmm4, xmm13, xmm14) F (8, xmm12, xmm13, xmm14) gcc -O2 -S -dP foo.c grep vxorp foo.s vxorpd %xmm5, %xmm4, %xmm6 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm5, %xmm12, %xmm6 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm13, %xmm4, %xmm6 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm5, %xmm4, %xmm14 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm13, %xmm12, %xmm6 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm5, %xmm12, %xmm14 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm13, %xmm4, %xmm14 # 10 *avx_xorv2df3 [length = 4] vxorpd %xmm13, %xmm12, %xmm14 # 10 *avx_xorv2df3 [length = 4] objdump -dr foo.o | grep vxorp 0: c5 d9 57 f5 vxorpd %xmm5,%xmm4,%xmm6 10: c5 99 57 f5 vxorpd %xmm5,%xmm12,%xmm6 20: c4 c1 59 57 f5 vxorpd %xmm13,%xmm4,%xmm6 30: c5 59 57 f5 vxorpd %xmm5,%xmm4,%xmm14 40: c4 c1 19 57 f5 vxorpd %xmm13,%xmm12,%xmm6 50: c5 19 57 f5 vxorpd %xmm5,%xmm12,%xmm14 60: c4 41 59 57 f5 vxorpd %xmm13,%xmm4,%xmm14 70: c4 41 19 57 f5 vxorpd %xmm13,%xmm12,%xmm14 For half of the xors the length is wrong. This is issue 1) from http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01808.html See http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01339.html for shell script to check sizes. The issue here is that as one extended bit is in the base byte, and the remaining two are in the second byte, just looking for extended registers among the operands is not enough, you need to know which operand will it be. It is possible all insns have operands layed out similarly, so that you could do if the insn has just one operand, assume something, otherwise if it has two, assume which one is the special one, similarly for 3 etc. Perhaps we'll need some exceptions, which can be either handled by coming up with a new attribute or just by overriding some other attribute.