{"id":2231990,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2231990/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260501213120.324542-4-xry111@xry111.site/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260501213120.324542-4-xry111@xry111.site>","list_archive_url":null,"date":"2026-05-01T21:31:19","name":"[3/4] i386: testsuite: fix shift-gf2p8affine-2.c failure on non-AVX512 CPU","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"146c0360cff70c30ef031164167cc90c07c5f29b","submitter":{"id":84026,"url":"http://patchwork.ozlabs.org/api/1.2/people/84026/?format=json","name":"Xi Ruoyao","email":"xry111@xry111.site"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260501213120.324542-4-xry111@xry111.site/mbox/","series":[{"id":502499,"url":"http://patchwork.ozlabs.org/api/1.2/series/502499/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502499","date":"2026-05-01T21:31:20","name":"Test suite fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/502499/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231990/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231990/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256\n header.s=default header.b=OVAsJ9Lf;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256\n header.s=default header.b=OVAsJ9Lf","sourceware.org;\n dmarc=pass (p=reject dis=none) header.from=xry111.site","sourceware.org; spf=pass smtp.mailfrom=xry111.site","server2.sourceware.org;\n arc=none smtp.remote-ip=89.208.246.23"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g6kll4rGLz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 07:32:35 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id A9A75436F7D3\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  1 May 2026 21:32:33 +0000 (GMT)","from xry111.site (xry111.site [89.208.246.23])\n by sourceware.org (Postfix) with ESMTPS id 817EF437421D\n for <gcc-patches@gcc.gnu.org>; Fri,  1 May 2026 21:31:51 +0000 (GMT)","from stargazer (unknown\n [IPv6:2408:824e:304:a151:7a8a:a6f3:c5da:fb7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n (Client did not present a certificate)\n (Authenticated sender: xry111@xry111.site)\n by xry111.site (Postfix) with ESMTPSA id 5CAEE65AA5;\n Fri,  1 May 2026 17:31:48 -0400 (EDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org A9A75436F7D3","OpenDKIM Filter v2.11.0 sourceware.org 817EF437421D"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 817EF437421D","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 817EF437421D","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777671111; cv=none;\n b=PL/6M6S15Kek7SzGt9+1a7OMor2RlwrOhco5fDSO5/hptoI69L+w5bFPXxcJqIw4s7RnbNyLJzxLVoowwnEyLAp+UYO+IFk8d1Y/qsKzckYi3/nsBVZTilnQM+onoCHz7xZEtTd/HVk/zaWqrn/Iz3w6fMQ1njjW/kn3JZprRW4=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777671111; c=relaxed/simple;\n bh=BLbXnEsBFfvyIUzXfhkEsx1c2rrpDtQ3xTChP1tAYsI=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=JkN78ixeg9y8vah52P7VrVpz9Nder0BwUACS+Pc10duCcBDEqVsi4H2sHoTeh6CJLapCcFcgieqLu3iqTpGRo+upvjQawGGDGBW+PxpMxY0GLuYzVTne/TOAxpEZsNLFtV6cgAWyD0drzKjo50Yqu13ArQ+gBlL6tKtLkgZ1pLY=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=xry111.site;\n s=default; t=1777671110;\n bh=ltTk4sGBz6bE+YajIiGR+yUPAr10kQhbzY1S00wrGSU=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=OVAsJ9Lfcu3NpO2rGnLGZXBraFegNWZZECVXa9kCLNlPV/NfqdH4KxWmMSHRiz5W3\n z7ZNIDIGCnghRF+cSqdp0tikAiIYDtMcEbd96oR65VE6HIAqer2VGxk6MkwNylKg07\n 6GXEn4x//6e0Y6Ems1XsSwyxDgPLOUewbuPYWhxw=","From":"Xi Ruoyao <xry111@xry111.site>","To":"gcc-patches@gcc.gnu.org","Cc":"Richard Sandiford <rdsandiford@googlemail.com>,\n \"H . J . Lu\" <hjl.tools@gmail.com>, Xi Ruoyao <xry111@xry111.site>","Subject":"[PATCH 3/4] i386: testsuite: fix shift-gf2p8affine-2.c failure on\n non-AVX512 CPU","Date":"Sat,  2 May 2026 05:31:19 +0800","Message-ID":"<20260501213120.324542-4-xry111@xry111.site>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260501213120.324542-1-xry111@xry111.site>","References":"<20260501213120.324542-1-xry111@xry111.site>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Enabling AVX512 via command line causes the compiler to generate AVX512\ninstructions even before the runtime CPU feature check, causing the test\nto SIGILL if the CPU lacks AVX512.\n\nSo enable AVX512 via function attribute instead and only call that\nfunction after the CPU feature check.\n\ngcc/testsuite/\n\n\t* gcc.target/i386/shift-gf2p8affine-2.c (dg-options): Remove\n\tflags for AVX512.\n\t(main): Move the test logic to test() and only call it if the\n\tCPU supports AVX512.\n\t(test): New, with [[gnu::target()]] to enable AVX512.\n---\n .../gcc.target/i386/shift-gf2p8affine-2.c     | 25 +++++++++++++------\n 1 file changed, 18 insertions(+), 7 deletions(-)","diff":"diff --git a/gcc/testsuite/gcc.target/i386/shift-gf2p8affine-2.c b/gcc/testsuite/gcc.target/i386/shift-gf2p8affine-2.c\nindex ef088ab0b95..2c119c3de58 100644\n--- a/gcc/testsuite/gcc.target/i386/shift-gf2p8affine-2.c\n+++ b/gcc/testsuite/gcc.target/i386/shift-gf2p8affine-2.c\n@@ -1,5 +1,5 @@\n /* { dg-do run } */\n-/* { dg-options \"-mgfni -mavx512vl -mavx512bw -mavx512f -O3 -Wno-shift-count-negative -march=x86-64 -mtune=generic\" } */\n+/* { dg-options \"-O3 -Wno-shift-count-negative -march=x86-64 -mtune=generic\" } */\n /* { dg-require-effective-target gfni } */\n /* { dg-require-effective-target avx512vl } */\n /* { dg-require-effective-target avx512bw } */\n@@ -151,12 +151,9 @@ FUNC (N5)\n   func##N##ref (array2, len);\t\t\t\t\\\n   if (memcmp (array, array2, len)) __builtin_abort ()\n \n-int main ()\n+[[gnu::target (\"gfni,avx512vl,avx512bw,avx512f\")]]\n+void test ()\n {\n-  __builtin_cpu_init ();\n-  if (!__builtin_cpu_supports (\"gfni\"))\n-    return 0;\n-\n   const unsigned long len = 256;\n   char array[len], array2[len];\n   unsigned char filler = FILLER;\n@@ -195,6 +192,20 @@ int main ()\n   TEST (N5, sbyteshiftr);\n   TEST (N5, ubyteror);\n   TEST (N5, ubyterol);\n+}\n+\n+int\n+main ()\n+{\n+  __builtin_cpu_init ();\n+  if (!__builtin_cpu_supports (\"gfni\"))\n+    return 0;\n+  if (!__builtin_cpu_supports (\"avx512vl\"))\n+    return 0;\n+  if (!__builtin_cpu_supports (\"avx512bw\"))\n+    return 0;\n+  if (!__builtin_cpu_supports (\"avx512f\"))\n+    return 0;\n \n-  return 0;\n+  test ();\n }\n","prefixes":["3/4"]}