3 !!ORIGIN!! SDCC regression tests
4 !!LICENCE!! GPL, read COPYING.GPL
12 unsigned char success=0;
13 unsigned char failures=0;
14 unsigned char dummy=0;
17 unsigned char uc1,uc2,uc3;
19 unsigned int ui1,ui2,ui3;
29 c1 = c1*5; /* char = char * lit */
31 c2 = c1 *c3; /* char = char * char */
33 uc1= uc1*5; /* uchar = uchar * lit *
34 uc2=uc1*uc3; /* uchar = uchar * uchar */
40 void m2(unsigned char uc)
48 void m3(unsigned char uc)
50 volatile unsigned char vuc;
52 /* uchar = uchar * lit */
53 /* testing literal multiply with same source and destination */
56 uc1 = vuc; uc1 = uc1*1; if( uc1 != (uc2+=TESTLIT) ) failures++;
57 uc1 = vuc; uc1 = uc1*2; if( uc1 != (uc2+=TESTLIT) ) failures++;
58 uc1 = vuc; uc1 = uc1*3; if( uc1 != (uc2+=TESTLIT) ) failures++;
59 uc1 = vuc; uc1 = uc1*4; if( uc1 != (uc2+=TESTLIT) ) failures++;
60 uc1 = vuc; uc1 = uc1*5; if( uc1 != (uc2+=TESTLIT) ) failures++;
61 uc1 = vuc; uc1 = uc1*6; if( uc1 != (uc2+=TESTLIT) ) failures++;
62 uc1 = vuc; uc1 = uc1*7; if( uc1 != (uc2+=TESTLIT) ) failures++;
63 uc1 = vuc; uc1 = uc1*8; if( uc1 != (uc2+=TESTLIT) ) failures++;
64 uc1 = vuc; uc1 = uc1*9; if( uc1 != (uc2+=TESTLIT) ) failures++;
65 uc1 = vuc; uc1 = uc1*10; if( uc1 != (uc2+=TESTLIT) ) failures++;
66 uc1 = vuc; uc1 = uc1*11; if( uc1 != (uc2+=TESTLIT) ) failures++;
67 uc1 = vuc; uc1 = uc1*12; if( uc1 != (uc2+=TESTLIT) ) failures++;
68 uc1 = vuc; uc1 = uc1*13; if( uc1 != (uc2+=TESTLIT) ) failures++;
69 uc1 = vuc; uc1 = uc1*14; if( uc1 != (uc2+=TESTLIT) ) failures++;
70 uc1 = vuc; uc1 = uc1*15; if( uc1 != (uc2+=TESTLIT) ) failures++;
71 uc1 = vuc; uc1 = uc1*16; if( uc1 != (uc2+=TESTLIT) ) failures++;
72 uc1 = vuc; uc1 = uc1*17; if( uc1 != (uc2+=TESTLIT) ) failures++;
73 uc1 = vuc; uc1 = uc1*18; if( uc1 != (uc2+=TESTLIT) ) failures++;
74 uc1 = vuc; uc1 = uc1*19; if( uc1 != (uc2+=TESTLIT) ) failures++;
75 uc1 = vuc; uc1 = uc1*20; if( uc1 != (uc2+=TESTLIT) ) failures++;
76 uc1 = vuc; uc1 = uc1*21; if( uc1 != (uc2+=TESTLIT) ) failures++;
77 uc1 = vuc; uc1 = uc1*22; if( uc1 != (uc2+=TESTLIT) ) failures++;
78 uc1 = vuc; uc1 = uc1*23; if( uc1 != (uc2+=TESTLIT) ) failures++;
79 uc1 = vuc; uc1 = uc1*24; if( uc1 != (uc2+=TESTLIT) ) failures++;
81 uc1 = vuc; uc1 = uc1*31; if( uc1 != ((31*TESTLIT) & 0xff) ) failures++;
82 uc1 = vuc; uc1 = uc1*32; if( uc1 != ((32*TESTLIT) & 0xff) ) failures++;
83 uc1 = vuc; uc1 = uc1*64; if( uc1 != ((64*TESTLIT) & 0xff) ) failures++;
84 uc1 = vuc; uc1 = uc1*128;if( uc1 != ((128*TESTLIT)& 0xff) ) failures++;
86 /* testing literal multiply with different source and destination */
87 uc1 = vuc*1; if( uc1 != ((1*TESTLIT) & 0xff) ) failures++;
88 uc1 = vuc*2; if( uc1 != ((2*TESTLIT) & 0xff) ) failures++;
89 uc1 = vuc*4; if( uc1 != ((4*TESTLIT) & 0xff) ) failures++;
104 ui1 = uc1*uc2; /* uint = uchar * uchar */
106 i1 = c1*c2; /* int = char * char */
108 ui3 = ui1*ui2; /* uint = uint * unit */
114 printf("failures: %d\n",failures);