flat assembler
Message board for the users of flat assembler.
Index
> Linux > One question about assembly |
Author |
|
mattst88 22 Jun 2008, 00:25
juanchen wrote: (1) why n is divided by 2 at first ("shrl $1,%%edx"). SSE2 allows for operation on two doubles at the same time. I'd guess that n is the number of iterations, and since we can work with two at a time, it'll take half the number of iterations, therefore n is divided by two. juanchen wrote: (2) why andl operation is executed ("andl $0x07,%%edx"). Evidently, only the low three bits are necessary. Anding with 7 (111b) removes all bits from position 3 on. juanchen wrote: (3) why n is compared with 3 ("cmp $3,%%edx"). Also necessary is that is done afterwards. It jumps if edx is greater than 3 (jg), jumps if edx is not equal to three, and falls through if it is 3. Again, just guessing, but I think this code is for making the number of iterations even. For instance, if it needs to do 7 iterations, do 1 so that 6 are left over. Then, use SSE2 to do 3 iterations of two at a time. I hope I've made some sense. By the way, your topic is extremely undescriptive. Change it and maybe more people will click it. Also put code tags around your code. FFS. _________________ My x86 Instruction Reference -- includes SSE, SSE2, SSE3, SSSE3, SSE4 instructions. Assembly Programmer's Journal |
|||
22 Jun 2008, 00:25 |
|
juanchen 23 Jun 2008, 12:25
mattst88 wrote:
Why does the only low three bits are necessary? n represents the total interation accounts. |
|||
23 Jun 2008, 12:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.