From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id F387E3858C52 for ; Thu, 1 Dec 2022 14:16:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F387E3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669904188; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=VTfBz6ZVGgWB8hCG+U7nBn5TUMkzM+Lc0PfDm9NjW2E=; b=Tm25RDcoVUGcAS9R//GnJ/cRM+eDu/B3zHqXF3SHfprUy+G6ior3ka9/qzw/LIrZPGSU46 XBP5mKJAghw79h0VIslVs0EAwKxROWvsK4RkJK8frl3EVvzogdB+LqvrA1npfaVTuXT/Q3 2X7fziVvoj8PKp0C67+OPuQKzh3LRgw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-361-lvHm3uubO8KQ5Q_mzlMNHw-1; Thu, 01 Dec 2022 09:16:25 -0500 X-MC-Unique: lvHm3uubO8KQ5Q_mzlMNHw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C0B185A588; Thu, 1 Dec 2022 14:16:20 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5617BC15BB4; Thu, 1 Dec 2022 14:16:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2B1EGFqR3843244 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 1 Dec 2022 15:16:15 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2B1EGDd73843243; Thu, 1 Dec 2022 15:16:13 +0100 Date: Thu, 1 Dec 2022 15:16:13 +0100 From: Jakub Jelinek To: Andrew Stubbs Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 3/3] vect: inbranch SIMD clones Message-ID: Reply-To: Jakub Jelinek References: <8022b190-387b-c6a9-a8fe-1d18a9140e93@codesourcery.com> MIME-Version: 1.0 In-Reply-To: <8022b190-387b-c6a9-a8fe-1d18a9140e93@codesourcery.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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, Dec 01, 2022 at 01:35:38PM +0000, Andrew Stubbs wrote: > > Maybe better add -ffat-lto-objects to dg-additional-options and drop > > the dg-skip-if (if it works with that, for all similar tests)? > > The tests are already run with -ffat-lto-objects and the test still fails > (pattern found zero times). I don't know why. > > Aside from that, I've made all the other changes you requested. Ah, I see what's going on. You match simdclone, which isn't matched just in the calls (I bet that is what you actually should/want count), but also twice per each simd clone definition (and if somebody has say path to gcc tree with simdclone in the name could match even more times). Thus, I think: > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16.c > @@ -0,0 +1,89 @@ > +/* { dg-require-effective-target vect_simd_clones } */ > +/* { dg-additional-options "-fopenmp-simd -fdump-tree-optimized" } */ > +/* { dg-additional-options "-mavx" { target avx_runtime } } */ > + > +/* Test that simd inbranch clones work correctly. */ > + > +#ifndef TYPE > +#define TYPE int > +#endif > + > +/* A simple function that will be cloned. */ > +#pragma omp declare simd > +TYPE __attribute__((noinline)) > +foo (TYPE a) > +{ > + return a + 1; > +} > + > +/* Check that "inbranch" clones are called correctly. */ > + > +void __attribute__((noinline)) You should use noipa attribute instead of noinline on callers which aren't declare simd (on declare simd it would prevent cloning which is essential for the declare simd behavior), so that you don't get surprises e.g. from extra ipa cp etc. > +masked (TYPE * __restrict a, TYPE * __restrict b, int size) > +{ > + #pragma omp simd > + for (int i = 0; i < size; i++) > + b[i] = a[i]<1 ? foo(a[i]) : a[i]; > +} > + > +/* Check that "inbranch" works when there might be unrolling. */ > + > +void __attribute__((noinline)) So here too. > +masked_fixed (TYPE * __restrict a, TYPE * __restrict b) > +/* Ensure the the in-branch simd clones are used on targets that support > + them. These counts include all call and definitions. */ > + > +/* { dg-skip-if "" { x86_64-*-* } { "-flto" } { "" } } */ Drop lines line above. > +/* { dg-final { scan-tree-dump-times "simdclone" 18 "optimized" { target x86_64-*-* } } } */ > +/* { dg-final { scan-tree-dump-times "simdclone" 7 "optimized" { target amdgcn-*-* } } } */ And scan-tree-dump-times " = foo.simdclone" 2 "optimized"; I'd think that should be the right number for all of x86_64, amdgcn and aarch64. And please don't forget about i?86-*-* too. > +/* TODO: aarch64 */ For aarch64, one would need to include it in check_effective_target_vect_simd_clones first... Otherwise LGTM. Jakub