From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 9DAC83858D20; Wed, 9 Nov 2022 19:02:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9DAC83858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x530.google.com with SMTP id i21so28492060edj.10; Wed, 09 Nov 2022 11:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zC8l1lmXQ3uqqz2YdeXRwc1tz9T5a8iLRPcRBWEicfI=; b=mjdIA8JXf63I05p6HuiWn71BaCLdNR/1J1gjL8Wzfv+93Bt/4QeiJCUWV0IfEoUCMT O7wj39rMXT7Tq9Ry3JzuYFW+h6uG8Bv/7mZyPl7jOGeBzQp+hKuL1Q64WN1FqHBsaNm7 0QSW8fISHBCWk6hm9GyDSj9GQPxzWvGga2qA8ym/O133fF3lDPyCwUg2Tg11UcEZd8nL MiBIdyAgeXrCg81zudYc4OZbY+myk8gbsPM3597C8xgcMxjlp7nvNSdyz55krKtX6k6G 2OgJIQdYHIuM2mIQWqBNnOoyF6pna5LRfPi30wqhBqYp3DessgXBsUvqIJnalDc/qyYG fbUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zC8l1lmXQ3uqqz2YdeXRwc1tz9T5a8iLRPcRBWEicfI=; b=QPfgRQ4o9J19HfUMX+VvgA0khYJuPO6VoHC+m5+nGYktVN4WV9pCUpzBL4FvPhIQUc SR9mYFUE1I81Mfco1aGNZV9hHVrgGj7t0o7FKI3PY43JEDx73rShA4Jn/lNpQosNEwru jrwWDyTysA6ER/YBBI7p3CEistcpdBRBbGM0L3YX4AvLspFFRsYdm0QwS0ojRoXsyiiN QAId/eI4apxdbZPtazjwSa9r8rAht1Oe+jMLCNZ18yCV35HpxKyGnpt/FNIM6olFKtbt tGvGRzNJV8Edx3Go0P9Phub+aRUTUixZiAXIXCs79XxDsyQkVSgjCJQJaHsu994QDQku nPCA== X-Gm-Message-State: ACrzQf1TG5sNegOe5iOG0U7BSGlXE/Cpje/7dhmxuo9E6H7Dsyjebd0i UQkbNA+xW3q/HZQyPX04CsY= X-Google-Smtp-Source: AMsMyM40+T2wmwWixv8cBQXE5DfBIEP90WNztLknLc8tYmhq0Uh837XlrRWq66y8dLxN9yqPUX5+sA== X-Received: by 2002:a05:6402:5253:b0:461:e870:8507 with SMTP id t19-20020a056402525300b00461e8708507mr60743324edd.323.1668020558172; Wed, 09 Nov 2022 11:02:38 -0800 (PST) Received: from nbbrfq (80-110-214-113.static.upcbusiness.at. [80.110.214.113]) by smtp.gmail.com with ESMTPSA id lb25-20020a170907785900b00780f6071b5dsm6149256ejc.188.2022.11.09.11.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:02:37 -0800 (PST) From: Bernhard Reutner-Fischer X-Google-Original-From: Bernhard Reutner-Fischer Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1osqLM-000OzI-1w; Wed, 09 Nov 2022 20:02:36 +0100 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer , Bernhard Reutner-Fischer , gfortran ML Subject: [PATCH 0/2] Fortran: add attribute target_clones Date: Wed, 9 Nov 2022 20:02:23 +0100 Message-Id: <20221109190225.96037-1-aldot@gcc.gnu.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! These two patches add support for attribute target_clones to the fortran frontend. 1) The symtab hunk is identical to the one sent in https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605081.html which had some additional information. I only tested it on x86_64-unknown-linux and for languages c,fortran,c++,lto so far, i.e. not for ada,go,d,modula2 2) fortran FE hunks I'm aware that the documentation will have to be rewritten now for Sphinx. I'll will take care of that before pushing the change anyway, of course. The fortran FE part works as intended. Note that it is of course not possible to mix ISA features of different target architectures, i.e. "sse","avx512f" is fine, "powerpc7" in the same attribute is prohibited. There is a gotcha that took me a while to (re-)notice when writing the testcase though: We (the fortran FE, fortran/cpp.cc) do not define arch defines. Consider: $ echo -e "#ifndef __x86_64__\nbummer\n#endif\nend" > /tmp/ouch.F95 $ ./gfortran -B. -c -o /tmp/ouch.o /tmp/ouch.F95 /tmp/ouch.F95:2:1: 2 | bummer | 1 Error: Unclassifiable statement at (1) $ echo -e "#ifndef __x86_64__\nbummer\n#endif" \ | ./xgcc -B. -x f95-cpp-input -ffree-form -E -dD - | grep -i x86 $ # nothing versus $ echo -e "#ifndef __x86_64__\nbummer\n#endif" \ | ./xgcc -B. -x assembler-with-cpp -E -dD - | grep -i x86 #define __x86_64 1 #define __x86_64__ 1 I'm sure we have existing PRs about those missing defines but i didn't look yet. Bernhard Reutner-Fischer (2): symtab: also change RTL decl name Fortran: add attribute target_clones gcc/fortran/decl.cc | 104 ++++++++++++++++++ gcc/fortran/f95-lang.cc | 4 + gcc/fortran/gfortran.h | 2 + gcc/fortran/gfortran.texi | 31 ++++++ gcc/fortran/trans-decl.cc | 3 + gcc/symtab.cc | 6 +- .../gfortran.dg/attr_target_clones-1.F90 | 30 +++++ 7 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/attr_target_clones-1.F90 -- 2.38.1