From nobody Wed Nov 5 06:40:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499720304655311.8063377512992; Mon, 10 Jul 2017 13:58:24 -0700 (PDT) Received: from localhost ([::1]:43027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUfl9-0008JG-FS for importer@patchew.org; Mon, 10 Jul 2017 16:58:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUfkD-0007uf-75 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 16:57:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUfkA-0000QQ-3E for qemu-devel@nongnu.org; Mon, 10 Jul 2017 16:57:25 -0400 Received: from st13p21im-asmtp003.me.com ([17.164.152.25]:64874) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUfk9-0000Q0-U0 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 16:57:22 -0400 Received: from process-dkim-sign-daemon.st13p21im-asmtp003.me.com by st13p21im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OSW0100076FTB00@st13p21im-asmtp003.me.com> for qemu-devel@nongnu.org; Mon, 10 Jul 2017 20:57:19 +0000 (GMT) Received: from icloud.com ([127.0.0.1]) by st13p21im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OSW00RJS7JGGY30@st13p21im-asmtp003.me.com> for qemu-devel@nongnu.org; Mon, 10 Jul 2017 20:57:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=04042017; t=1499720239; bh=wxVdV/4TR0N9qmrqvjaK9yxMyhoxUqMTmBMSB7IjIkk=; h=From:Content-type:MIME-version:Subject:Message-id:Date:To; b=Lcnu6/Mkuna+XJWx1avf0ma7GdmXq0M6HASBa7It2UplaLXGK6m0Cc1CrGndENqOD m/nN28qd/Jm0NbytoC4jh27r8HAVcyf+ZQs4Wm+aRpb/pEk/u95wiM42d6+3pT/Q99 AHW5oAU8yHnbS1MrlGvG4FLVkr27FyMXX5wj319XyG14sykQCknFJHUSnOmYj1QmEh by0DRKdFInJtfT7/E2l8l45nkV5jQ8BaqXPq49UZx6+m99JGAnkdmVR9jh59QIuR1e CoFuOhonEr5hDHdtXs292rwBaJ+IRwVkXkntgOvponpKL3gZE9OU56KCOW7vASeR/f a+IGGAzTGG/zQ== X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-10_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1707100363 From: Theodore Dubois Content-transfer-encoding: quoted-printable MIME-version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Message-id: Date: Mon, 10 Jul 2017 13:57:12 -0700 To: qemu-devel@nongnu.org X-Mailer: Apple Mail (2.3273) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 17.164.152.25 Subject: [Qemu-devel] [PATCH] test-i386: Make x86 test program compile on clang X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Clang's assembler is slightly incompatible with GCC's assembler, which caused the program to not compile on Clang for these reasons: - The "q" constraint was specified for an argument to the set instruction, which didn't work because Clang chose the esi register, which has no 8-bit form on i386. - Clang doesn't support size suffixes on the loop instructions. - Clang requires a size suffix on the fist instruction. - Clang doesn't support specifying segment prefixes before the instruction, and requires specifying them on the address. - The arguments to the bound instruction are in the wrong order on Clang. https://bugs.llvm.org/show_bug.cgi?id=3D27653 Signed-off-by: Theodore Dubois --- tests/tcg/test-i386.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/tcg/test-i386.c b/tests/tcg/test-i386.c index 0f7b943b0c..dcb8e4876e 100644 --- a/tests/tcg/test-i386.c +++ b/tests/tcg/test-i386.c @@ -369,7 +369,7 @@ void test_lea(void) asm("movl $0, %0\n\t"\ "cmpl %2, %1\n\t"\ "set" JCC " %b0\n\t"\ - : "=3Dr" (res)\ + : "=3Dq" (res)\ : "r" (v1), "r" (v2));\ printf("%-10s %d\n", "set" JCC, res);\ if (TEST_CMOV) {\ @@ -491,15 +491,23 @@ void test_loop(void) =20 #if !defined(__x86_64__) TEST_LOOP("jcxz"); +#if !defined(__clang__) TEST_LOOP("loopw"); TEST_LOOP("loopzw"); TEST_LOOP("loopnzw"); #endif +#endif =20 TEST_LOOP("jecxz"); +#if !defined(__clang__) TEST_LOOP("loopl"); TEST_LOOP("loopzl"); TEST_LOOP("loopnzl"); +#else + TEST_LOOP("loop"); + TEST_LOOP("loopz"); + TEST_LOOP("loopnz"); +#endif } =20 #undef CC_MASK @@ -867,7 +875,7 @@ void test_fcvt(double a) uint16_t val16; val16 =3D (fpuc & ~0x0c00) | (i << 10); asm volatile ("fldcw %0" : : "m" (val16)); - asm volatile ("fist %0" : "=3Dm" (wa) : "t" (a)); + asm volatile ("fists %0" : "=3Dm" (wa) : "t" (a)); asm volatile ("fistl %0" : "=3Dm" (ia) : "t" (a)); asm volatile ("fistpll %0" : "=3Dm" (lla) : "t" (a) : "st"); asm volatile ("frndint ; fstl %0" : "=3Dm" (ra) : "t" (a)); @@ -1318,12 +1326,12 @@ void test_segs(void) seg_data1[1] =3D 0xaa; seg_data2[1] =3D 0x55; =20 - asm volatile ("fs movzbl 0x1, %0" : "=3Dr" (res)); + asm volatile ("movzbl %%fs:0x1, %0" : "=3Dr" (res)); printf("FS[1] =3D %02x\n", res); =20 asm volatile ("pushl %%gs\n" "movl %1, %%gs\n" - "gs movzbl 0x1, %0\n" + "movzbl %%gs:0x1, %0\n" "popl %%gs\n" : "=3Dr" (res) : "r" (MK_SEL(2))); @@ -1764,7 +1772,11 @@ void test_exceptions(void) /* bound exception */ tab[0] =3D 1; tab[1] =3D 10; +#if defined(__clang__) + asm volatile ("bound %1, %0" : : "r" (11), "m" (tab[0])); +#else asm volatile ("bound %0, %1" : : "r" (11), "m" (tab[0])); +#endif } #endif =20 --=20 2.13.2 ~Theodore