]> granicus.if.org Git - clang/commit
Merging r344824:
authorTom Stellard <tstellar@redhat.com>
Mon, 22 Oct 2018 17:31:01 +0000 (17:31 +0000)
committerTom Stellard <tstellar@redhat.com>
Mon, 22 Oct 2018 17:31:01 +0000 (17:31 +0000)
commitb2338d4041b9cfe884a7797c7eb9961977f9dfeb
treead48446919959cbce781e163e826408b8ecebe41
parent0513b409d5e34b2d2a28ae21b6d620cc52de0e57
Merging r344824:

------------------------------------------------------------------------
r344824 | ctopper | 2018-10-19 18:30:00 -0700 (Fri, 19 Oct 2018) | 14 lines

[X86] When checking the bits in cpu_features for function multiversioning dispatcher in the resolver, make sure all the required bits are set. Not just one of them

Summary:
The multiversioning code repurposed the code from __builtin_cpu_supports for checking if a single feature is enabled. That code essentially performed (_cpu_features & (1 << C)) != 0. But with the multiversioning path, the mask is no longer guaranteed to be a power of 2. So we return true anytime any one of the bits in the mask is set not just all of the bits.

The correct check is (_cpu_features & mask) == mask

Reviewers: erichkeane, echristo

Reviewed By: echristo

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D53460
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_70@344923 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/attr-target-mv.c
test/CodeGen/builtin-cpu-supports.c