Questions tagged [bmi]

Bit Manipulation Instructions Sets (BMI sets) are extensions to the x86 instruction set architecture for microprocessors from Intel and AMD. The purpose of these instruction sets is to improve the speed of bit manipulation. (Courtesy of Wikipedia.)

Bit Manipulation Instructions Sets (BMI sets) are extensions to the x86 instruction set architecture for microprocessors from Intel and AMD. The purpose of these instruction sets is to improve the speed of bit manipulation. All the instructions in these sets are non-SIMD and operate only on general-purpose registers.

See: Wikipedia entry for BMI.

34 questions
3
votes
2 answers

Intrinsic __lzcnt64 returns different values with different compile options

I have the following code: #include #include #include long long lzcnt(long long l) { return __lzcnt64(l); } int main(int argc, char** argv) { printf("%lld\n", lzcnt(atoll(argv[1]))); return…
Michael Barker
  • 14,153
  • 4
  • 48
  • 55
2
votes
1 answer

Do all CPUs that support AVX2 also support BMI2 or popcnt?

From here, I learned that the support of AVX doesn't imply the support of BMI1. So how about AVX2: Do all CPUs that support AVX2 also support BMI2? Further, does the support of AVX2 imply the support of popcnt? Searched all over Google and cannot…
zhaokg
  • 282
  • 2
  • 14
2
votes
1 answer

Header for _blsr_u64 with Sun supplied GCC on Solaris 11?

We've got some code that runs on multiple platforms. The code uses BMI/BMI2 intrinsics when available, like a Core i7 5th gen. GCC supplied by Sun on Solaris 11.3 is defining __BMI__ and __BMI2__, but its having trouble locating BMI/BMI2…
jww
  • 97,681
  • 90
  • 411
  • 885
2
votes
1 answer

How can I check if BMI2 instructions are available in my ifunc resolver?

I want to use the _bzhi_u32 intrinsic, but I want to revert to a regular C implementation if the processor where the executable runs doesn't support the BMI2 instruction set. I'm using GCC 4.8.3 and I have the following static inline uint32_t…
RubenLaguna
  • 21,435
  • 13
  • 113
  • 151
2
votes
1 answer

Why do those two high(64bx64b) functions give different results?

static __inline__ uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t* hip) { __uint128_t product = ((__uint128_t)a)*((__uint128_t)b); *hip = product>>64; return (uint64_t)product; } I am trying to write following above…
Yigit Demirag
  • 344
  • 1
  • 12
1
vote
0 answers

Bitmap unpacking and generating sparse matrix

I'm trying to load a binary file into memory. It has a specific encoding and limited alphabet by which I mean every two bit represent an integer value (00 -> 0, 01 -> 1, 10 -> 2, and 11 -> 3) and that's it. Now 11 or basically 3 represent missing…
NULL
  • 759
  • 9
  • 18
1
vote
1 answer

Does x64 support imply BMI1 support?

It it safe to assume that x64 builds can use TZCNT without checking its support through cpu flags?
Pavel P
  • 15,789
  • 11
  • 79
  • 128
1
vote
1 answer

Parallel bit deposit / parallel bit extract on intel compiler/LLVM?

For CPUs that come with BMI2 instructions, one can use parallel bit deposit (pdep) and parallel bit extract (pext) with GCC using the builtin functions : unsigned int _pdep_u32 (unsigned int, unsigned int) unsigned int _pext_u32 (unsigned int,…
Vincent
  • 57,703
  • 61
  • 205
  • 388
0
votes
0 answers

How to create this using Bootstrap and javascript

BMI calculator How to create this using Bootstrap and javascript (Above i attached an image ) I am a beginner developer I am trying to create a BMI calculator using Bootstrap and Javascript but am not able to write code please help me Thank you
0
votes
0 answers

Problem Fetching the Results of the user in the BMI Calculator

There is a small Problem in the app that i developed ( BMI Calculator ). Everything works well the app works well and good when user is entering the details or any pop up message and toast are well defined and works well. the main problem arise when…
0
votes
1 answer

UnboundLocalError: local variable 'bmi' referenced before assignment line 38

I am making a BMI calculator with plotly Dash. I'm trying to code it where the user choses the unit of the input for weight and height, however its throwing an error on line 38: UnboundLocalError: local variable 'bmi' referenced before…
rerecodes
  • 33
  • 5
0
votes
1 answer

BLSI instruction - Isolate lowest set bit

Bit Manipulation Set contains BLSI - this instruction Extracts the lowest set bit from the source operand and set the corresponding bit in the destination register Could you show an example illustrating what is referred to by the lowest set bit…
kiriloff
  • 25,609
  • 37
  • 148
  • 229
0
votes
1 answer

Copy bits of uint64_t into two uint64_t at specific location

I have an input uint64_t X and number of its N least significant bits that I want to write into the target Y, Z uint64_t values starting from bit index M in the Z. Unaffected parts of Y and Z should not be changed. How I can implement it efficiently…
Curious
  • 507
  • 3
  • 16
0
votes
2 answers

Use a single bit as mask for a word(s)

I am writing an LLVM pass module to instrument every single memory operation in a program, and part of my logic needs to do some very hot binary logic on pointers. How can I implement "bit ? u64_value : zero" in as few cycles as possible,…
Andy
  • 237
  • 3
  • 14
0
votes
1 answer

Do Intel CPUs support Trailing Bit Manipulation (TBM) instructions?

Do Intel CPUs support TBM (Trailing Bit Manipulation) instructions? I am trying to use bextr on Intel with an immediate argument and getting a SIGILL when the CPUID bit for tbm is set. Does this mean that Intel CPUs do not support TBM? What is the…
gnzlbg
  • 7,135
  • 5
  • 53
  • 106