I'd need to see the types involved to determine whether this is a bug;
if both advalue and cfg.ref_mv are 16-bit values, I suspect the
compiler is correct in ignoring the upper 16 bit result.  (Try casting
one or the other to a long int.)

If that doesn't resolve it, please provide a complete function
definition that exhibits the problem in a tracker ticket so this can
be addressed.  https://sourceforge.net/tracker/?group_id=42303&atid=432701

You can use -mmpy=none to disable code generation for hardware
multiply if there is a compiler problem.

Peter

On Sun, Feb 19, 2012 at 1:43 PM, Miloslav Semler <maj...@prepere.com> wrote:
> Hello,
> I have some problem with msp-gcc (version 4.6.1, mspgcc-20111224). When
> I try to generate assembly code from this lines bellow:
>
> x = advalue * cfg.ref_mv;
>                        point = div32768(x);
>
> it produces something like that:
>
> mov     r15, &__MPYS
>        mov     &cfg+20, &__OP2
>        mov     &__RESLO, r14
>        pop     r2
>        mov     r14, r15
>        swpb    r15
>        sxt     r15
>        swpb    r15
>        sxt     r15
>        call    #div32768
>
> Which is wrong for me as it discards high word from result (RESHI is not
> copied, instead it is used an sign extension). Routine div32768 accepts
> 32bit signed integer.
>
> Is there any switch for compiler to avoid this problem?
>
>
> -- Miloslav
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to