[llvm-commits] r64000 breaks PIC16

sanjiv gupta sanjiv.gupta at microchip.com
Tue Feb 10 11:00:44 PST 2009


Try with a simple test
int foo (int i)
{
  if (i < 0)
    return -1;
  else
    return 1;
}

The correct assembly is: (as per r63998)
code.foo.# CODE
foo:
        movlw 128
        banksel foo.arg.i
        xorwf foo.arg.i + 1, W
        movwf foo.tmp + 2
        movlw 127
        movwf foo.tmp + 1
        movf foo.tmp + 2, W
        subwf foo.tmp + 1, W
        blt .BB1_2      ; if.else  (correct - br after test)
.BB1_1  ; if.then
        movlw 255
        movwf foo.args + 0
        movwf foo.args + 1
        goto .BB1_3     ; return
.BB1_2  ; if.else
        movlw 1
        movwf foo.args + 0
        ...



The incorrect assembly is : (as per r64000)
code.foo.# CODE
foo:
        movlw 127
        movwf foo.tmp + 1
        blt .BB1_2      ; if.else      (??? - br w/o test)
.BB1_1  ; if.then
        movlw 128
        banksel foo.arg.i
        xorwf foo.arg.i + 1, W
        subwf foo.tmp + 1, W
        movlw 255
        movwf foo.args + 0
        movwf foo.args + 1
        goto .BB1_3     ; return
.BB1_2  ; if.else
        movlw 1
        movwf foo.args + 0
        movlw 0
        movwf foo.args + 1


Thanks,
-Sanjiv



More information about the llvm-commits mailing list