0

I'm trying to port some code from MMX to SSE2 and having a bit of trouble in doing so.

For MMX I have:

    .data
    align 16
    onesByte qword 2 dup(0101010101010101h)
    ...
    psubusb mm2,onesByte
    psubusb mm0,onesByte

For SSE2 I have:

    .data
    align 16
    onesByte_O oword 4 dup(0101010101010101h)
    ...
    psubusb xmm2,onesByte_O
    psubusb xmm0,onesByte_O

Which I do not believe is correct. What is the appropriate way to convert oneBytes to support SSE2? Thanks!

Elegant
  • 143
  • 2
  • 15
  • `qword 4` probably. This way it was 4 times as big, and with 0 in the upper bytes. – harold Mar 07 '15 at 00:40
  • `qword` is still 64bit not 128bit which is required (according to the compiler) when using xmm registers for SSE2. – Elegant Mar 07 '15 at 01:28
  • Yea, but you'd have two of them, so that's alright. Edit: wait, it's already twice as much as necessary. What's going on there? – harold Mar 07 '15 at 01:32
  • Oh that's true, `qword 2 dup` should be 128bit as is. The issue still remains though. Assuming that the last statement holds: `psubusb xmm2,onesByte` instead of `onesByte_O` provides `error A2070: invalid instruction operands`. – Elegant Mar 07 '15 at 01:49
  • try `psubusb xmm2, xmmword ptr [oneByte]` because otherwise the auto type would be QWord PTR – zx485 Mar 07 '15 at 06:37

1 Answers1

0

oneBytes is a duplicated qword that needs to be called oword ptr oneBytes when using xmm registers.

Elegant
  • 143
  • 2
  • 15