cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Gunter
Journeyman III

neg modifier token in IL

Where can I find syntax and semantics of the above modifier?

The IL reference guide is a bit short on this.

Thanks

0 Likes
4 Replies
himanshu_gautam
Grandmaster

Try out:

http://developer.amd.com/gpu_assets/ATI_Intermediate_Language_%28IL%29_Specification_v2b.pdf

himanshu

0 Likes

Himanshu,

thanks a lot. There isn't too much info in this document either.

So, for example, what does

mov r0, r1.wzxy_neg(zw)

do?

Is the neg-operator pre- or post-swizzle?

Plus, will a neg-operator consume additional clock cycles?

Thanks

0 Likes

Sorry, found it myself:

swizzle takes precedence over neg.

Additional question I would have:

What's the correct way of using neg() for double-precision operands?

Also, are there literals for double-precision constants?

Thanks

0 Likes

If you have a look at the ASM docs (Evergreen Family ISA), you'll get a better idea of what the modifier does. In general, it flips the MSB of the channel specified (post swizzle).

The specific rules I have worked out by trial and error are:

  1. neg modifier on integer operations produces a ineg and then the operation (or an isub equivalent if on an iadd instruction).
  2. neg modifier on float instructions works as expected (flips MSB)
  3. neg modifier on non-float instructions (eg mov, cmov) works as float.
  4. To get neg modifier working on double, you need _neg(y) or _neg(yw) which acts on the 64bit MSB (little endian).

Note that the same rules seem to apply to the abs modifier. Many of the other modifiers will make no sense for integer operations (eg _bx2), although I doubt the IL compiler will complain (it is not always self consistent in behaviour).

Malcolm

 

0 Likes