xorq: Error: suffix or operands invalid for `xor'

This is a discussion on xorq: Error: suffix or operands invalid for `xor' within the C Programming forums, part of the General Programming Boards category; Hi everyone, i have a problem with "xorq" in x86-64 bits when compiling an assembly code. When i put this ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    4

    xorq: Error: suffix or operands invalid for `xor'

    Hi everyone,
    i have a problem with "xorq" in x86-64 bits when compiling an assembly code.

    When i put this instruction: "" xorq $17179869184, %rax ""
    i get this error when compiling: Error: suffix or operands invalid for `xor'

    however if i put a number smaller than 2^31 (2147483648), the compilation is successful.

    can anyone please tell me how to fix this problem?
    I'm using gcc.

    Thanks

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,496
    The following site (read the "Immediates" section) seems to suggest that immediate values in x86-64 still have to be 32-bits:AMD64 Subpage

    To do what you want, I think you have to move the 64-bit immediate into a register first:
    Code:
    movabsq $17179869184, %rbx
    xorq $rbx, %rax

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    4
    Thank you for your reply. Yes its seems that one should put the value into a register then execute xorq since they are considered as 32 bits

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-26-2009, 09:07 AM
  2. Invalid Operands to Binary Error
    By MikeyVeeDubb in forum C Programming
    Replies: 17
    Last Post: 09-23-2009, 04:13 AM
  3. error: invalid operands to binary %
    By OxKing033 in forum C Programming
    Replies: 12
    Last Post: 03-18-2008, 09:21 AM
  4. Replies: 2
    Last Post: 09-12-2006, 04:50 AM
  5. error: invalid operands to binary *
    By cblix in forum C Programming
    Replies: 5
    Last Post: 01-29-2006, 07:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21