2 Replies Latest reply on Jan 15, 2009 8:38 AM by udeepta@amd

    Strange code generation

    BarsMonster

      // Enter your kernel in this window
      kernel void hello_brook_check(int a<>,int b<>, out int output<>
      //first index - key dword, second index - thread
      {
          output = a-b;
      }

       

      result is:

       

      ; --------  Disassembly --------------------
      00 TEX: ADDR(48) CNT(2) VALID_PIX
            0  SAMPLE R1.x___, R0.xyxx, t1, s0  UNNORM(XYZW)
            1  SAMPLE R0.x___, R0.xyxx, t0, s0  UNNORM(XYZW)
      01 ALU: ADDR(32) CNT(3)
            2  y: MOV         R1.y,  0.0f     
               z: SUB_INT     ____,  0.0f,  R1.x     
            3  x: ADD_INT     R1.x,  R0.x,  PV2.z     
      02 EXP_DONE: PIX0, R1.xyyy
      END_OF_PROGRAM

      why it does 2 opperations here? Target is 4870.

       

      -----------------------------

         output = a-b-c-d-e;

      ; --------  Disassembly --------------------
      00 TEX: ADDR(48) CNT(5) VALID_PIX
            0  SAMPLE R1.x___, R0.xyxx, t1, s0  UNNORM(XYZW)
            1  SAMPLE R4.x___, R0.xyxx, t0, s0  UNNORM(XYZW)
            2  SAMPLE R2.x___, R0.xyxx, t2, s0  UNNORM(XYZW)
            3  SAMPLE R3.x___, R0.xyxx, t3, s0  UNNORM(XYZW)
            4  SAMPLE R0.x___, R0.xyxx, t4, s0  UNNORM(XYZW)
      01 ALU: ADDR(32) CNT(9)
            5  x: SUB_INT     ____,  0.0f,  R1.x     
               y: SUB_INT     T0.y,  0.0f,  R3.x      VEC_021
               z: SUB_INT     T0.z,  0.0f,  R2.x      VEC_102
               w: MOV         R1.w,  0.0f     
            6  x: SUB_INT     ____,  0.0f,  R0.x     
               w: ADD_INT     ____,  R4.x,  PV5.x     
            7  y: ADD_INT     ____,  PV6.w,  T0.z     
               z: ADD_INT     ____,  PV6.x,  T0.y     
            8  x: ADD_INT     R1.x,  PV7.y,  PV7.z     
      02 EXP_DONE: PIX0, R1.xwww
      END_OF_PROGRAM

      here we see 8 instead of 4 :-S