gcc/
PR target/101685
* config/i386/i386-options.c (ix86_option_override_internal):
Don't enable LZCNT/POPCNT if they have been disabled explicitly.
gcc/testsuite/
PR target/101685
* gcc.target/i386/pr101685.c: New test.
if (((processor_alias_table[i].flags & PTA_ABM) != 0)
&& !TARGET_EXPLICIT_ABM_P (opts))
{
- SET_TARGET_LZCNT (opts);
- SET_TARGET_POPCNT (opts);
+ if (!TARGET_EXPLICIT_LZCNT_P (opts))
+ SET_TARGET_LZCNT (opts);
+ if (!TARGET_EXPLICIT_POPCNT_P (opts))
+ SET_TARGET_POPCNT (opts);
}
if ((processor_alias_table[i].flags
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=amdfam10 -mno-lzcnt -mno-popcnt" } */
+
+#ifdef __LZCNT__
+# error LZCNT should be disabled
+#endif
+
+#ifdef __POPCNT__
+# error POPCNT should be disabled
+#endif