4 Replies Latest reply: Jan 21, 2014 1:54 AM by realhet RSS

In s_cmp_lg_i32 what LG stands for?

realhet Novice
Currently Being Moderated

Hi,

 

I just wonder how comes this abbreviation in the GCN ISA.

In the manual it also mentions that it should be NotEqual. -> S_CMP_{EQ,NE,GT,GE,LE,LT}_{I32,U32}

But when it comes to the section where the details for each instructions are, then it says about LG instead of NE.

 

Another interesting thing is, that every v_cmp instruction has it's negated twin: for example there is

v_cmp_lg_f32   //D(sgpr).u = (S0 <> S1), signal on sNaN input only; D = VCC in VOPC

and also

v_cmp_neq_f32  //D(sgpr).u = !(S0 == S1), signal on sNaN input only; D = VCC in VOPC

It seems like both of them are for the same thing, but they have different machine codes. Anyone knows why?

  • Re: In s_cmp_lg_i32 what LG stands for?
    jacksonfurrier Newbie
    Currently Being Moderated

    Do you know the execution time for these two?(in clock cycles)

  • Re: In s_cmp_lg_i32 what LG stands for?
    drallan Novice
    Currently Being Moderated

    realhet wrote:

     

    Hi,

     

    I just wonder how comes this abbreviation in the GCN ISA.

    In the manual it also mentions that it should be NotEqual. -> S_CMP_{EQ,NE,GT,GE,LE,LT}_{I32,U32}

    But when it comes to the section where the details for each instructions are, then it says about LG instead of NE.

     

    Another interesting thing is, that every v_cmp instruction has it's negated twin: for example there is

    v_cmp_lg_f32   //D(sgpr).u = (S0 <> S1), signal on sNaN input only; D = VCC in VOPC

    and also

    v_cmp_neq_f32  //D(sgpr).u = !(S0 == S1), signal on sNaN input only; D = VCC in VOPC

    It seems like both of them are for the same thing, but they have different machine codes. Anyone knows why?

     

    1. The NE in the S_CMP_ list must be a typo. "NE" is not used anywhere in 3 versions of the manual except this example.

     

    2. Interesting question.. One reason, it is required by the IEEE 754 spec for floating point. Quote

     

    "Implementations that provide predicates shall provide the first six predicates in Table 4 and should provide the seventh, and a means of logically negating predicates." (predicates refers to the various equality operators.)

     

    They have an additional footnote about the negated versions,

     

    [FOOTNOTE 6: There may appear to be two ways to write the logical negation of a predicate, one using NOT explicitly and the other reversing the relational operator. For example, the logical negation of (X = Y) may be written either NOT(X = Y) or (X ?<> Y); in this case both expressions are functionally equivalent to (X != Y). However, this coincidence does not occur for the other predicates. For example, the logical negation of (X < Y) is just NOT(X < Y); the reversed predicate (X ?>= Y) is different in that it does not signal an invalid operation exception when X and Y are unordered.]

More Like This

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points