Question
Pages 36-37 of lecture notes 08-machine-data.pdf shows how xmm registers are used for simple floating point arithmetic such as fadd, dadd, an dincr which increments
Pages 36-37 of lecture notes "08-machine-data.pdf" shows how xmm registers are used for simple floating point arithmetic such as fadd, dadd, an dincr which increments *p, a pointer to double variable by value v.
For Wed-section you have to follow the aforementioned pages.
For both sections, read 3.11 Floating-Point code.
Write a C function for the following assembly. cvtsd2ss converts scalar double precision number (a double number) to scalar single precision (a float number) while cvtss2sd converts scalar single precision number (a float number) to scalar double precision (a double number).
unknown1: subss %xmm1, %xmm0 ret
unknown2: subsd %xmm1, %xmm0 ret
unknown3: movaps %xmm0, %xmm1 cvtsd2ss (%rdi), %xmm0 addss %xmm0, %xmm1 cvtss2sd %xmm1, %xmm2 movsd %xmm2, (%rdi) ret
unknown4: movsd (%rdi), %xmm1 movapd %xmm1, %xmm2 subsd %xmm0, %xmm2 movsd %xmm2, (%rdi) movapd %xmm1, %xmm0 ret
unknown5: pxor %xmm0, %xmm0 movl $0, %eax jmp .L13 .L14: movss (%rdx,%rax,4), %xmm1 mulss (%rsi,%rax,4), %xmm1 addss %xmm1, %xmm0 addq $1, %rax .L13: cmpq %rdi, %rax jb .L14 rep ret
unknown6: pxor %xmm0, %xmm0 movl $0, %eax jmp .L10 .L11: movsd (%rdx,%rax,8), %xmm1 mulsd (%rsi,%rax,8), %xmm1 addsd %xmm1, %xmm0 addq $1, %rax .L10: cmpq %rdi, %rax jb .L11 rep ret
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started