flat assembler
Message board for the users of flat assembler.

Index > Main > [solved] i have a problem with sse2 packed multiply

Author
Thread Post new topic Reply to topic
gens



Joined: 18 Feb 2013
Posts: 161
gens
i have a problem

also this code doesn't work

Code:
movdqa xmm1, [rax+buff_in]
movdqa xmm2, [coefficients]

pmaddwd xmm1, xmm2    

and pmullw version of same zero out the xmm1 register


paddsw xmm1, xmm2
psubusw xmm1, xmm2
work

do i have to set up some flags ?
weird, all other sse2 instructions i used so far work np
Post 22 Mar 2014, 02:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17260
Location: In your JS exploiting you and your system
revolution
What are the values in xmm1 and xmm2 you are loading?
Post 22 Mar 2014, 02:42
View user's profile Send private message Visit poster's website Reply with quote
gens



Joined: 18 Feb 2013
Posts: 161
gens
coefficients: dw 1, 16384/4, 16384/2, 16384, 16384, 16384/2, 16384/4, 1

buff_in is 16bit raw audio
(coefficients just for testing)

it should not wrap around, tested with 1's also to be sure

PS fasm assembles the instructions fine
Post 22 Mar 2014, 02:54
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
pmaddwd is not broken. Ex:
{29,81,149,233} = pmadd {1,2,3,4,5,6,7,8} , {9,10,11,12,13,14,15,16}
as you can see in debugger


Description:
Filesize: 18.84 KB
Viewed: 3059 Time(s)

Untitled.gif


Post 22 Mar 2014, 03:05
View user's profile Send private message Reply with quote
gens



Joined: 18 Feb 2013
Posts: 161
gens
weird

the full code

Code:
format ELF64 executable
entry start

align 16
segment readable writeable

align 16
buff_in: rw 147*2*2
align 16
buff_out: rw 160*2*2

align 16
;coefficients: dw 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384
;coefficients: dw 1, 16384/4, 16384/2, 16384, 16384, 16384/2, 16384/4, 1
coefficients: dw 1, 1, 1, 1, 1, 1, 1, 1
;rept 8 {dw 16384 }

tmp rb 256

include "macros.inc"
include "../include/syscalls.inc"

align 16
segment readable executable

start:

read 0, buff_in, 147*2*2*2
cmp rax, 147*2*2*2
jl end_fir

xor rax, rax

mov rcx, 147
loopy:
movdqa xmm0, [rax+buff_in]
movdqa xmm1, xmm0
movdqa xmm2, [coefficients]

pmaddwd xmm1, xmm2

movdqa [rax+buff_out], xmm1

add rax, 16
loop loopy

write 1, buff_out, 147*2*2*2

jmp start

end_fir:    


edit: i see what i have done
mhmh
im just dumb for testing with a song that starts with silence
Post 22 Mar 2014, 03:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17260
Location: In your JS exploiting you and your system
revolution
gens wrote:
... testing with a song that starts with silence
That is why I asked what values you have in xmm1 and xmm2. Checking input values is standard debugging procedure. I think the GIGO principle applies here. Wink
Post 22 Mar 2014, 03:58
View user's profile Send private message Visit poster's website Reply with quote
gens



Joined: 18 Feb 2013
Posts: 161
gens
well
didn't think the loop would be the problem

so to look back
it read stdin normal
then some samples in started overwriting other parts of the program
coefficients being one of them

why didn't it just fail
whyyyyyyyyyyyyyyyyyyyy (drama)

gn ppl, thx for help
Post 22 Mar 2014, 04:07
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4237
Location: 2018
edfed
do you have some link to http://www.gens.me/genstech.shtml? Smile
Post 24 Mar 2014, 11:29
View user's profile Send private message Visit poster's website Reply with quote
gens



Joined: 18 Feb 2013
Posts: 161
gens
edfed wrote:
do you have some link to http://www.gens.me/genstech.shtml? Smile


nop Smile
Post 25 Mar 2014, 19:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.