Author Topic: pinsrb invalid combination of opcode and operands  (Read 9703 times)

Offline pmonday

  • Jr. Member
  • *
  • Posts: 3
pinsrb invalid combination of opcode and operands
« on: May 23, 2011, 04:04:25 PM »
Alright, I will admit, I'm new to NASM and compiling someone else's code that is not compiling so I'm here debugging it.

This looks like a common problem as I wander the forums, many errors on a compile that show:
routines64.asm:955: error: invalid combination of opcode and operands

These all point to pinsrb instructions in the code.  There are two things this could be, as far as I can see:
- my toolset is out of date, I'm stuck on NASM 2.0 due to CentOS not liking GLIBC_2_7 (even 5.6 seems to have 2_5)
- I'm hoping it's not the above and this is simply a portability issue

The blocks of code the compiler is not digesting relates to an attempt to write values into a vector register (I guess):
;------------------------------------------------------------------------------
; Name:         Register8ToVector
; Purpose:      Writes 8-bit main register values into 128-bit vector register
;               without clearing the unused bits.
; Params:       rdi = loops
;------------------------------------------------------------------------------
Register8ToVector:
_Register8ToVector:
        sal     rdi, 2          ; Force some repetition.
.L1:
        pinsrb  xmm1, al, 0
        pinsrb  xmm2, bl, 1
        pinsrb  xmm3, cl, 2
        pinsrb  xmm1, dl, 3
        pinsrb  xmm2, sil, 4
        pinsrb  xmm3, dil, 5
        pinsrb  xmm0, bpl, 6
        pinsrb  xmm0, spl, 7

.....

Similar (but not equal) pins instructions work fine so I'm wondering if this is some sort of size issue ('pinsrq xmm1, r8, 0' compiles cleanly).

Ugh, I feel like a newbie ...

Paul Monday

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: pinsrb invalid combination of opcode and operands
« Reply #1 on: May 23, 2011, 05:31:16 PM »
Heh! Makes you feel like a newbie. How do you think it makes me feel? "What the heck is pinsrb?", he asks. (He looks it up.) Ah, SSE4.1! SSE4.1 was added in 2.0, but "corrected and rationalized" in 2.06. So I suspect a "version problem". Seems to assemble alright on 2.09.08...

I'm not familiar with "CentOS", but I'm disturbed that it doesn't like Nasm! We're supposed to be "Netwide", don't cha know? I ASSume you're trying to install Nasm from an .rpm? (I've never been able to get an .rpm to work!). Can you build Nasm from source? What I do is:

Code: [Select]
./configure
; wait...
make everything
; wait
; as root:
make install_everything

The only reason I do "make" as a plain user is so that I'll "own" the files - no point, really. Just "make install_everything" as root, or "sudo make install_everything" should work. (the "everything" target may give you some cruft you don't need - I do it for "completeness". My system's pretty old, but this works flawlessly for me.

If you can't (or don't want to) do this, please get back to us with details. Nobody should be stuck at 2.0! Besides the pinsrb "correction", many other bugs have been fixed, and features added. Of course, if you don't encounter the bugs, and don't need the features, it doesn't matter - but it looks like you've encountered a bug!

Thanks for the feedback (and TIA for any further feedback)! Sorry to hear you had trouble with it.

Best,
Frank



Offline Keith Kanios

  • Full Member
  • **
  • Posts: 383
  • Country: us
    • Personal Homepage
Re: pinsrb invalid combination of opcode and operands
« Reply #2 on: May 23, 2011, 05:32:15 PM »
That particular issue wasn't resolved until 2.06.

Are you able to compile NASM 2.09.08 from source (autoheader && autoconf && ./configure && make && sudo make install)?


Offline pmonday

  • Jr. Member
  • *
  • Posts: 3
Re: pinsrb invalid combination of opcode and operands
« Reply #3 on: May 23, 2011, 05:39:35 PM »
I'm not familiar with "CentOS", but I'm disturbed that it doesn't like Nasm! We're supposed to be "Netwide", don't cha know? I ASSume you're trying to install Nasm from an .rpm? (I've never been able to get an .rpm to work!). Can you build Nasm from source? What I do is:

Code: [Select]
./configure
; wait...
make everything
; wait
; as root:
make install_everything

Thanks for the quick response!  I will work on building from source right now, I figured it was a version issue.

I don't think CentOS directly hates you, just indirectly ... it seems they do hate GLIB though ;-)

I will jot back to the thread when it compiles and install cleanly!

Offline pmonday

  • Jr. Member
  • *
  • Posts: 3
Re: pinsrb invalid combination of opcode and operands
« Reply #4 on: May 23, 2011, 06:05:27 PM »
It compiled with your very simple instructions, I simply had to add "autogen.sh" to the top since I grabbed it from the git repository.  I then had to "yum install texinfo" to get makeinfo on my CentOS distro (yum is a centos/redhat thing).

The benchmark program I was  using is now compiled and happily benchmarking.

I appreciate your help ... what a job keeping NASM up on all of these platforms!

Thanks,
Paul Monday