From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by sourceware.org (Postfix) with ESMTPS id 914EB3858C2F for ; Fri, 5 Aug 2022 23:18:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 914EB3858C2F Received: by mail-pj1-x1034.google.com with SMTP id a8so3999553pjg.5 for ; Fri, 05 Aug 2022 16:18:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=EfkGr0GijX3ZEsiysNzqN7EAh8ggpZCbw53de+uGz6k=; b=nKPyDjjyqnmt1/YSyaK9W/2up3Ic5AIU/2xwSqFu5W4YPj25xPbmKczSuIhUkwFXff JaOa3rj5J8PgmtBl8FGaPe/ja+jsClaxGnKX/jx4zLSlqfTzll/tu4Pfk12C2tOpkN5j nXhmtOV0FXspctFfQEG1XOCLF6t8HZjH32WLC8naOhzsNHNMOm13UcDinOn4OTeU/OK8 EnX7OAcUyI+bM/V2VmFKRDKFIn5Ie+g0Njx2FV9Q1lsonbkykBpRkn9obQU91451IDur PSRaYE851P+SICD7Ik3hvIH+UhXGGIZSMMX0uRK1fTqcOvSozVp8OL2415OXO1WsjYN+ QVFQ== X-Gm-Message-State: ACgBeo2q6dszCGtTyXj4CY9CHk4XvYzPLrVa+O0mlIkBdLmRPYt3DPdv XbGbFC/XRoMU5i+9X5f3SsCuZOMH0E0MfgVDd2WLQ4HZ X-Google-Smtp-Source: AA6agR6vmBcB5zC4/vqkdGoAaVM0v7AGE8P/rBZfxZdAW1eby9ksTKH6KBocSSfzy0UufTPvUpXsfFzMBi4UmvaFOJY= X-Received: by 2002:a17:90b:3ec9:b0:1f5:7e38:1fd1 with SMTP id rm9-20020a17090b3ec900b001f57e381fd1mr7883883pjb.101.1659741487493; Fri, 05 Aug 2022 16:18:07 -0700 (PDT) MIME-Version: 1.0 References: <146313cd-154f-4001-05a8-6b25a90a14d2@suse.com> In-Reply-To: <146313cd-154f-4001-05a8-6b25a90a14d2@suse.com> From: "H.J. Lu" Date: Fri, 5 Aug 2022 16:17:31 -0700 Message-ID: Subject: Re: [PATCH 06/12] revert "x86: Also pass -P to $(CPP) when processing i386-opc.tbl" To: Jan Beulich Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3018.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2022 23:18:10 -0000 On Fri, Aug 5, 2022 at 5:23 AM Jan Beulich wrote: > > This reverts commit 384f368958f2a5bb083660e58e5f8a010e6ad429, which > broke i386-gen's emitting of diagnostics. As a replacement to address > the original issue of newer gcc no longer splicing lines when dropping > the line continuation backslashes, switch to using + as the line > continuation character, doing the line splicing in i386-gen. > --- > Alternatives to using + that I see are &, \+, or \&. To me a single Will \\ work? > character looks preferable, but I don't really have a strong opinion on > + vs &. An option would be to additionally require "," to be the last > "real" character before a line continuation, reducing the risk of > ambiguity. Yet another alternative would be to recognize template > definitions as the only constructs (currently) wanting to be split > across lines, and do line splicing just for them by looking for the > trailing > character. > > --- a/opcodes/Makefile.am > +++ b/opcodes/Makefile.am > @@ -559,7 +559,7 @@ $(srcdir)/i386-tbl.h: $(srcdir)/i386-ini > @echo $@ > > $(srcdir)/i386-init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h > - $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \ > + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \ > < $(srcdir)/i386-opc.tbl \ > | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) > > --- a/opcodes/Makefile.in > +++ b/opcodes/Makefile.in > @@ -1534,7 +1534,7 @@ $(srcdir)/i386-tbl.h: $(srcdir)/i386-ini > @echo $@ > > $(srcdir)/i386-init.h: i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h > - $(CPP) -P $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \ > + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \ > < $(srcdir)/i386-opc.tbl \ > | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) > > --- a/opcodes/i386-gen.c > +++ b/opcodes/i386-gen.c > @@ -1764,17 +1764,36 @@ process_i386_opcodes (FILE *table) > if (fgets (buf, sizeof (buf), fp) == NULL) > break; > > - lineno++; > - > p = remove_leading_whitespaces (buf); > > - /* Skip comments. */ > - str = strstr (p, "//"); > - if (str != NULL) > - str[0] = '\0'; > + for ( ; ; ) > + { > + lineno++; > + > + /* Skip comments. */ > + str = strstr (p, "//"); > + if (str != NULL) > + { > + str[0] = '\0'; > + remove_trailing_whitespaces (p); > + break; > + } > + > + /* Look for line continuation character. */ > + remove_trailing_whitespaces (p); > + j = strlen (buf); > + if (!j || buf[j - 1] != '+') > + break; > + if (j >= sizeof (buf) - 1) > + fail (_("%s: %d: (continued) line too long\n"), filename, lineno); > > - /* Remove trailing white spaces. */ > - remove_trailing_whitespaces (p); > + if (fgets (buf + j - 1, sizeof (buf) - j + 1, fp) == NULL) > + { > + fprintf (stderr, "%s: Line continuation on last line?\n", > + filename); > + break; > + } > + } > > switch (p[0]) > { > --- a/opcodes/i386-opc.tbl > +++ b/opcodes/i386-opc.tbl > @@ -455,7 +455,7 @@ enter, 0xc8, None, Cpu64, DefaultSize|No > leave, 0xc9, None, Cpu186|CpuNo64, DefaultSize|No_bSuf|No_sSuf|No_qSuf|No_ldSuf, {} > leave, 0xc9, None, Cpu64, DefaultSize|No_bSuf|No_lSuf|No_sSuf|No_ldSuf|NoRex64, {} > > - + s:8, ns:9, p:a, pe:a, np:b, po:b, l:c, nge:c, nl:d, ge:d, le:e, ng:e, nle:f, g:f> > > // Conditional jumps. > @@ -871,9 +871,9 @@ rex.wrxb, 0x4f, None, Cpu64, No_bSuf|No_ > > // Pseudo prefixes (base_opcode == PSEUDO_PREFIX) > > - - load:Load:0, store:Store:0, \ > - vex:VEX:0, vex2:VEX:0, vex3:VEX3:0, evex:EVEX:0, \ > + + load:Load:0, store:Store:0, + > + vex:VEX:0, vex2:VEX:0, vex3:VEX3:0, evex:EVEX:0, + > rex:REX:Cpu64, nooptimize:NoOptimize:0> > > {}, PSEUDO_PREFIX, Prefix_, , No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsPrefix, {} > @@ -962,13 +962,13 @@ pause, 0xf390, None, Cpu186, No_bSuf|No_ > > // MMX/SSE2 instructions. > > - - $avx:CpuAVX:66:Vex128|VexVVVV|VexW0|SSE2AVX:Vex128|VexVVVV=2|VexW0|SSE2AVX:RegXMM:Xmmword, \ > - $sse:CpuSSE2:66:::RegXMM:Xmmword, \ > + + $avx:CpuAVX:66:Vex128|VexVVVV|VexW0|SSE2AVX:Vex128|VexVVVV=2|VexW0|SSE2AVX:RegXMM:Xmmword, + > + $sse:CpuSSE2:66:::RegXMM:Xmmword, + > $mmx:CpuMMX::NoRex64::RegMMX:Qword> > > - - $avx:CpuAVX:Vex128|VexW0|SSE2AVX:VexLIG|VexW0|SSE2AVX:VexVVVV:Vex128|VexVVVV=2|VexW0|SSE2AVX, \ > + + $avx:CpuAVX:Vex128|VexW0|SSE2AVX:VexLIG|VexW0|SSE2AVX:VexVVVV:Vex128|VexVVVV=2|VexW0|SSE2AVX, + > $sse:CpuSSE2::NoRex64::> > > emms, 0xf77, None, CpuMMX, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, {} > @@ -1052,8 +1052,8 @@ pxor, 0x0fef, None, > // SSE instructions. > > - - $avx:CpuAVX:Vex128|VexW0|SSE2AVX:VexLIG|VexW0|SSE2AVX:VexVVVV, \ > + + $avx:CpuAVX:Vex128|VexW0|SSE2AVX:VexLIG|VexW0|SSE2AVX:VexVVVV, + > $sse:CpuSSE::IgnoreSize:> > > > @@ -1309,9 +1309,9 @@ invpcid, 0x660f3882, None, CpuINVPCID|Cp > > // SSSE3 instructions. > > - - $avx:CpuAVX:66:Vex128|VexW0|SSE2AVX:VexVVVV:RegXMM:Xmmword, \ > - $sse:CpuSSSE3:66:::RegXMM:Xmmword, \ > + + $avx:CpuAVX:66:Vex128|VexW0|SSE2AVX:VexVVVV:RegXMM:Xmmword, + > + $sse:CpuSSSE3:66:::RegXMM:Xmmword, + > $mmx:CpuSSSE3::NoRex64::RegMMX:Qword> > > phaddw, 0x0f3801, None, , Modrm|||No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { ||Unspecified|BaseIndex, } > @@ -1469,14 +1469,14 @@ gf2p8mulb, 0x660f38cf, None, > // AVX instructions. > > - - unord:03:C, unord_q:03:C, neq:04:C, neq_uq:04:C, nlt:05:, nlt_us:05:, \ > - nle:06:, nle_us:06:, ord:07:C, ord_q:07:C, eq_uq:08:C, \ > - nge:09:, nge_us:09:, ngt:0a:, ngt_us:0a:, false:0b:C, false_oq:0b:C, \ > - neq_oq:0c:C, ge:0d:, ge_os:0d:, gt:0e:, gt_os:0e:, true:0f:C, \ > - true_uq:0f:C, eq_os:10:C, lt_oq:11:, le_oq:12:, \ > - unord_s:13:C, neq_us:14:C, nlt_uq:15:, nle_uq:16:, ord_s:17:C, eq_us:18:C, \ > - nge_uq:19:, ngt_uq:1a:, false_os:1b:C, neq_os:1c:C, ge_oq:1d:, gt_oq:1e:, \ > + + unord:03:C, unord_q:03:C, neq:04:C, neq_uq:04:C, nlt:05:, nlt_us:05:, + > + nle:06:, nle_us:06:, ord:07:C, ord_q:07:C, eq_uq:08:C, + > + nge:09:, nge_us:09:, ngt:0a:, ngt_us:0a:, false:0b:C, false_oq:0b:C, + > + neq_oq:0c:C, ge:0d:, ge_os:0d:, gt:0e:, gt_os:0e:, true:0f:C, + > + true_uq:0f:C, eq_os:10:C, lt_oq:11:, le_oq:12:, + > + unord_s:13:C, neq_us:14:C, nlt_uq:15:, nle_uq:16:, ord_s:17:C, eq_us:18:C, + > + nge_uq:19:, ngt_uq:1a:, false_os:1b:C, neq_os:1c:C, ge_oq:1d:, gt_oq:1e:, + > true_us:1f:C> > > vaddpd, 0x6658, None, CpuAVX, Modrm|Vex|Space0F|VexVVVV=1|VexWIG|CheckRegSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Unspecified|BaseIndex|RegXMM|RegYMM, RegXMM|RegYMM, RegXMM|RegYMM } > -- H.J.