From patchwork Thu Nov 14 17:42:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 179455 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp10954076ocf; Thu, 14 Nov 2019 09:42:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyjkTuSLc68bI4SIcuF5wN+lg0tvZmtkUxEP2DsvBi7ORStCauZ2AjbGTkMZDh9shy9RS9w X-Received: by 2002:aa7:c942:: with SMTP id h2mr2806965edt.238.1573753356672; Thu, 14 Nov 2019 09:42:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573753356; cv=none; d=google.com; s=arc-20160816; b=0P+sOhm8UShF05zHMUrjk/M0X74716/+hfF1YaxyZhMy89/TqETAQU2bhMeqGO5w4/ NSX/Do/w/ZvVUfuVtQOgBaghVXk6XEj8QhJXlVk3NthTalG9Cy39v0Zl/czDj655YqGz RAr+aBlCDHtFpSLF+neXyKZO9LjuhGOCIepZ/2NCdTgD8VguOKporKOEWrrJz+HpONl+ 7n5R5pICqqlfhJJL8dSoLvc6hHEZIdCdsW2obYGNNYNFt+tfnY0UfjAbUmPEgY8yOseZ 5VwqXRaaQCstDDpWhn8J1vU2SrKIf54VzQBnJPFPlYgprOHEQmXMMFTzU5VwQ8dpT18U PMwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:date:message-id:openpgp:subject:from:cc:to :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=oXVNEMjfhvQkQK9Vbu88v+Xg++cXkufgKyfYzhQdY+U=; b=MJjFWzZUbLrOIowPOCuixYSKSojCjE53USU8Fzzy7gLy74fnD/x0kcu6yW4QlU1xoS F/k8wcyq2CwqWk6IPYTuG40CFmHmcBVeoftq1ItqD9W4+O/su/0geWQbiZppbf9LGeDc Mx4Sz+r0ZNdb5/g3/43pzPz+KRl+SJIhajLkvXu/qV7ytaIEn1y+/ry1E7zp+5CoWpz3 3MkGrdbh2mC+txaAA4dg3XDYGU8syMbZT1DlNN76S5hufbWZJHV+zoOgKzuuyKJFf4dO 7ti1nEOANsW89pfv/BhS08ZkvTKdRoOAW8kQ0WbdeLVXf/fnS0kg6h+OKr3Zyf425loK w1AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KAY+3pUJ; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=rrEYksVe; spf=pass (google.com: domain of gcc-patches-return-513447-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-513447-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id c29si4516169ede.50.2019.11.14.09.42.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 09:42:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-513447-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KAY+3pUJ; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=rrEYksVe; spf=pass (google.com: domain of gcc-patches-return-513447-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-513447-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=LaPWCEzSR0Os1uxA7gU2MMIGYkRfDGAtFuiLAG1oJLEsFp+5E9 Vvb8hbd0Ogf8jmkjN3c4oBkLIn0E2MifTEsTg5Ewgee9NuDlOVGd0rRGsnE++VxF ZYPb8Jm3kuzWufrGdSNJlzWQhRJMiMotOV4xn8TOV3Y/1U5/VJ7K2dMW4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=qdpEHCBTevGES3c5aFbkAZPV85Q=; b=KAY+3pUJSce7vuUNes0G TUvFVLlRemZNrN82BnSBqYnzscdkZ1mwlwRDtjsgI1qWeyuY5f5yEE6f+UFu8DcI Yp/MI/4tYePFBY9b0F91O+7ZLfppEGR41PaJS1loJpN8pFGzSBRmGAyyjXdtYNu0 1ptBKxjZM2/c7yrvKo0TvNc= Received: (qmail 43172 invoked by alias); 14 Nov 2019 17:42:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 43161 invoked by uid 89); 14 Nov 2019 17:42:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=1229 X-HELO: mail-wm1-f49.google.com Received: from mail-wm1-f49.google.com (HELO mail-wm1-f49.google.com) (209.85.128.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Nov 2019 17:42:21 +0000 Received: by mail-wm1-f49.google.com with SMTP id j18so8025842wmk.1 for ; Thu, 14 Nov 2019 09:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:cc:from:subject:openpgp:autocrypt:message-id:date:user-agent :mime-version:content-language; bh=tkNx0CZo7sWS1eO9HplEsGvcVrnsbI0cRfFu2/Y/us4=; b=rrEYksVetpuIuHK9JmSk5TfHLglXHGxJnY1nYSCMm1r6zw5Qmd0xqDbVONHv3ME4iO V7dIP1KQ/hEZHjOQnPj27XmAO9Ic6FpFnQ3L55gvn7DJhomfLaGSGU3j2a9ImrBSFLZ2 qDE/u+DlVMrQRvMW1DdxUosE4uwBYirff4XPOKBGzoP3LjdGal525nxr+CSMSZDLEdKV 5V6GRnfIMMr8U4i2uaEANlv2XeQtD0Rhkiz1MLCKB+EeLAZ8a+IkAH58KyMuRr2PQ/ms rL6mWwsz5iRlbP5GYx49zPC37AxC7hKCASNaOc4gq2B/lpR5erNhdvJx8FxPsmQrvXKu 4Khw== Return-Path: Received: from [192.168.8.102] (184.red-37-158-56.dynamicip.rima-tde.net. [37.158.56.184]) by smtp.gmail.com with ESMTPSA id r2sm7904556wrp.64.2019.11.14.09.42.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 09:42:17 -0800 (PST) To: Richard Earnshaw Cc: gcc-patches@gcc.gnu.org From: Richard Henderson Subject: [arm] Follow up for asm-flags vs thumb1 Openpgp: preference=signencrypt Message-ID: <18352f16-98fa-2e07-1274-473253a7217d@linaro.org> Date: Thu, 14 Nov 2019 18:42:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 What I committed today does in fact ICE for thumb1, as you suspected. I'm currently testing the following vs arm-sim/ arm-sim/-mthumb arm-sim/-mcpu=cortex-a15/-mthumb. which, with the default cpu for arm-elf-eabi, should test all of arm, thumb1, thumb2. I'm not thrilled about the ifdef in aarch-common.c, but I don't see a different way to catch this case for arm and still compile for aarch64. Ideas? Particularly ones that work with __attribute__((target("thumb")))? Which, now that I've thought about it I really should be testing... r~ gcc/ * config/arm/aarch-common.c (arm_md_asm_adjust): Sorry for asm flags in thumb1 mode. * config/arm/arm-c.c (arm_cpu_builtins): Do not define __GCC_ASM_FLAG_OUTPUTS__ in thumb1 mode. * doc/extend.texi (FlagOutputOperands): Document thumb1 restriction. gcc/testsuite/ * gcc.target/arm/asm-flag-1.c: Skip if arm_thumb1. * gcc.target/arm/asm-flag-3.c: Skip if arm_thumb1. * gcc.target/arm/asm-flag-5.c: Skip if arm_thumb1. * gcc.target/arm/asm-flag-6.c: Skip if arm_thumb1. diff --git a/gcc/config/arm/aarch-common.c b/gcc/config/arm/aarch-common.c index 760ef6c9c0a..6f3db3838ba 100644 --- a/gcc/config/arm/aarch-common.c +++ b/gcc/config/arm/aarch-common.c @@ -544,6 +544,15 @@ arm_md_asm_adjust (vec &outputs, vec &/*inputs*/, if (strncmp (con, "=@cc", 4) != 0) continue; con += 4; + +#ifdef TARGET_THUMB1 + if (TARGET_THUMB1) + { + sorry ("asm flags not supported in thumb1 mode"); + break; + } +#endif + if (strchr (con, ',') != NULL) { error ("alternatives not allowed in % flag output"); diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index c4485ce7af1..865c448d531 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -122,7 +122,9 @@ arm_cpu_builtins (struct cpp_reader* pfile) if (arm_arch_notm) builtin_define ("__ARM_ARCH_ISA_ARM"); builtin_define ("__APCS_32__"); - builtin_define ("__GCC_ASM_FLAG_OUTPUTS__"); + + if (!TARGET_THUMB1) + builtin_define ("__GCC_ASM_FLAG_OUTPUTS__"); def_or_undef_macro (pfile, "__thumb__", TARGET_THUMB); def_or_undef_macro (pfile, "__thumb2__", TARGET_THUMB2); diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 1c8ae0d5cd3..62a98e939c8 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9810,6 +9810,8 @@ signed greater than signed less than equal @end table +The flag output constraints are not supported in thumb1 mode. + @item x86 family The flag output constraints for the x86 family are of the form @samp{=@@cc@var{cond}} where @var{cond} is one of the standard diff --git a/gcc/testsuite/gcc.target/arm/asm-flag-1.c b/gcc/testsuite/gcc.target/arm/asm-flag-1.c index 9707ebfcebb..97104d3ac73 100644 --- a/gcc/testsuite/gcc.target/arm/asm-flag-1.c +++ b/gcc/testsuite/gcc.target/arm/asm-flag-1.c @@ -1,6 +1,7 @@ /* Test the valid @cc asm flag outputs. */ /* { dg-do compile } */ /* { dg-options "-O" } */ +/* { dg-skip-if "" { arm_thumb1 } } */ #ifndef __GCC_ASM_FLAG_OUTPUTS__ #error "missing preprocessor define" diff --git a/gcc/testsuite/gcc.target/arm/asm-flag-3.c b/gcc/testsuite/gcc.target/arm/asm-flag-3.c index e84e3431277..e2d616051cc 100644 --- a/gcc/testsuite/gcc.target/arm/asm-flag-3.c +++ b/gcc/testsuite/gcc.target/arm/asm-flag-3.c @@ -1,6 +1,7 @@ /* Test some of the valid @cc asm flag outputs. */ /* { dg-do compile } */ /* { dg-options "-O" } */ +/* { dg-skip-if "" { arm_thumb1 } } */ #define DO(C) \ void f##C(void) { char x; asm("" : "=@cc"#C(x)); if (!x) asm(""); asm(""); } diff --git a/gcc/testsuite/gcc.target/arm/asm-flag-5.c b/gcc/testsuite/gcc.target/arm/asm-flag-5.c index 4d4394e1478..9a8ff586c29 100644 --- a/gcc/testsuite/gcc.target/arm/asm-flag-5.c +++ b/gcc/testsuite/gcc.target/arm/asm-flag-5.c @@ -1,6 +1,7 @@ /* Test error conditions of asm flag outputs. */ /* { dg-do compile } */ /* { dg-options "" } */ +/* { dg-skip-if "" { arm_thumb1 } } */ void f_B(void) { _Bool x; asm("" : "=@cccc"(x)); } void f_c(void) { char x; asm("" : "=@cccc"(x)); } diff --git a/gcc/testsuite/gcc.target/arm/asm-flag-6.c b/gcc/testsuite/gcc.target/arm/asm-flag-6.c index 09174e04ae6..d862db4e106 100644 --- a/gcc/testsuite/gcc.target/arm/asm-flag-6.c +++ b/gcc/testsuite/gcc.target/arm/asm-flag-6.c @@ -1,5 +1,6 @@ /* Executable testcase for 'output flags.' */ /* { dg-do run } */ +/* { dg-skip-if "" { arm_thumb1 } } */ int test_bits (long nzcv) {