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 7B9F63858C56 for ; Fri, 4 Nov 2022 20:59:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7B9F63858C56 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 u24so9303447edd.13 for ; Fri, 04 Nov 2022 13:59:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=0/yRtH8BVaQQd6FpDDrROrZZNHlp6epAyXGsJaMP93M=; b=hYS0WI77EjPE9ykg3pkMHKodCpwuqLOHYP+LFvoT/ayBMnC9HXQTEA6mD5OdRA0qpz f4Ej+TCg7zQDvwyr9T+ZO2xMlZvq7hQPMuaQxxUy54nTgJ9eAzkovtx3d3ZBoJZdTyPj RviIYp3A5eWnmO3nDzzO730jsL6ySzezQOH6WUJOL5vDny49sDThzkBap2QzbfWk5PNT yIQ9gEXuJZm8hgOrz+kveexAO5gvBosZglu1MSNr5rpuUXZ625cdGLmMvgzGhx3hhOG/ /mN7hZhYka7qRxXFCwf5fG/AFzlqHsdZgzUww5C5SE2HCgn6hEZEE3snwllFxZ0fzsBB Vvmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0/yRtH8BVaQQd6FpDDrROrZZNHlp6epAyXGsJaMP93M=; b=1vK26Hp9mlzfbiuNGbgd8UL85nB8sqXYuJtCQYIj9sLWfB/eJDq0Ad4MSYuRuCDLK6 Is8uuha9bfbag+aq3FclmY8AO/ym+sECEBAINJ34uO2G1+xKed1ksDhOVKD3XY/S8mbs eOFrHZvMZy4EAl8jxKNXrO4y0rVC3KVP05wONKjMwobFYCEMZyhM4LphhVvzacJNyY8h 5adKUkMuwmv5we93tTMK7Zj+DOfBNp2+WaXwNH0hIxEDOqmQKyN72uzwQcyYFYvk8IRW 7Yj5I78/CHZhrzQP7UY4wKXUMugUXNXSuivtxrSXUzBfaACgeGFEmMzCKUiMzWwFGQ8q dzgw== X-Gm-Message-State: ACrzQf2himJne4XSyVTZcnl1cE5IOctzqjaVYb1Cl7gsCYnSMBV6r5qI fqVd3QzJMcImOxQE2UKRVEI= X-Google-Smtp-Source: AMsMyM65Bs/e1j7+TTt0zxD5a8Pm6H4XR7AcRyooLduYPnz8xY33+bRqzjVQUcdXwqSpA6G36O6bNA== X-Received: by 2002:a05:6402:3641:b0:45c:4231:ddcc with SMTP id em1-20020a056402364100b0045c4231ddccmr38349833edb.224.1667595567019; Fri, 04 Nov 2022 13:59:27 -0700 (PDT) Received: from nbbrfq ([2001:871:227:81c4:d7ff:3a0e:48da:5fe3]) by smtp.gmail.com with ESMTPSA id y20-20020a170906559400b007ad69e9d34dsm24418ejp.54.2022.11.04.13.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 13:59:26 -0700 (PDT) Date: Fri, 4 Nov 2022 21:59:21 +0100 From: Bernhard Reutner-Fischer To: Dave Love via Fortran Cc: rep.dot.nop@gmail.com, Dave Love Subject: Re: adding attributes Message-ID: <20221104215921.79be6bff@nbbrfq> In-Reply-To: <20221103001926.725fd9bf@nbbrfq> References: <87pmecdni6.fsf@manchester.ac.uk> <20221030084839.118ef0c8@nbbrfq> <87edund73d.fsf@manchester.ac.uk> <20221103001926.725fd9bf@nbbrfq> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 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: On Thu, 3 Nov 2022 00:19:26 +0100 Bernhard Reutner-Fischer wrote: > So target_clones is one thing. What other attributes would be important? > > doing something previously! (I don't know if I'll actually be able to > > work on it in the end, at least on work time.) > > heh, me neither. Luckily yesterday was a holiday, so what i ended up > with was the following, fya. > Consider: $ cat gcc/testsuite/gfortran.dg/attr_target_clones-1.F90; echo EOF ! { dg-require-ifunc "" } ! { dg-options "-O1" } ! { dg-additional-options "-fdump-tree-optimized" } ! It seems arch defines are not defined?! ! See fortran.cpp FIXME: Pandora's Box ! Ok, so enterprise-level bugfix: ! { dg-additional-options "-D__i386__=1" { target { i?86-*-* x86_64-*-* } } } ! { dg-additional-options "-D__powerpc__=1" { target { powerpc*-*-* } } } ! { dg-skip-if "test not yet implemented for target" { ! {i?86-*-* x86_64-*-* powerpc*-*-*} } } !! { dg- skip-if "needs optimize" { *-*-* } { "*" } { " -O0 " } } ! Test __attribute__ ((target_clones ("foo", "bar"))) ! module m implicit none contains subroutine sub1() #if defined __i386__ || defined __x86_64__ !GCC$ ATTRIBUTES target_clones("avx", "sse","default") :: sub1 #elif defined __powerpc__ !GCC$ ATTRIBUTES target_clones("power10", "power9","default") :: sub1 #endif print *, 4321 end end module m ! { dg-final { scan-tree-dump-times {(?n)void \* __m_MOD_sub1\.resolver \(\)} 1 "optimized" } } ! { dg-final { scan-tree-dump-times {(?n)void __m_MOD_sub1\.(?:avx|power10) \(\)} 1 "optimized" } } ! { dg-final { scan-tree-dump-times {(?n)void __m_MOD_sub1\.(?:sse|power9) \(\)} 1 "optimized" } } ! { dg-final { scan-tree-dump-times {(?n)void sub1 \(\)} 1 "optimized" } } !! and a non-assembly hint on the ifunc ! { dg-final { scan-tree-dump-times {Function sub1 \(__m_MOD_sub1\.default,} 1 "optimized" } } EOF 2 patches: https://gcc.gnu.org/pipermail/gcc-patches/2022-November/605081.html https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604981.html (the testcase mentioned in the latter is superseded be the blurb above) One would have to cleanup the parser (see "XXX: Rephrase this in a sane, understandable manner..") and add some more testcases, for several malformed attribute strings. Maybe i'll get to it during the weekend or some evening. Not sure about the usefulness though. And not sure if fellow gfortraners would accept this attribute target_clones in there in the first place.. cheers,