public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/PR103661-fix-__builtin_cpu_supports-on-i386)] i386: Fix emissing of __builtin_cpu_supports.
Date: Mon, 13 Dec 2021 14:35:37 +0000 (GMT)	[thread overview]
Message-ID: <20211213143537.D4F2D3858034@sourceware.org> (raw)

https://gcc.gnu.org/g:a1a31b0018111dddb6e3f7680ac1c71e8472663a

commit a1a31b0018111dddb6e3f7680ac1c71e8472663a
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.  For
            "avx512vbmi2" argument, we return now 1 << 31, which is a
            negative integer value.

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

diff --git a/gcc/config/i386/i386-builtins.c b/gcc/config/i386/i386-builtins.c
index 0fb14b55712..7e57b665c1e 100644
--- a/gcc/config/i386/i386-builtins.c
+++ b/gcc/config/i386/i386-builtins.c
@@ -2353,7 +2353,8 @@ 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);
+      return build2 (NE_EXPR, integer_type_node, final,
+		     build_int_cst (unsigned_type_node, 0));
     }
   gcc_unreachable ();
 }


             reply	other threads:[~2021-12-13 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 14:35 Martin Liska [this message]
2021-12-14 13:14 Martin Liska
2021-12-14 13:51 Martin Liska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211213143537.D4F2D3858034@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).