• Uncategorized

About linux : How-to-load-constant-value-to-xmm-register-duplicate

Question Detail

This program reads values from text file and compare or value are greater or not. The problem is that I can’t load a constant value as a criteria for ucomisd function. The value in this case are always 0. Can you suggest how to sort out this problem? I searched also other methods how to load the constant value to yasm however it doesn’t worked neither.

       global  st_did_suma   
        section .text
;-----------------------------------------------------------------------------
;   double st_did_suma(double* matrica, uint64_t N)
;                         rdi          rsi  
;-----------------------------------------------------------------------------
st_did_suma:
        push rbx
        push r11
        push r8
        push rcx
        push rdx 
        push rbp

        
        mov rax, rsi
        mul rsi
       
        xorpd   xmm0, xmm0      
        cmp     rsi, 0                
        je      .end

        cmp     rsi, 1        
        jnz     .next  
          movsd   xmm0, qword [rdi]     
          jmp   .end


        
  .next:
        add     rdi, 8             
        dec     rsi  
        
        
        movsd   xmm1, qword [rdi]
        mov eax, 100.0                   ; XMM2 VALUE ALLWAYS 0
        movd xmm2, eax
        
        
        ucomisd  xmm1, xmm2    ;         COMPARE FUNCTION
        jb  .else
        mov r10, 1             ;         ANSWER
        cvtsi2sd xmm0, r10
        jnz     .next              
        

   .else:
   subsd xmm1, xmm1
   addsd xmm0, xmm1           ; ANSWER
   jmp .end
   .end:

        pop rbp
        pop rdx 
        pop rcx
        pop r11
        pop r8
        pop rbx
        ret   
    

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.