- int size, offset = 0, same=0;
- unsigned long lit = 0L;
-
- FENTRY;
- DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- aopOp (IC_LEFT(ic),ic,FALSE);
- aopOp (IC_RIGHT(ic),ic,FALSE);
- aopOp (IC_RESULT(ic),ic,TRUE);
-
- if (AOP_TYPE(IC_RESULT(ic)) == AOP_CRY &&
- AOP_TYPE(IC_RIGHT(ic)) == AOP_LIT) {
- operand *t = IC_RIGHT(ic);
- IC_RIGHT(ic) = IC_LEFT(ic);
- IC_LEFT(ic) = t;
- }
-
- DEBUGpic14_emitcode ("; ","result %s, left %s, right %s",
- AopType(AOP_TYPE(IC_RESULT(ic))),
- AopType(AOP_TYPE(IC_LEFT(ic))),
- AopType(AOP_TYPE(IC_RIGHT(ic))));
-
- /* special cases :- */
- /* if both left & right are in bit space */
- if (AOP_TYPE(IC_LEFT(ic)) == AOP_CRY &&
- AOP_TYPE(IC_RIGHT(ic)) == AOP_CRY) {
- genPlusBits (ic);
- goto release ;
- }
-
- /* if I can do an decrement instead
- of subtract then GOOD for ME */
- // if (genMinusDec (ic) == TRUE)
- // goto release;
-
- size = pic14_getDataSize(IC_RESULT(ic));
- same = pic14_sameRegs(AOP(IC_RIGHT(ic)), AOP(IC_RESULT(ic)));
-
- if(AOP(IC_RIGHT(ic))->type == AOP_LIT) {
- /* Add a literal to something else */
-
- lit = (unsigned long)floatFromVal(AOP(IC_RIGHT(ic))->aopu.aop_lit);
- lit = - (long)lit;
-
- genAddLit ( ic, lit);
-
-#if 0
- /* add the first byte: */
- pic14_emitcode("movlw","0x%x", lit & 0xff);
- pic14_emitcode("addwf","%s,f", aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE));
- emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
- emitpcode(POC_ADDWF, popGet(AOP(IC_LEFT(ic)),0));
-
-
- offset = 1;
- size--;
-
- while(size-- > 0) {
-
- lit >>= 8;
-
- if(lit & 0xff) {
-
- if((lit & 0xff) == 0xff) {
- emitpcode(POC_MOVLW, popGetLit(0xff));
- emitSKPC;
- emitpcode(POC_ADDWF, popGet(AOP(IC_LEFT(ic)),offset));
- } else {
- emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
- emitSKPNC;
- emitpcode(POC_MOVLW, popGetLit((lit+1) & 0xff));
- emitpcode(POC_ADDWF, popGet(AOP(IC_LEFT(ic)),offset));
- }
-
- } else {
- /* do the rlf known zero trick here */
- emitpcode(POC_MOVLW, popGetLit(1));
- emitSKPNC;
- emitpcode(POC_ADDWF, popGet(AOP(IC_LEFT(ic)),offset));
- }
- offset++;
- }
-#endif
- } else if(AOP_TYPE(IC_RIGHT(ic)) == AOP_CRY) {
- // bit subtraction
-
- pic14_emitcode(";bitsub","right is bit: %s",aopGet(AOP(IC_RIGHT(ic)),0,FALSE,FALSE));
- pic14_emitcode(";bitsub","left is bit: %s",aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE));
- pic14_emitcode(";bitsub","result is bit: %s",aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
-
- /* here we are subtracting a bit from a char or int */
- if(size == 1) {
- if (pic14_sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) ) {
-
- emitpcode(POC_BTFSC , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_DECF , popGet(AOP(IC_RESULT(ic)),0));
-
- pic14_emitcode("btfsc","(%s >> 3), (%s & 7)",
- AOP(IC_RIGHT(ic))->aopu.aop_dir,
- AOP(IC_RIGHT(ic))->aopu.aop_dir);
- pic14_emitcode(" incf","%s,f", aopGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
- } else {
-
- if(AOP_TYPE(IC_LEFT(ic)) == AOP_ACC) {
- emitpcode(POC_BTFSC , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_XORLW , popGetLit(1));
- }else if( (AOP_TYPE(IC_LEFT(ic)) == AOP_IMMD) ||
- (AOP_TYPE(IC_LEFT(ic)) == AOP_LIT) ) {
-
- lit = (unsigned long)floatFromVal(AOP(IC_LEFT(ic))->aopu.aop_lit);
-
- if(AOP_TYPE(IC_RESULT(ic)) == AOP_CRY) {
- if (pic14_sameRegs(AOP(IC_RIGHT(ic)), AOP(IC_RESULT(ic))) ) {
- if(lit & 1) {
- emitpcode(POC_MOVLW , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_XORWF , popGet(AOP(IC_RIGHT(ic)),0));
- }
- }else{
- emitpcode(POC_BCF , popGet(AOP(IC_RESULT(ic)),0));
- if(lit & 1)
- emitpcode(POC_BTFSS , popGet(AOP(IC_RIGHT(ic)),0));
- else
- emitpcode(POC_BTFSC , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_BSF , popGet(AOP(IC_RESULT(ic)),0));
- }
- goto release;
- } else {
- emitpcode(POC_MOVLW , popGetLit(lit & 0xff));
- emitpcode(POC_BTFSC , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_MOVLW , popGetLit((lit-1) & 0xff));
- emitpcode(POC_MOVWF , popGet(AOP(IC_RESULT(ic)),0));
-
- }
-
- } else {
- emitpcode(POC_MOVFW , popGet(AOP(IC_LEFT(ic)),0));
- emitpcode(POC_BTFSC , popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_DECFW , popGet(AOP(IC_LEFT(ic)),0));
- }
-
- if(AOP_TYPE(IC_RESULT(ic)) != AOP_ACC) {
-
- emitpcode(POC_MOVWF , popGet(AOP(IC_RESULT(ic)),0));
-
- } else {
- emitpcode(POC_ANDLW , popGetLit(1));
- /*
- emitpcode(POC_BCF , popGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
- emitSKPZ;
- emitpcode(POC_BSF , popGet(AOP(IC_RESULT(ic)),0,FALSE,FALSE));
- */
- }
-
- }
-
- }
- } else if(// (AOP_TYPE(IC_LEFT(ic)) == AOP_IMMD) ||
- (AOP(IC_LEFT(ic))->type == AOP_LIT) &&
- (AOP_TYPE(IC_RIGHT(ic)) != AOP_ACC)) {
-
- lit = (unsigned long)floatFromVal(AOP(IC_LEFT(ic))->aopu.aop_lit);
- DEBUGpic14_emitcode ("; left is lit","line %d result %s, left %s, right %s",__LINE__,
- AopType(AOP_TYPE(IC_RESULT(ic))),
- AopType(AOP_TYPE(IC_LEFT(ic))),
- AopType(AOP_TYPE(IC_RIGHT(ic))));
-
-
- if( (size == 1) && ((lit & 0xff) == 0) ) {
- /* res = 0 - right */
- if (pic14_sameRegs(AOP(IC_RIGHT(ic)), AOP(IC_RESULT(ic))) ) {
- emitpcode(POC_COMF, popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_INCF, popGet(AOP(IC_RIGHT(ic)),0));
- } else {
- emitpcode(POC_COMFW, popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),0));
- emitpcode(POC_INCF, popGet(AOP(IC_RESULT(ic)),0));
- }
- goto release;
- }
-
- emitpcode(POC_MOVFW, popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_SUBLW, popGetLit(lit & 0xff));
- emitpcode(POC_MOVWF,popGet(AOP(IC_RESULT(ic)),0));
-
-
- offset = 1;
- while(--size) {
- lit >>= 8;
-
- if(size == 1) {
- /* This is the last byte in a multibyte subtraction
- * There are a couple of tricks we can do by not worrying about
- * propogating the carry */
- if(lit == 0xff) {
- /* 0xff - x == ~x */
- if(same) {
- emitpcode(POC_COMF, popGet(AOP(IC_RESULT(ic)),offset));
- emitSKPC;
- emitpcode(POC_DECF, popGet(AOP(IC_RESULT(ic)),offset));
- } else {
- emitpcode(POC_COMFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),offset));
- emitSKPC;
- emitpcode(POC_DECF, popGet(AOP(IC_RESULT(ic)),offset));
- }
- } else {
- emitpcode(POC_MOVFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitSKPC;
- emitpcode(POC_INCFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitpcode(POC_SUBLW, popGetLit(lit & 0xff));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),offset));
- }
-
- goto release;
- }
-
- if(same) {
-
- if(lit & 0xff) {
- emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
- emitSKPC;
- emitpcode(POC_MOVLW, popGetLit((lit & 0xff)-1));
- emitpcode(POC_SUBWF, popGet(AOP(IC_RESULT(ic)),offset));
- } else {
- emitSKPNC;
- emitpcode(POC_SUBWF, popGet(AOP(IC_RESULT(ic)),offset));
-
- }
- } else {
-
- if(lit & 0xff) {
- emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),offset));
- } else
- emitpcode(POC_CLRF, popGet(AOP(IC_RESULT(ic)),offset));
-
- emitpcode(POC_MOVFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitSKPC;
- emitpcode(POC_INCFSZW,popGet(AOP(IC_RIGHT(ic)),offset));
- emitpcode(POC_SUBWF, popGet(AOP(IC_RESULT(ic)),offset));
- }
- }
-
-
- } else {
-
- DEBUGpic14_emitcode ("; ","line %d result %s, left %s, right %s",__LINE__,
- AopType(AOP_TYPE(IC_RESULT(ic))),
- AopType(AOP_TYPE(IC_LEFT(ic))),
- AopType(AOP_TYPE(IC_RIGHT(ic))));
-
- if(strcmp(aopGet(AOP(IC_LEFT(ic)),0,FALSE,FALSE),"a") == 0 ) {
- DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- emitpcode(POC_SUBFW, popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_SUBLW, popGetLit(0));
- emitpcode(POC_MOVWF,popGet(AOP(IC_RESULT(ic)),0));
- } else {
-
- if ( AOP_TYPE(IC_LEFT(ic)) == AOP_ACC) {
- emitpcode(POC_SUBFW, popGet(AOP(IC_RIGHT(ic)),0));
- emitpcode(POC_SUBLW, popGetLit(0));
- if ( AOP_TYPE(IC_RESULT(ic)) != AOP_ACC)
- emitpcode(POC_MOVWF,popGet(AOP(IC_RESULT(ic)),0));
- } else {
-
- DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- if(AOP_TYPE(IC_RIGHT(ic)) != AOP_ACC)
- emitpcode(POC_MOVFW,popGet(AOP(IC_RIGHT(ic)),0));
-
- if (pic14_sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) )
- emitpcode(POC_SUBWF, popGet(AOP(IC_LEFT(ic)),0));
- else {
- if( (AOP_TYPE(IC_LEFT(ic)) == AOP_IMMD) ||
- (AOP_TYPE(IC_LEFT(ic)) == AOP_LIT) ) {
- emitpcode(POC_SUBLW, popGet(AOP(IC_LEFT(ic)),0));
- } else {
- emitpcode(POC_SUBFW, popGet(AOP(IC_LEFT(ic)),0));
- }
- if ( AOP_TYPE(IC_RESULT(ic)) != AOP_ACC) {
- if ( AOP_TYPE(IC_RESULT(ic)) == AOP_CRY) {
- emitpcode(POC_BCF , popGet(AOP(IC_RESULT(ic)),0));
- emitSKPZ;
- emitpcode(POC_BSF , popGet(AOP(IC_RESULT(ic)),0));
- }else
- emitpcode(POC_MOVWF,popGet(AOP(IC_RESULT(ic)),0));
- }
- }
- }
- }
-
- size = min( AOP_SIZE(IC_RESULT(ic)), AOP_SIZE(IC_RIGHT(ic))) - 1;
- offset = 1;
-
- if(size){
- if (pic14_sameRegs(AOP(IC_RIGHT(ic)), AOP(IC_RESULT(ic)))) {
- int lit = 0;
- if (op_isLitLike (IC_LEFT(ic)))
- lit = 1;
- while(size--){
- emitpcode(POC_MOVFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitSKPC;
- emitpcode(POC_INCFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitpcode(lit?POC_SUBLW:POC_SUBFW, popGetAddr(AOP(IC_LEFT(ic)),offset,0));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),offset));
- offset++;
- }
- } else {
- PIC_OPCODE poc = POC_MOVFW;
- if (op_isLitLike (IC_LEFT(ic)))
- poc = POC_MOVLW;
- while(size--){
- if (!pic14_sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) ) {
- emitpcode(poc, popGetAddr(AOP(IC_LEFT(ic)),offset,0));
- emitpcode(POC_MOVWF, popGet(AOP(IC_RESULT(ic)),offset));
- }
- emitpcode(POC_MOVFW, popGet(AOP(IC_RIGHT(ic)),offset));
- emitSKPC;
- emitpcode(POC_INCFSZW,popGet(AOP(IC_RIGHT(ic)),offset));
- emitpcode(POC_SUBWF, popGet(AOP(IC_RESULT(ic)),offset));
- offset++;
- }
- }
- }
- }
-
- // adjustArithmeticResult(ic);
-
-release:
- freeAsmop(IC_LEFT(ic),NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE));
- freeAsmop(IC_RIGHT(ic),NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE));
- freeAsmop(IC_RESULT(ic),NULL,ic,TRUE);
-}
-/*-----------------------------------------------------------------*
-* genUMult8XLit_16 - unsigned multiplication of two 8-bit numbers.
-*
-*
-*-----------------------------------------------------------------*/
-void genUMult8XLit_16 (operand *left,
- operand *right,
- operand *result,
- pCodeOpReg *result_hi)
-
-{
-
- unsigned int lit;
- unsigned int i,have_first_bit;
- int same;
- pCodeOp *temp;
-
- FENTRY;
- if (AOP_TYPE(right) != AOP_LIT){
- fprintf(stderr,"%s %d - right operand is not a literal\n",__FILE__,__LINE__);
- exit(1);
- }
-
-
- if(!result_hi) {
- result_hi = PCOR(popGet(AOP(result),1));
- }
-
- lit = (unsigned int)floatFromVal(AOP(right)->aopu.aop_lit);
- lit &= 0xff;
- pic14_emitcode(";","Unrolled 8 X 8 multiplication");
-
- same = pic14_sameRegs(AOP(left), AOP(result));
-
- if(same) {
- switch(lit) {
- case 0:
- emitpcode(POC_CLRF, popGet(AOP(left),0));
- return;
- case 2:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 3:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 4:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 5:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 5*F
- return;
- case 6:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 7:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 5*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 7*F
- return;
- case 8:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 5*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 8*F
- return;
- case 9:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 10:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 5*F
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 11:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 5*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 8*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 11*F
- return;
- case 12:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 13:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 5*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 8*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 13*F
- return;
- case 14:
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 2*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 3*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 5*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 8*F
- emitpcode(POC_ADDFW, popGet(AOP(left),0)); // W = 11*F
- emitpcode(POC_ADDWF, popGet(AOP(left),0)); // F = 14*F
- return;
- case 15:
- temp = popGetTempReg();
- if(!temp) {
- fprintf(stderr,"ERROR: unable to allocate register. %s:%d\n",__FUNCTION__,__LINE__);
- exit(1);
- }
- emitpcode(POC_SWAPFW, popGet(AOP(left),0));
- emitpcode(POC_MOVWF, temp);
- emitpcode(POC_ANDLW, popGetLit(0xf0));
- emitpcode(POC_MOVWF, popGet(AOP(left),0));
- emitpcode(POC_SWAPFW, temp);
- emitpcode(POC_SUBWF, popGet(AOP(left),0));
- popReleaseTempReg(temp);
- return;
- case 16:
- emitpcode(POC_SWAPFW, popGet(AOP(left),0));
- emitpcode(POC_ANDLW, popGetLit(0xf0));
- emitpcode(POC_MOVWF, popGet(AOP(left),0));
- return;
- case 17:
- emitpcode(POC_SWAPFW, popGet(AOP(left),0));
- emitpcode(POC_ANDLW, popGetLit(0xf0));
- emitpcode(POC_ADDWF, popGet(AOP(left),0));
- return;
- case 32:
- emitpcode(POC_SWAPF, popGet(AOP(left),0));
- emitpcode(POC_RLFW, popGet(AOP(left),0));
- emitpcode(POC_ANDLW, popGetLit(0xe0));
- emitpcode(POC_MOVWF, popGet(AOP(left),0));
- return;
- case 64:
- emitpcode(POC_SWAPF, popGet(AOP(left),0));
- emitpcode(POC_RLF, popGet(AOP(left),0));
- emitpcode(POC_RLFW, popGet(AOP(left),0));
- emitpcode(POC_ANDLW, popGetLit(0xc0));
- emitpcode(POC_MOVWF, popGet(AOP(left),0));
- return;
- case 128:
- emitpcode(POC_RRFW, popGet(AOP(left),0));
- emitpcode(POC_CLRF, popGet(AOP(left),0));
- emitpcode(POC_RRF, popGet(AOP(left),0));
- return;
-
- }
- } else {
-
- switch(lit) {
- case 0:
- emitpcode(POC_CLRF, popGet(AOP(result),0));
- emitpcode(POC_CLRF, popCopyReg(result_hi));
- return;
- case 2:
- if (AOP_TYPE(left) != AOP_ACC) /* Check if w is already loaded */
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_MOVWF, popGet(AOP(result),0));
- emitpcode(POC_ADDWF, popGet(AOP(result),0));
- emitpcode(POC_CLRF, popCopyReg(result_hi));
- emitpcode(POC_RLF, popCopyReg(result_hi));
- return;
- case 4:
- case 8:
- if (AOP_TYPE(left) != AOP_ACC) /* Check if w is already loaded */
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_MOVWF, popGet(AOP(result),0));
- emitpcode(POC_CLRF, popCopyReg(result_hi));
- emitpcode(POC_BCF, popCopyReg(&pc_status));
- emitpcode(POC_RLF, popGet(AOP(result),0));
- emitpcode(POC_RLF, popCopyReg(result_hi));
- emitpcode(POC_RLF, popGet(AOP(result),0));
- emitpcode(POC_RLF, popCopyReg(result_hi));
- if (lit >= 8) {
- emitpcode(POC_RLF, popGet(AOP(result),0));
- emitpcode(POC_RLF, popCopyReg(result_hi));
- }
- return;
- }
-
- }
-
- if (AOP_TYPE(left) != AOP_ACC) /* Check if w is already loaded */
- emitpcode(POC_MOVFW, popGet(AOP(left),0));
- emitpcode(POC_CLRF, popGet(AOP(result),0));
- emitpcode(POC_CLRF, popCopyReg(result_hi));