public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9394] i386: Fix emissing of __builtin_cpu_supports.
@ 2021-12-16 11:46 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-12-16 11:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:43d67e5e75627ad1f5ba2e983a730f37547ba9b7

commit r11-9394-g43d67e5e75627ad1f5ba2e983a730f37547ba9b7
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Dec 13 15:34:30 2021 +0100

    i386: Fix emissing of __builtin_cpu_supports.
    
            PR target/103661
    
    gcc/ChangeLog:
    
            * config/i386/i386-builtins.c (fold_builtin_cpu): Compare to 0
            as API expects that non-zero values are returned (do that
            it mask == 31).
            For "avx512vbmi2" argument, we return now 1 << 31, which is a
            negative integer value.
    
    (cherry picked from commit 127c7178d5ec502d95862fd823537cbca1a0cb99)

Diff:
---
 gcc/config/i386/i386-builtins.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 128bd39816c..59575aea795 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -2236,7 +2236,11 @@ fold_builtin_cpu (tree fndecl, tree *args)
       /* Return __cpu_model.__cpu_features[0] & field_val  */
       final = build2 (BIT_AND_EXPR, unsigned_type_node, array_elt,
 		      build_int_cstu (unsigned_type_node, field_val));
-      return build1 (CONVERT_EXPR, integer_type_node, final);
+      if (isa_names_table[i].feature == (INT_TYPE_SIZE - 1))
+	return build2 (NE_EXPR, integer_type_node, final,
+		       build_int_cst (unsigned_type_node, 0));
+      else
+	return build1 (CONVERT_EXPR, integer_type_node, final);
     }
   gcc_unreachable ();
 }


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

only message in thread, other threads:[~2021-12-16 11:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 11:46 [gcc r11-9394] i386: Fix emissing of __builtin_cpu_supports Martin Liska

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).