#1195 fsmul problem

closed-fixed
Maarten Brock
5
2013-05-25
2006-09-04
Anonymous
No

HI !

I found a bug and wanna report this.

for the float multiplication,

xdata float temp1;
xdata float xx;
xdata float y;

void test_func(void)
{
xx = cosf(1.0);
y = sinf(1.0);

temp1 = xx * xx;
}

for temp1 variable, the parameter passing to fsmul has
some bug like this, (please check genCall)

657 ;
C:/Progra~1/PowerS~1/Samples/Simple~1/pMain.c:8
4: temp1 = xx * xx;
658 ; genIpush
004B 90s00r34 659 mov
dptr,#_xx
004E E0 660 movx a,@dptr
004F C0 E0 661 push acc
0051 A3 662 inc dptr
0052 E0 663 movx a,@dptr
0053 C0 E0 664 push acc
0055 A3 665 inc dptr
0056 E0 666 movx a,@dptr
0057 C0 E0 667 push acc
0059 A3 668 inc dptr
005A E0 669 movx a,@dptr
005B C0 E0 670 push acc
671 ; genCall
005D 75 82 00 672 mov
dpl,#0x00
0060 75 83 00 673 mov
dph,#0x00
0063 75 F0 00 674 mov b,#0x00
0066 74 00 675 mov a,#0x00
0068 12s00r00 676 lcall
___fsmul
006B AA 82 677 mov r2,dpl
006D AB 83 678 mov r3,dph
006F AC F0 679 mov r4,b
0071 FD 680 mov r5,a
0072 E5 81 681 mov a,sp
0074 24 FC 682 add a,#0xfc
0076 F5 81 683 mov sp,a
684 ; genAssign
0078 90s00r28 685 mov
dptr,#_temp1
007B EA 686 mov a,r2
007C F0 687 movx @dptr,a
007D A3 688 inc dptr
007E EB 689 mov a,r3
007F F0 690 movx @dptr,a
0080 A3 691 inc dptr
0081 EC 692 mov a,r4
0082 F0 693 movx @dptr,a
0083 A3 694 inc dptr
0084 ED 695 mov a,r5
0085 F0 696 movx @dptr,a
0086 697 00101$:
0086 698 C$pMain.c$86$1
$1 ==.
0086 699 XG$test_func$0
$0 ==.
0086 22 700 ret

the genCall assigns zll zeros to dpl, dph, a, b like
following
005D 75 82 00 672 mov
dpl,#0x00
0060 75 83 00 673 mov
dph,#0x00
0063 75 F0 00 674 mov b,#0x00
0066 74 00 675 mov a,#0x00

this cause the multiplication error resulting zero.

the compile option is as folllows
--model-large --debug --noinduction --noinvariant --
nogcse --no-peep

please help us to solve this bug.

Discussion

  • Maarten Brock
    Maarten Brock
    2006-09-04

    • labels: 101550 --> 101552
    • assigned_to: nobody --> maartenbrock
     
  • Maarten Brock
    Maarten Brock
    2006-09-05

    Logged In: YES
    user_id=888171

    Fixed in SDCC 2.6.1 / SDCCopt.c #4361.

     
  • Maarten Brock
    Maarten Brock
    2006-09-05

    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Maarten Brock
    Maarten Brock
    2006-09-05

    • labels: 101552 --> Icode generator