[llvm-commits] r64000 breaks PIC16

Dale Johannesen dalej at apple.com
Tue Feb 10 11:13:11 PST 2009


I'll look.  I don't know enough about PIC16 to see what's wrong with  
the assembly, could you send a .bc file?

On Feb 10, 2009, at 11:00 AMPST, sanjiv gupta wrote:

> 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