Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-9788

32-bit and operation with small constant incorrectly computed with 16-bit wide instruction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Medium Medium
    • Code Generation Tools
    • CODEGEN-7479
    • Hide
      C2000_18.1.4.LTS
      C2000_20.2.1.LTS
      Show
      C2000_18.1.4.LTS C2000_20.2.1.LTS
    • default
    • No test case provided showing wrong results.

      The attached source file has this line ...

              MaskData = RawData & ~(0x00001000 | 0x00000100 | 0x00000010);
      

      All variables are of type long. Build it ...

      % cl2000 -@options.txt try1.c
      "try1.c", line 4: warning #552-D: variable "MaskData" was set but never used
      

      The key assembly instructions emitted are ...

              AND       AL,#61167             ; [CPU_ALU] |7|
              MOVL      *-SP[4],ACC           ; [CPU_ALU] |7|
      

      The AND instruction needs to operate on all 32-bits of the accumulator. I think this one only operates on the lower 16-bits, and clears the upper 32-bits.

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: