Skip to content

Commit 730db70

Browse files
Resolved LZCNT & TZCNT test failed with xed 2025
1 parent 4393ce6 commit 730db70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Arch/X86/Arch.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,19 @@ static bool DecodeXED(xed_decoded_inst_t *xedd, const xed_state_t *mode,
359359
auto bytes = reinterpret_cast<const uint8_t *>(inst_bytes.data());
360360
xed_decoded_inst_zero_set_mode(xedd, mode);
361361
xed_decoded_inst_set_input_chip(xedd, XED_CHIP_INVALID);
362+
363+
// Enable LZCNT/TZCNT instructions (required for XED v2025+)
364+
// in reference the made in this
365+
// commit: https://github.com/intelxed/xed/commit/1bdc793f5f64cf207f6776f4c0e442e39fa47903
366+
// - Backward compatibility for decoder initialization of several ISA features has
367+
// been deprecated. Previously default-on features like `P4` (PAUSE), `LZCNT`
368+
// (replacing BSR), and `TZCNT` (replacing BSF) are now disabled by default unless
369+
// explicitly enabled by users through the raw XED setter APIs or the
370+
// chip/chip-features APIs.
371+
xed3_operand_set_lzcnt(xedd, 1);
372+
xed3_operand_set_tzcnt(xedd, 1);
373+
xed3_operand_set_p4(xedd, 1); // Enable PAUSE as well
374+
362375
auto err = xed_decode(xedd, bytes, static_cast<uint32_t>(num_bytes));
363376

364377
if (XED_ERROR_NONE != err) {

0 commit comments

Comments
 (0)