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: 1195007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513447-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OgfakArf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rrEYksVe"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47DTMV6p9Sz9s7T for ; Fri, 15 Nov 2019 04:42:30 +1100 (AEDT) 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=DhsTSgvKSqFbXHPzmLHOLmpnzLnGrRZcmGvDpHFd2sRQUszMhE kHmj5lOoTxJkgnZTiS1/dYYE9wMwnAsnZAhIshNMY9RsGR0rZBtagBlzIsPYruTE 8GFi60HpwnqBHBu9oJzzFamoXjVrQRlL/GXaEn5X8fvth3r+lHGxwmATc= 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=OgfakArfVg+HMWie6BJZ /oB1Olt2v7DzRM+1LZQ7UxxlhWJp9OxCbkH11GFRx8G5ODtYL8YW8g3E7YX3QSyV 2I9u6+UGmT0Xn8jIFbj1ETXMp6s5rr+yVhtlXZMP4OuiqhhhRy0JHS+oI2eo0GXc wnuQQd2n9/WUcVhg47NCzj8= 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== 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) {