diff --git a/dev-libs/gmp/gmp-6.2.1-r3.ebuild b/dev-libs/gmp/gmp-6.2.1-r3.ebuild
index dc0cb7b4c773b..8e7bca104d30d 100644
--- a/dev-libs/gmp/gmp-6.2.1-r3.ebuild
+++ b/dev-libs/gmp/gmp-6.2.1-r3.ebuild
@@ -27,7 +27,8 @@ LICENSE="|| ( LGPL-3+ GPL-2+ )"
SLOT="0/10.4"
# Unkeyworded temporarily for some more testing
#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm doc +cxx pic static-libs"
+IUSE="+asm doc +cpudetection +cxx pic static-libs"
+REQUIRED_USE="cpudetection? ( asm )"
BDEPEND="
app-arch/xz-utils
@@ -93,14 +94,14 @@ multilib_src_configure() {
--localstatedir="${EPREFIX}"/var/state/gmp
--enable-shared
+ $(use_enable asm assembly)
# fat is needed to avoid gmp installing either purely generic
# or specific-to-used-CPU (which our config.guess refresh prevents at the moment).
# Both Fedora and opensuse use this option to tackle the issue, bug #883201.
#
# This only works for x86, so we're still getting non-performant
# builds on other arches until we figure something out!
- $(use_enable asm fat)
- $(use_enable asm assembly)
+ $(use_enable cpudetection fat)
$(use_enable cxx)
$(use_enable static-libs static)
diff --git a/dev-libs/gmp/metadata.xml b/dev-libs/gmp/metadata.xml
index e98fbcba68113..753f212d3e39a 100644
--- a/dev-libs/gmp/metadata.xml
+++ b/dev-libs/gmp/metadata.xml
@@ -1,15 +1,16 @@
-
- toolchain@gentoo.org
- Gentoo Toolchain Project
-
-
-
- cpe:/a:gmplib:gmp
-
+
+ toolchain@gentoo.org
+ Gentoo Toolchain Project
+
+
+
+ cpe:/a:gmplib:gmp
+
diff --git a/profiles/arch/amd64/package.use.mask b/profiles/arch/amd64/package.use.mask
index 27207c6da3f91..4fa0267b5a1b1 100644
--- a/profiles/arch/amd64/package.use.mask
+++ b/profiles/arch/amd64/package.use.mask
@@ -17,6 +17,10 @@
#--- END OF EXAMPLES ---
+# Sam James (2022-11-30)
+# Only effective on amd64/x86.
+dev-libs/gmp -cpudetection
+
# Guillermo Joandet (2022-11-22)
# app-text/pandoc is keyworded on this architecture
net-libs/gssdp -man
diff --git a/profiles/arch/base/package.use.mask b/profiles/arch/base/package.use.mask
index 5a1455d90b27e..a9a1bad325cac 100644
--- a/profiles/arch/base/package.use.mask
+++ b/profiles/arch/base/package.use.mask
@@ -1,6 +1,10 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+# Sam James (2022-11-30)
+# Only effective on amd64/x86.
+dev-libs/gmp cpudetection
+
# Mike Gilbert (2022-10-16)
# Only supported on MIPS.
dev-lang/gnat-gpl fixed-point
diff --git a/profiles/arch/x86/package.use.mask b/profiles/arch/x86/package.use.mask
index a68e233ecfd97..20ce8131ba986 100644
--- a/profiles/arch/x86/package.use.mask
+++ b/profiles/arch/x86/package.use.mask
@@ -1,6 +1,10 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+# Sam James (2022-11-30)
+# Only effective on amd64/x86.
+dev-libs/gmp -cpudetection
+
# Michał Górny (2022-11-16)
# spirv-llvm-translator is not keyworded x86.
dev-libs/libclc spirv