From nobody Fri Nov 7 12:30:11 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153909749555641.0535235237395; Tue, 9 Oct 2018 08:04:55 -0700 (PDT) Received: from localhost ([::1]:52292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9tZ8-0002Qj-0V for importer@patchew.org; Tue, 09 Oct 2018 11:04:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9tUK-0007Qr-Mt for qemu-devel@nongnu.org; Tue, 09 Oct 2018 11:00:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9tU2-0006OG-85 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 10:59:54 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:35799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g9tU1-0006Mq-Ql for qemu-devel@nongnu.org; Tue, 09 Oct 2018 10:59:38 -0400 Received: by mail-wm1-x332.google.com with SMTP id e187-v6so2374382wmf.0 for ; Tue, 09 Oct 2018 07:59:37 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 20-v6sm18601165wml.10.2018.10.09.07.59.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Oct 2018 07:59:34 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1E8553E04CC; Tue, 9 Oct 2018 15:59:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MGls24ijn1HMK3OugvqQdnCxYboPq21KAfwEyERKbLQ=; b=QRm5lITlDeTgzN2qSNNskGaYhvMPRXXE8Kgkf3MyL/EdttGRSUoKPDUtkX9Et5Hha1 1J1QdO7VIwJDCfkz7bgjKY7iQNALRPuYchUam+BGwgGGPyv4nYS839Dl91bImrv1va0o I9ECkwwEkcIB0Y9vI46ofbf3jKELH5QNB5tFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MGls24ijn1HMK3OugvqQdnCxYboPq21KAfwEyERKbLQ=; b=Fz7vGMxiulIDG2pDEykPZB8dxs53iaWvPFqJ0l5MFsb21QdxRRyRcDxP9XjQmmrqfo UwZLYk8wgUQqE1l6w/eo+XKHPI5VjqXpqOR+7CQTCYf0VFT89l2BxU2ZEXYu+cr53XGl slQrcQud3fdxUvuxRtB19kBA1dDkr+VJc6oH/yQvfLsS0YU6EHeS/bjLCJUmN4gU0Mkj 2BbxMz4pG8MijjZT5t0FznOFzvetYzTRzcuH7em7BjIxOSIIOXJ/A6FNNz7VExZy3YHp p3bc66oP7fxggUdO7ciC4XO5AV4qiMXqoxSlhVbb1/zjS96Meqk6sk5QGUsas783o5ge U+AA== X-Gm-Message-State: ABuFfohf3f/N3FzNJxMLR4qtu9axQDMTqoO6DnLpiGDPFT94UYxeT4gr MSLNF9D0ndy2s3NtBl2b9yu90Q== X-Google-Smtp-Source: ACcGV61DanhlkO9cPB0yc45vJXu0KWVnAvph53weAnF2CsmR3LYuso9Jzxfo3QCWA7d5JV3HveM5eg== X-Received: by 2002:a1c:af07:: with SMTP id y7-v6mr2352586wme.33.1539097176241; Tue, 09 Oct 2018 07:59:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 15:59:32 +0100 Message-Id: <20181009145933.18925-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009145933.18925-1-alex.bennee@linaro.org> References: <20181009145933.18925-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PATCH v2 2/3] tests/tcg: make test-i386 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: , Cc: famz@redhat.com, Eduardo Habkost , f4bug@amsat.org, Theodore Dubois , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 From: Theodore Dubois 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. https://bugs.llvm.org/show_bug.cgi?id=3D33741 - 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 [AJB: tweaked title, add bugref] Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/i386/test-i386.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/tcg/i386/test-i386.c b/tests/tcg/i386/test-i386.c index a29b41e764..c5f67000e4 100644 --- a/tests/tcg/i386/test-i386.c +++ b/tests/tcg/i386/test-i386.c @@ -368,7 +368,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) {\ @@ -490,15 +490,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 @@ -866,7 +874,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)); @@ -1317,12 +1325,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))); @@ -1763,7 +1771,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.17.1