https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95863
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |polacek at redhat dot com,
| |ubizjak at gmail dot com
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
When BMI support was added by
commit 91afcfa30c1a15d759f8f59c9d1df403f196a5b6 (HEAD)
Author: Quentin Neill <[email protected]>
Date: Wed Nov 10 22:02:23 2010 +0000
Add support for BMI.
2010-11-10 Quentin Neill <[email protected]>
it defined:
/* The value at zero is only defined for the BMI instructions
LZCNT and TZCNT, not the BSR/BSF insns in the original isa. */
#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_BMI)
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_BMI)
and
commit 1068ced544257c6c2f804bb231c032e0fda90756
Author: Marek Polacek <[email protected]>
Date: Tue Aug 19 16:45:07 2014 +0000
alpha.h (CLZ_DEFINED_VALUE_AT_ZERO, [...]): Return 0/1 rather than bool.
* config/alpha/alpha.h (CLZ_DEFINED_VALUE_AT_ZERO,
CTZ_DEFINED_VALUE_AT_ZERO): Return 0/1 rather than bool.
* config/i386/i386.h (CLZ_DEFINED_VALUE_AT_ZERO,
CTZ_DEFINED_VALUE_AT_ZERO): Return 0/1 rather than bool.
didn't help:
-- Macro: CLZ_DEFINED_VALUE_AT_ZERO (MODE, VALUE)
-- Macro: CTZ_DEFINED_VALUE_AT_ZERO (MODE, VALUE)
A C expression that indicates whether the architecture defines a
value for 'clz' or 'ctz' with a zero operand. A result of '0'
indicates the value is undefined. If the value is defined for only
the RTL expression, the macro should evaluate to '1'; if the value
applies also to the corresponding optab entry (which is normally
the case if it expands directly into the corresponding RTL), then
the macro should evaluate to '2'. In the cases where the value is
defined, VALUE should be set to this value.
This patch does the trick:
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index d6b57562a53..44a811534a2 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -2933,9 +2933,9 @@ extern void debug_dispatch_window (int);
/* The value at zero is only defined for the BMI instructions
LZCNT and TZCNT, not the BSR/BSF insns in the original isa. */
#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
- ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_BMI ? 1 : 0)
+ ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_BMI ? 2 : 0)
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
- ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_LZCNT ? 1 : 0)
+ ((VALUE) = GET_MODE_BITSIZE (MODE), TARGET_LZCNT ? 2 : 0)