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.133.124]) by sourceware.org (Postfix) with ESMTPS id 4F2A5384F898 for ; Fri, 25 Nov 2022 11:35:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F2A5384F898 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=1669376108; 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=VEl4UQ5F+DzAUpBeiro7G5hVc0cx1AIdXcUHD6w+WnI=; b=Jxe9WrIF7m9L8tyuWPfqWt7sYWUZ9Q8gCsvh7gVN/v9I9z+K/tcHweKhg6Rw5J8abu9xt5 KQtmvl/pU8r0khp7CsGyxB4hzlk5338l0D+Uk2847cQT0CQFLfd/j8nt3kOGi6YtTGQEV3 SjMvplX3HU+IXYtRnspLjGo7GMOQ3/g= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-FXflcNt0OM6Eh_jRmSS1Yg-1; Fri, 25 Nov 2022 06:35:06 -0500 X-MC-Unique: FXflcNt0OM6Eh_jRmSS1Yg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 627171C05ADB; Fri, 25 Nov 2022 11:35:06 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2392040C2064; Fri, 25 Nov 2022 11:35:06 +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 2APBZ166354995 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 25 Nov 2022 12:35:02 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2APBZ0gP354994; Fri, 25 Nov 2022 12:35:00 +0100 Date: Fri, 25 Nov 2022 12:35:00 +0100 From: Jakub Jelinek To: Sandra Loosemore Cc: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH v4] OpenMP: Generate SIMD clones for functions with "declare target" Message-ID: Reply-To: Jakub Jelinek References: <927ad110-065e-9414-1312-bff5a0644e97@siemens.com> MIME-Version: 1.0 In-Reply-To: <927ad110-065e-9414-1312-bff5a0644e97@siemens.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.9 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 Mon, Nov 14, 2022 at 09:46:15PM -0700, Sandra Loosemore wrote: > --- a/gcc/omp-simd-clone.cc > +++ b/gcc/omp-simd-clone.cc > @@ -51,6 +51,210 @@ along with GCC; see the file COPYING3. If not see > #include "stringpool.h" > #include "attribs.h" > #include "omp-simd-clone.h" > +#include "omp-low.h" > +#include "omp-general.h" > + > +/* Print debug info for ok_for_auto_simd_clone to the dump file, logging > + failure reason EXCUSE for function DECL. Always returns false. */ > +static bool > +auto_simd_fail (tree decl, const char *excuse) > +{ > + if (dump_file && (dump_flags & TDF_DETAILS)) > + fprintf (dump_file, "\nNot auto-cloning %s because %s\n", > + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), > + excuse); > + return false; > +} > + > +/* Helper function for ok_for_auto_simd_clone; return false if the statement > + violates restrictions for an "omp declare simd" function. Specifically, > + the function must not > + - throw or call setjmp/longjmp > + - write memory that could alias parallel calls > + - read volatile memory > + - include openmp directives or calls > + - call functions that might do those things */ > + > +static bool > +auto_simd_check_stmt (gimple *stmt, tree outer) > +{ > + tree decl; > + > + switch (gimple_code (stmt)) > + { > + case GIMPLE_CALL: > + > + /* Calls to functions that are CONST or PURE are ok, even if they > + are internal functions without a decl. Reject other internal > + functions. */ > + if (gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)) > + break; > + if (gimple_call_internal_p (stmt)) > + return auto_simd_fail (outer, > + "body contains internal function call"); Just a note, this kind of building sentences from separate parts is not ok for translations, but in the fprintf case the string isn't translated anyway, so it is ok in this case. But if we wanted to emit a warning/inform, it wouldn't be. The patch LGTM, thanks. Jakub