From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26088 invoked by alias); 24 Mar 2014 11:35:32 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 26077 invoked by uid 89); 24 Mar 2014 11:35:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,FRT_ADOBE2,RCVD_IN_DNSWL_LOW,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Mar 2014 11:35:20 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Mon, 24 Mar 2014 11:35:17 +0000 Received: from [10.1.205.52] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 24 Mar 2014 11:35:30 +0000 Message-ID: <53301873.1070205@arm.com> Date: Mon, 24 Mar 2014 11:35:00 -0000 From: Jiong Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Binutils Subject: [PATCH, AArch64] Complete undefined encodings check on st* X-MC-Unique: 114032411351710801 Content-Type: multipart/mixed; boundary="------------030004070704040304010800" X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00250.txt.bz2 This is a multi-part message in MIME format. --------------030004070704040304010800 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 484 AArch64 disassembler failed to detect those undefined encodings on=20 st1/st2/st3/st4. This patch completed these checks. OK for trunk and 2.24 branch? Thanks. --=20 Jiong opcodes/ * aarch64-dis.c (aarch64_ext_ldst_elemlist): Check H/S undefined=20 instructions. binutils/testsuite/ * binutils-all/aarch64/aarch64.exp: New test driver for AArch64. * binutils-all/aarch64/unallocated-encoding.s: New testcase. * binutils-all/aarch64/unallocated-encoding.d: Ditto. --------------030004070704040304010800 Content-Type: text/x-patch; name=decodingv3.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="decodingv3.patch" Content-length: 5749 diff --git a/binutils/testsuite/binutils-all/aarch64/aarch64.exp b/binutils= /testsuite/binutils-all/aarch64/aarch64.exp new file mode 100644 index 0000000..e189711 --- /dev/null +++ b/binutils/testsuite/binutils-all/aarch64/aarch64.exp @@ -0,0 +1,30 @@ +# Copyright (C) 2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-130= 1, USA. + +if {![istarget "aarch64*-*-*"] + || ![is_elf_format]} then { + return +} + +set tempfile tmpdir/aarch64temp.o +set copyfile tmpdir/aarch64copy + +set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach t $test_list { + # We need to strip the ".d", but can leave the dirname. + verbose [file rootname $t] + run_dump_test [file rootname $t] +} diff --git a/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.d= b/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.d new file mode 100644 index 0000000..64063e2 --- /dev/null +++ b/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.d @@ -0,0 +1,29 @@ +#PROG: objcopy +#objdump: -dr +#name: Disassembler detects unallocated instruction encodings. + +.*: +file format .*aarch64.* + +Disassembly of section \.text: + +0000000000000000 <.*>: + 0: 0d0047de .inst 0x0d0047de ; undefined + 4: 0d2047dd .inst 0x0d2047dd ; undefined + 8: 0d0067dc .inst 0x0d0067dc ; undefined + c: 0d2067db .inst 0x0d2067db ; undefined + 10: 0d008bde .inst 0x0d008bde ; undefined + 14: 0d208bdd .inst 0x0d208bdd ; undefined + 18: 0d00abdc .inst 0x0d00abdc ; undefined + 1c: 0d20abdb .inst 0x0d20abdb ; undefined + 20: 0d008fde .inst 0x0d008fde ; undefined + 24: 0d208fdd .inst 0x0d208fdd ; undefined + 28: 0d00afdc .inst 0x0d00afdc ; undefined + 2c: 0d20afdb .inst 0x0d20afdb ; undefined + 30: 0d0097de .inst 0x0d0097de ; undefined + 34: 0d2097dd .inst 0x0d2097dd ; undefined + 38: 0d00b7dc .inst 0x0d00b7dc ; undefined + 3c: 0d20b7db .inst 0x0d20b7db ; undefined + 40: 0d009fde .inst 0x0d009fde ; undefined + 44: 0d209fdd .inst 0x0d209fdd ; undefined + 48: 0d00bfdc .inst 0x0d00bfdc ; undefined + 4c: 0d20bfdb .inst 0x0d20bfdb ; undefined diff --git a/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.s= b/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.s new file mode 100644 index 0000000..fb96adc --- /dev/null +++ b/binutils/testsuite/binutils-all/aarch64/unallocated-encoding.s @@ -0,0 +1,51 @@ + .text +func: + //scale 1, size<0> check for H. + #st1 {v30.h}[0], [x30] + .inst 0x0d0043de | (1 << 10) + #st2 {v29.h, v30.h}[0], [x30] + .inst 0x0d2043dd | (1 << 10) + #st3 {v28.h, v29.h, v30.h}[0], [x30] + .inst 0x0d0063dc | (1 << 10) + #st4 {v27.h, v28.h, v29.h, v30.h}[0], [x30] + .inst 0x0d2063db | (1 << 10) + + //scale 2, size<1> check for S. + #st1 {v30.s}[0], [x30] + .inst 0x0d0083de | (1 << 11) + #st2 {v29.s, v30.s}[0], [x30] + .inst 0x0d2083dd | (1 << 11) + #st3 {v28.s, v29.s, v30.s}[0], [x30] + .inst 0x0d00a3dc | (1 << 11) + #st4 {v27.s, v28.s, v29.s, v30.s}[0], [x30] + .inst 0x0d20a3db | (1 << 11) + + //scale 2, size<1> check for D. + #st1 {v30.d}[0], [x30] + .inst 0x0d0087de | (1 << 11) + #st2 {v29.d, v30.d}[0], [x30] + .inst 0x0d2087dd | (1 << 11) + #st3 {v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d00a7dc | (1 << 11) + #st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d20a7db | (1 << 11) + + //scale 2, S-bit check for D. + #st1 {v30.d}[0], [x30] + .inst 0x0d0087de | (2 << 11) + #st2 {v29.d, v30.d}[0], [x30] + .inst 0x0d2087dd | (2 << 11) + #st3 {v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d00a7dc | (2 << 11) + #st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d20a7db | (2 << 11) + + //scale 2, size<1> & S-bit check for D. + #st1 {v30.d}[0], [x30] + .inst 0x0d0087de | (3 << 11) + #st2 {v29.d, v30.d}[0], [x30] + .inst 0x0d2087dd | (3 << 11) + #st3 {v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d00a7dc | (3 << 11) + #st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30] + .inst 0x0d20a7db | (3 << 11) diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c index 477edb6..c3670fe 100644 --- a/opcodes/aarch64-dis.c +++ b/opcodes/aarch64-dis.c @@ -422,11 +422,17 @@ aarch64_ext_ldst_elemlist (const aarch64_operand *sel= f ATTRIBUTE_UNUSED, info->reglist.index =3D QSsize; break; case 0x1: + if (QSsize & 0x1) + /* UND. */ + return 0; info->qualifier =3D AARCH64_OPND_QLF_S_H; /* Index encoded in "Q:S:size<1>". */ info->reglist.index =3D QSsize >> 1; break; case 0x2: + if ((QSsize >> 1) & 0x1) + /* UND. */ + return 0; if ((QSsize & 0x1) =3D=3D 0) { info->qualifier =3D AARCH64_OPND_QLF_S_S; @@ -435,12 +441,12 @@ aarch64_ext_ldst_elemlist (const aarch64_operand *sel= f ATTRIBUTE_UNUSED, } else { - info->qualifier =3D AARCH64_OPND_QLF_S_D; - /* Index encoded in "Q". */ - info->reglist.index =3D QSsize >> 3; if (extract_field (FLD_S, code, 0)) /* UND */ return 0; + info->qualifier =3D AARCH64_OPND_QLF_S_D; + /* Index encoded in "Q". */ + info->reglist.index =3D QSsize >> 3; } break; default:= --------------030004070704040304010800--