Hello, All !
During use of mspgcc (build 2002-07-25) I noticed a very
strange things:

Consider the following fragment of code:

int b(long long k)
{
  if(k & 0xffff!=0)return 1;
}

The compiler emits:

.global b
        .type   b,@function
/***********************
 * Function `b'
 ***********************/
b:
/* prologue: frame size = 0; addenum 0; alloca:0, varargs:0 , fpr:0*/
.L__FrameSize_b=0x0
.L__FrameOffset_b=0x0
/* prologue end (size=0) */
        and     #llo(2), r12        ;<<<<<<<<????????????
        and     #llo(0), r13        
        and     #llo(52), r14      ;<<<<<<<<???????????? 
        and     #llo(0), r15
        tst     r12
        jeq     .L2
        mov     #llo(1), r15
        ret
.L2:
        mov     #llo(0), r15
.L1:
/* epilogue: frame size=0 */
        ret
/* epilogue end (size=1) */
/* function b size 20 (19) */
.Lfe1:
        .size   b,.Lfe1-b
/********* End of function ******/

Now lets make a minor changes:

int b(long long k)
{
  if(k & 0xffff)return 1;
return 0;
}

The compiler emits:

.global b
        .type   b,@function
/***********************
 * Function `b'
 ***********************/
b:
/* prologue: frame size = 0; addenum 0; alloca:0, varargs:0 , fpr:0*/
.L__FrameSize_b=0x0
.L__FrameOffset_b=0x2
        push    r11
/* prologue end (size=1) */
        and     #llo(19744), r12        ;<<<<<????
        and     #llo(137), r13
        and     #llo(46), r14
        and     #llo(8192), r15
        mov     r12, r11
        bis     r13, r11
        bis     r14, r11
        bis     r15, r11
        tst     r11
        jeq     .L2
        mov     #llo(1), r15
        jmp     .L1
.L2:
        mov     #llo(0), r15
.L1:
/* epilogue: frame size=0 */
        pop     r11
        ret
/* epilogue end (size=2) */

I think we have a BUG :-(.
The code is good and correct if argument type is long instead of long long.

All the best, Oleg.

Reply via email to