diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 4564bd4743..a388f0f2b8 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -1223,6 +1223,11 @@ x86Compute(virCPUDefPtr host,
goto out;
}
+ /* first remove features that were inherited from the CPU model and were
+ * explicitly forced, disabled, or made optional
+ */
+ x86DataSubtract(cpu_require->data, cpu_force->data);
+ x86DataSubtract(cpu_require->data, cpu_optional->data);
x86DataSubtract(cpu_require->data, cpu_disable->data);
result = x86ModelCompare(host_model, cpu_require);
if (result == SUBSET || result == UNRELATED) {
diff --git a/tests/cputest.c b/tests/cputest.c
index 6abe18ded4..2e5f0cdfb8 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -581,6 +581,7 @@ mymain(void)
DO_TEST_COMPARE("x86", "host", "pentium3-amd", VIR_CPU_COMPARE_INCOMPATIBLE);
DO_TEST_COMPARE("x86", "host-amd", "pentium3-amd", VIR_CPU_COMPARE_SUPERSET);
DO_TEST_COMPARE("x86", "host-worse", "nehalem-force", VIR_CPU_COMPARE_IDENTICAL);
+ DO_TEST_COMPARE("x86", "host-SandyBridge", "exact-force-Haswell", VIR_CPU_COMPARE_IDENTICAL);
/* guest updates for migration
* automatically compares host CPU with the result */
diff --git a/tests/cputestdata/x86-exact-force-Haswell.xml b/tests/cputestdata/x86-exact-force-Haswell.xml
new file mode 100644
index 0000000000..614ed7ecd3
--- /dev/null
+++ b/tests/cputestdata/x86-exact-force-Haswell.xml
@@ -0,0 +1,15 @@
+
+ Haswell
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/cputestdata/x86-host-SandyBridge.xml b/tests/cputestdata/x86-host-SandyBridge.xml
new file mode 100644
index 0000000000..7f26b7bc4d
--- /dev/null
+++ b/tests/cputestdata/x86-host-SandyBridge.xml
@@ -0,0 +1,6 @@
+
+ x86_64
+ SandyBridge
+ Intel
+
+