public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] i386: Fix pr104551 testcase for solaris [PR 104726]
@ 2022-03-02  1:22 Hongyu Wang
  0 siblings, 0 replies; only message in thread
From: Hongyu Wang @ 2022-03-02  1:22 UTC (permalink / raw)
  To: gcc-patches

Use avx2-check mechanism to avoid illegal instrucion on non-avx2 target.

Tested by Rainer Orth on Solaris/x86. Pushed to trunk as obvious fix.

gcc/testsuite/ChangeLog:

	PR target/104726
	* gcc.target/i386/pr104551.c: Use avx2-check.h.
---
 gcc/testsuite/gcc.target/i386/pr104551.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.target/i386/pr104551.c b/gcc/testsuite/gcc.target/i386/pr104551.c
index 6300f25c0d5..b839d5b2b0d 100644
--- a/gcc/testsuite/gcc.target/i386/pr104551.c
+++ b/gcc/testsuite/gcc.target/i386/pr104551.c
@@ -2,6 +2,8 @@
 /* { dg-options "-O3 -mavx2" } */
 /* { dg-require-effective-target avx2 } */
 
+#include "avx2-check.h"
+
 unsigned int
 __attribute__((noipa))
 test(unsigned int a, unsigned char p[16]) {
@@ -11,7 +13,8 @@ test(unsigned int a, unsigned char p[16]) {
   return res;
 }
 
-int main ()
+static void
+avx2_test (void)
 {
   unsigned int a = 16U;
   unsigned char p[16];
@@ -20,5 +23,4 @@ int main ()
   unsigned int res = test (a, p);
   if (res != 128)
     __builtin_abort ();
-  return 0;
 }
-- 
2.18.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-02  1:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  1:22 [PATCH] i386: Fix pr104551 testcase for solaris [PR 104726] Hongyu Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).