Skip to main content
1 vote
1 answer
79 views

The problem is inside the Graphic subroutine at row 236. (4th, 13th and 16th row in sublabel .writePixel). In this subroutine I browse the graphic pixel from 280 to 487 column and 368 to 385 row. (...
user22969975's user avatar
2 votes
1 answer
209 views

I have recently been working on an assembly algorithm for calculating the absolute difference between two long integers, and I have some concerns regarding the execution order in the presence of ...
works's user avatar
  • 125
0 votes
0 answers
100 views

I'm not understanding why fcmovb st(0) st(4) is not acting the way I expect. afaiu it will set st0 = st4 if the CF flag is set. Before: gdb> i r eflags st0 st4 eflags 0x282 [ SF IF ] st0 0 (raw ...
bogardon's user avatar
  • 915
6 votes
1 answer
649 views

It's well known that we can use the CMOV instruction to write branchless code, but I was wondering if I'm writing the equivalent of x = cond ? 1 : 2, should I prefer CMOVE rax, 1 #1a CMOVNE rax, 2 ...
Daniel's user avatar
  • 3,041
9 votes
2 answers
3k views

On Intel AVX, there is a possibility of branchless code. Instead of branching for case0 or case1, you can compute both cases, and blend the results based on a condition. AVX does this 8 way for float ...
Bram's user avatar
  • 8,503
4 votes
1 answer
1k views

In 64-bit mode on x86, most 32-bit arithmetic operations clear the top 32 bits of the destination register. What if the arithmetic operation is a "cmov" instruction, and the condition is ...
apt1002's user avatar
  • 1,101
6 votes
2 answers
2k views

For 64-bit registers, there is the CMOVcc A, B instruction, that only writes B to A if condition cc is satisfied: ; Do rax <- rdx iff rcx == 0 test rcx, rcx cmove rax, rdx However, I wasn't able ...
janw's user avatar
  • 9,906
3 votes
1 answer
1k views

Is there a way to conditional move a zero into a register in assembly? I'm trying to do cmpb %r9b, %r8b #compare r9 and r8 cmovgq $0, %rcx #If r8>r9, move zero to rcx But the compiler is ...
Tony S's user avatar
  • 35
5 votes
1 answer
3k views

I've noticed that the Conditional Move instruction is less extensible than the normal mov. For example, it doesn't support immediates and doesn't support the low-byte of a register. Out of curiosity, ...
David542's user avatar
  • 113k
-1 votes
1 answer
1k views

I've spent several hours trying to convert the following code to inline assembly (GCC) but in vain: int new_low = mid + 1; int new_high = mid - 1; if (middle < key) { low = new_low; } if (!(...
Bogi's user avatar
  • 2,718
1 vote
0 answers
461 views

I am looking to compile a set of benchmark suites using traditional GCC optimizations (as in using -O2/3) and comparing this with the same benchmark using no cmov instructions. I have seen several ...
Matt's user avatar
  • 11
6 votes
2 answers
2k views

In my answer to the question Assembly code to return smallest integer in array instead randomly returns either last or second to last number I presented an alternative using a cmovcc instruction. I ...
ecm's user avatar
  • 3,166
4 votes
1 answer
3k views

I saw somewhere that the GCC compiler might prefer sometimes not using conditional mov when converting my code into ASM. What are the cases where it might choose to do something other than ...
Idan C.'s user avatar
  • 41
2 votes
1 answer
359 views

I am trying to implement my own version of essentially Math.clamp within V8 using the internal assembler. I managed to produce a version of it using the Torque scripting language, and wanted to try ...
Stefan Bobev's user avatar
7 votes
2 answers
818 views

I'm trying to code a few high-performance assembly functions as an exercise, and have encountered a weird segfault that happens when running the program, but not in valgrind or nemiver. Basically a ...
Lou Garczynski's user avatar

15 30 50 per page