In my code I solve integral
y=x^2-4x+6
I used SSE - it allows me to operate on 4 values in one time. I made program which solve this integral with values from 0 to 5 divided to five 4-element vectors n1, n2, n3, n4.
.data
n1: .float 0.3125,0.625,0.9375,1.25
n2: .float 1.5625,1.875,2.1875,2.5
n3: .float 2.8125,3.12500,3.4375,3.75
n4: .float 4.0625,4.37500,4.6875,5
szostka: .float 6,6,6,6
czworka: .float 4,4,4,4
.text
.global main
main:
movups (n1),%xmm0
mulps %xmm0,%xmm0
movups (szostka),%xmm2
addps %xmm2,%xmm0
movups (n1),%xmm1
movups (czworka),%xmm2
mulps %xmm2,%xmm1
subps %xmm1,%xmm0
movups %xmm0,%xmm7
movups (n2),%xmm0
mulps %xmm0,%xmm0
movups (szostka),%xmm2
addps %xmm2,%xmm0
movups (n1),%xmm1
movups (czworka),%xmm2
mulps %xmm2,%xmm1
subps %xmm1,%xmm0
movups %xmm0,%xmm6
movups (n3),%xmm0
mulps %xmm0,%xmm0
movups (szostka),%xmm2
addps %xmm2,%xmm0
movups (n1),%xmm1
movups (czworka),%xmm2
mulps %xmm2,%xmm1
subps %xmm1,%xmm0
movups %xmm0,%xmm5
movups (n4),%xmm0
mulps %xmm0,%xmm0
movups (szostka),%xmm2
addps %xmm2,%xmm0
movups (n1),%xmm1
movups (czworka),%xmm2
mulps %xmm2,%xmm1
subps %xmm1,%xmm0
movups %xmm0,%xmm4
mov $1,%eax
mov $0,%ebx
int $0x80
In the end, I have 4 vectors in registers xmm7, xmm6, xmm5, xmm4. To solve integral, I need to add vectors to each other (which is easy) and then add values from vector also to each other.
How should I do this?