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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 129433857C65 for ; Sun, 4 Oct 2020 19:16:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 129433857C65 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-2tYubqyBNVikr8nGML-ozA-1; Sun, 04 Oct 2020 15:16:10 -0400 X-MC-Unique: 2tYubqyBNVikr8nGML-ozA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 710BB801AB6; Sun, 4 Oct 2020 19:16:08 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F6CE10013BD; Sun, 4 Oct 2020 19:16:07 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 094JG3q3001919; Sun, 4 Oct 2020 21:16:03 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 094JG0Hq001918; Sun, 4 Oct 2020 21:16:00 +0200 Date: Sun, 4 Oct 2020 21:16:00 +0200 From: Jakub Jelinek To: Andreas Schwab Cc: Jakub Jelinek via Gcc-patches , Richard Biener , Richard Earnshaw , "Joseph S. Myers" Subject: Re: [PATCH] options: Save and restore opts_set for Optimization and Target options Message-ID: <20201004191600.GH2176@tucnak> Reply-To: Jakub Jelinek References: <20200911092952.GM18149@tucnak> <20200913082922.GF21814@tucnak> <20200928195000.GA6647@localhost.localdomain> <20200930093255.GK2176@tucnak> <20200930112144.GA97062@localhost.localdomain> <20200930113911.GM2176@tucnak> <20200930132408.GA146714@localhost.localdomain> <20201002084633.GV2176@tucnak> <87ft6uwjja.fsf@linux-m68k.org> MIME-Version: 1.0 In-Reply-To: <87ft6uwjja.fsf@linux-m68k.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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=-7.4 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_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Oct 2020 19:16:14 -0000 On Sun, Oct 04, 2020 at 09:13:29AM +0200, Andreas Schwab wrote: > This breaks ia64: > > In file included from ./tm.h:23, > from ../../gcc/gencheck.c:23: > ./options.h:7816:40: error: ISO C++ forbids zero-size array 'explicit_mask' [-Werror=pedantic] > 7816 | unsigned HOST_WIDE_INT explicit_mask[0]; > | ^ > ./options.h:7816:26: error: zero-size array member 'cl_target_option::explicit_mask' not at end of 'struct cl_target_option' [-Werror=pedantic] > 7816 | unsigned HOST_WIDE_INT explicit_mask[0]; > | ^~~~~~~~~~~~~ > ./options.h:7812:16: note: in the definition of 'struct cl_target_option' > 7812 | struct GTY(()) cl_target_option > | ^~~~~~~~~~~~~~~~ Oops, sorry. The following patch should fix that and should also fix streaming of the new explicit_mask_* members. I'll bootstrap/regtest on x86_64-linux and i686-linux tonight, but have no way to test it on ia64-linux (well, tested that x86_64-linux -> ia64-linux cross builds cc1 with it). 2020-10-04 Jakub Jelinek * opth-gen.awk: Don't emit explicit_mask array if n_target_explicit is equal to n_target_explicit_mask. * optc-save-gen.awk: Compute has_target_explicit_mask and if false, don't emit code iterating over explicit_mask array elements. Stream also explicit_mask_* target members. --- gcc/opth-gen.awk.jj 2020-10-03 21:21:59.727862692 +0200 +++ gcc/opth-gen.awk 2020-10-04 11:12:51.851906413 +0200 @@ -291,7 +291,10 @@ for (i = 0; i < n_target_char; i++) { } print " /* " n_target_explicit - n_target_explicit_mask " members */"; -print " unsigned HOST_WIDE_INT explicit_mask[" int ((n_target_explicit - n_target_explicit_mask + 63) / 64) "];"; +if (n_target_explicit > n_target_explicit_mask) { + print " unsigned HOST_WIDE_INT explicit_mask[" \ + int ((n_target_explicit - n_target_explicit_mask + 63) / 64) "];"; +} for (i = 0; i < n_target_explicit_mask; i++) { print " " var_target_explicit_mask[i] ";"; --- gcc/optc-save-gen.awk.jj 2020-10-03 21:21:59.728862678 +0200 +++ gcc/optc-save-gen.awk 2020-10-04 21:03:31.619462434 +0200 @@ -689,6 +689,10 @@ for (i = 0; i < n_target_string; i++) { if (j != 0) { print " ptr->explicit_mask[" k "] = mask;"; } +has_target_explicit_mask = 0; +if (j != 0 || k != 0) { + has_target_explicit_mask = 1; +} print "}"; @@ -1075,9 +1079,11 @@ for (i = 0; i < n_target_val; i++) { print " return false;"; } -print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)"; -print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])"; -print " return false;" +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)"; + print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])"; + print " return false;" +} for (i = 0; i < n_target_other; i++) { if (var_target_other[i] in var_target_explicit_mask) { @@ -1121,8 +1127,10 @@ for (i = 0; i < n_target_val; i++) { name = var_target_val[i] print " hstate.add_hwi (ptr->" name");"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " hstate.add_hwi (ptr->explicit_mask[i]);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " hstate.add_hwi (ptr->explicit_mask[i]);"; +} for (i = 0; i < n_target_other; i++) { if (var_target_other[i] in var_target_explicit_mask) @@ -1159,8 +1167,22 @@ for (i = 0; i < n_target_val; i++) { print " bp_pack_value (bp, ptr->" name", 64);"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " bp_pack_value (bp, ptr->explicit_mask[i], 64);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " bp_pack_value (bp, ptr->explicit_mask[i], 64);"; +} + +for (i = 0; i < n_target_other; i++) { + if (var_target_other[i] in var_target_explicit_mask) { + print " bp_pack_value (bp, ptr->explicit_mask_" var_target_other[i] ", 64);"; + } +} + +for (i = 0; i < n_target_int; i++) { + if (var_target_int[i] in var_target_explicit_mask) { + print " bp_pack_value (bp, ptr->explicit_mask_" var_target_int[i] ", 64);"; + } +} print "}"; @@ -1188,8 +1210,22 @@ for (i = 0; i < n_target_val; i++) { print " ptr->" name" = (" var_target_val_type[i] ") bp_unpack_value (bp, 64);"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);"; +} + +for (i = 0; i < n_target_other; i++) { + if (var_target_other[i] in var_target_explicit_mask) { + print " ptr->explicit_mask_" var_target_other[i] " = bp_unpack_value (bp, 64);"; + } +} + +for (i = 0; i < n_target_int; i++) { + if (var_target_int[i] in var_target_explicit_mask) { + print " ptr->explicit_mask_" var_target_int[i] " = bp_unpack_value (bp, 64);"; + } +} print "}"; Jakub