Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Dec 26, 2016

This is useful for efficient bitsets operations (max and min member in set).

If you accept these kind of PRs I may also add others BMI1 and BMI2 opcodes.

@dlang-bot
Copy link
Contributor

dlang-bot commented Dec 26, 2016

Fix Bugzilla Description
17027 Add support for tzcnt and lzcnt in x86(64) iasm

@ghost ghost changed the title issue 17027 - add TZCNT to inline assembler issue 17027 - add TZCNT and LZCNT to inline assembler Dec 26, 2016
@WalterBright
Copy link
Member

Thanks. But there's a problem with the way the test is set up - it checks to see that the instruction produces the right results. The trouble with that is:

  1. it's quite a chunk of code to do that. Doing that for more instructions implies an enormous test suite.
  2. testing it requires running on a CPU with those instructions, which is often not the case.

Instead, make it work like most of the rest of the tests, where it just tests that the correct instruction bytes are emitted. It's simple, fast, correct, compact, and works on every test machine.

I.e. it tests what the assembler is supposed to do - output the correct instruction bytes - not what the CPU does with it.

@ghost
Copy link
Author

ghost commented Dec 26, 2016

Ok, rewritten to verify opcode correctness.

@WalterBright WalterBright merged commit 91f0c94 into dlang:master Dec 27, 2016
@ghost ghost deleted the issue-17027 branch December 27, 2016 02:25
@nordlow
Copy link
Contributor

nordlow commented Dec 27, 2016

Will these be available as builtins aswell, like for POPCNT?

@ghost
Copy link
Author

ghost commented Dec 28, 2016

@nordlow , good Q, I don't know. Actually I didn't even know that these intrinsics exist. It would be certainly be better since iasm can't be inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants