diff --git a/src/main/java/dk/camelot64/kickc/fragment/asm/vwuz1=vwuz1_bor_vbuc1.asm b/src/main/java/dk/camelot64/kickc/fragment/asm/vwuz1=vwuz1_bor_vbuc1.asm new file mode 100644 index 000000000..b011bd21d --- /dev/null +++ b/src/main/java/dk/camelot64/kickc/fragment/asm/vwuz1=vwuz1_bor_vbuc1.asm @@ -0,0 +1,3 @@ +lda #{c1} +ora {z1} +sta {z1} diff --git a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java index b02596638..a7b8a95b6 100644 --- a/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java +++ b/src/main/java/dk/camelot64/kickc/model/VariableReferenceInfos.java @@ -150,5 +150,13 @@ public class VariableReferenceInfos { return constRefStmts.get(constRef); } + /** + * Get all constatns referencing another constant + * @param constRef The constant to look for + * @return All constants that reference the constant in their value + */ + public Collection getConstRefConsts(ConstantRef constRef) { + return constRefConsts.get(constRef); + } } diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index 7bd8fa1e4..af6a272e9 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -117,20 +117,10 @@ public class Pass4CodeGeneration { asm.addLabelDecl(asmName.replace("#", "_").replace("$", "_"), asmConstant); } else if(SymbolType.isInteger(constantVar.getType()) && constantVar.getRef().getScopeDepth()>0) { // Use label for integers referenced in other scope - to allow cross-scope referencing - boolean gen = false; - Collection constRefStatements = program.getVariableReferenceInfos().getConstRefStatements(constantVar.getRef()); - if(constRefStatements!=null) { - for(Integer constRefStmtIdx : constRefStatements) { - ScopeRef refScope = program.getStatementInfos().getBlock(constRefStmtIdx).getScope(); - if(!refScope.equals(scopeRef)) { - // Use label for integers referenced in other scope - to allow cross-scope referencing - asm.addLabelDecl(asmName.replace("#", "_").replace("$", "_"), asmConstant); - gen = true; - break; - } - } - } - if(!gen) { + if(useLabelForConst(scopeRef, constantVar)) { + // Use label for integers referenced in other scope - to allow cross-scope referencing + asm.addLabelDecl(asmName.replace("#", "_").replace("$", "_"), asmConstant); + } else { // Use constant for constant integers not referenced outside scope asm.addConstant(asmName.replace("#", "_").replace("$", "_"), asmConstant); } @@ -143,6 +133,67 @@ public class Pass4CodeGeneration { } } + /** + * Determines whether to use a .label instead of .const for a constant. + * This can be necessary because KickAssembler does not allow constant references between scopes. + * If a constant in one scope is referenced from another scope a .label is generated in stead - to allow the cross-scope reference. + * + * @param scopeRef The current scope + * @param constantVar The constant to examine + * @return true if a .label should be used in the generated ASM + */ + private boolean useLabelForConst(ScopeRef scopeRef, ConstantVar constantVar) { + boolean useLabel = false; + Collection constRefStatements = program.getVariableReferenceInfos().getConstRefStatements(constantVar.getRef()); + if(constRefStatements!=null) { + for(Integer constRefStmtIdx : constRefStatements) { + ScopeRef refScope = program.getStatementInfos().getBlock(constRefStmtIdx).getScope(); + if(!refScope.equals(scopeRef)) { + Statement statement = program.getStatementInfos().getStatement(constRefStmtIdx); + if(statement instanceof StatementPhiBlock) { + // Const reference in PHI block - examine if the only predecessor is current scope + boolean found = false; + for(StatementPhiBlock.PhiVariable phiVariable : ((StatementPhiBlock) statement).getPhiVariables()) { + for(StatementPhiBlock.PhiRValue phiRValue : phiVariable.getValues()) { + if(phiRValue.getrValue().equals(constantVar.getRef())) { + found = true; + // Found the constant + LabelRef pred = phiRValue.getPredecessor(); + ControlFlowBlock predBlock = program.getGraph().getBlock(pred); + ScopeRef predScope = predBlock.getScope(); + if(!predScope.equals(scopeRef)) { + // Scopes in PHI RValue differs from const scope - generate label + useLabel = true; + } + } + } + } + if(!found ) { + // PHI-reference is complex - generate label + program.getLog().append("Warning: Complex PHI-value using constant. Using .label as fallback. "+statement); + useLabel = true; + } + } else { + // Used in a non-PHI statement in another scope - generate label + useLabel = true; + } + } + } + } + Collection constRefConsts = program.getVariableReferenceInfos().getConstRefConsts(constantVar.getRef()); + if(constRefConsts!=null) { + for(ConstantRef constRefConst : constRefConsts) { + ConstantVar refConst = program.getScope().getConstant(constRefConst); + if(!refConst.getScope().getRef().equals(scopeRef)) { + // Used in constant in another scope - generate label + useLabel = true; + break; + } + } + } + return useLabel; + } + /** * Add data directives for constants declarations * diff --git a/src/test/java/dk/camelot64/kickc/test/kc/division.kc b/src/test/java/dk/camelot64/kickc/test/kc/division.kc index eaa009d15..11a0b0725 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/division.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/division.kc @@ -22,7 +22,7 @@ byte divr8u(byte dividend, byte divisor, byte rem) { for( byte i : 0..7) { rem = rem << 1; if( (dividend & $80) != 0 ) { - rem++; + rem = rem | 1; } dividend = dividend << 1; quotient = quotient << 1; @@ -55,7 +55,7 @@ word divr16u(word dividend, word divisor, word rem) { for( byte i : 0..15) { rem = rem << 1; if( (>dividend & $80) != 0 ) { - rem++; + rem = rem | 1; } dividend = dividend << 1; quotient = quotient << 1; diff --git a/src/test/java/dk/camelot64/kickc/test/ref/const-identification.asm b/src/test/java/dk/camelot64/kickc/test/ref/const-identification.asm index 280c2e1e7..b0872cba4 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/const-identification.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/const-identification.asm @@ -19,7 +19,7 @@ main: { jmp b2 } line: { - .label x0 = 0 + .const x0 = 0 .const x1 = $a .label x = 2 lda #x0 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/const-identification.log b/src/test/java/dk/camelot64/kickc/test/ref/const-identification.log index bad6d4c93..121ed73f3 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/const-identification.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/const-identification.log @@ -628,7 +628,7 @@ main: { } //SEG26 line line: { - .label x0 = 0 + .const x0 = 0 .const x1 = $a .label x = 3 //SEG27 [14] if((const byte) line::x0#0>=(const byte) line::x1#0) goto line::@1 [ ] ( main:2::line:11 [ ] ) -- vbuc1_ge_vbuc2_then_la1 @@ -809,7 +809,7 @@ main: { } //SEG26 line line: { - .label x0 = 0 + .const x0 = 0 .const x1 = $a .label x = 2 //SEG27 [14] if((const byte) line::x0#0>=(const byte) line::x1#0) goto line::@1 [ ] ( main:2::line:11 [ ] ) -- vbuc1_ge_vbuc2_then_la1 @@ -1020,7 +1020,7 @@ main: { } //SEG26 line line: { - .label x0 = 0 + .const x0 = 0 .const x1 = $a .label x = 2 //SEG27 [14] if((const byte) line::x0#0>=(const byte) line::x1#0) goto line::@1 [ ] ( main:2::line:11 [ ] ) -- vbuc1_ge_vbuc2_then_la1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/constants.asm b/src/test/java/dk/camelot64/kickc/test/ref/constants.asm index 1c5e821a9..81344548e 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/constants.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/constants.asm @@ -17,11 +17,11 @@ main: { rts } test_sbytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 - .label bf = $ff & -$7f-$7f - .label be = -bd + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 + .const bf = $ff & -$7f-$7f + .const be = -bd lda #0 sta assert_sbyte.c ldx #bb @@ -147,9 +147,9 @@ print_ln: { rts } test_bytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 lda #SCREEN diff --git a/src/test/java/dk/camelot64/kickc/test/ref/constants.log b/src/test/java/dk/camelot64/kickc/test/ref/constants.log index 2265f647b..6daada679 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/constants.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/constants.log @@ -2561,11 +2561,11 @@ main: { } //SEG22 test_sbytes test_sbytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 - .label bf = $ff & -$7f-$7f - .label be = -bd + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 + .const bf = $ff & -$7f-$7f + .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] assert_sbyte_from_test_sbytes: @@ -2841,9 +2841,9 @@ print_ln: { } //SEG112 test_bytes test_bytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 //SEG113 [49] call assert_byte param-assignment [ line_cursor#1 ] ( main:2::test_bytes:7 [ line_cursor#1 ] ) //SEG114 [55] phi from test_bytes to assert_byte [phi:test_bytes->assert_byte] assert_byte_from_test_bytes: @@ -3199,11 +3199,11 @@ main: { } //SEG22 test_sbytes test_sbytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 - .label bf = $ff & -$7f-$7f - .label be = -bd + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 + .const bf = $ff & -$7f-$7f + .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] assert_sbyte_from_test_sbytes: @@ -3469,9 +3469,9 @@ print_ln: { } //SEG112 test_bytes test_bytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 //SEG113 [49] call assert_byte param-assignment [ line_cursor#1 ] ( main:2::test_bytes:7 [ line_cursor#1 ] ) //SEG114 [55] phi from test_bytes to assert_byte [phi:test_bytes->assert_byte] assert_byte_from_test_bytes: @@ -3963,11 +3963,11 @@ main: { } //SEG22 test_sbytes test_sbytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 - .label bf = $ff & -$7f-$7f - .label be = -bd + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 + .const bf = $ff & -$7f-$7f + .const be = -bd //SEG23 [12] call assert_sbyte param-assignment [ line_cursor#1 ] ( main:2::test_sbytes:9 [ line_cursor#1 ] ) //SEG24 [22] phi from test_sbytes to assert_sbyte [phi:test_sbytes->assert_sbyte] //SEG25 [22] phi (signed byte) assert_sbyte::c#5 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:test_sbytes->assert_sbyte#0] -- vbsz1=vbuc1 @@ -4184,9 +4184,9 @@ print_ln: { } //SEG112 test_bytes test_bytes: { - .label bb = 0 - .label bc = bb+2 - .label bd = bc-4 + .const bb = 0 + .const bc = bb+2 + .const bd = bc-4 //SEG113 [49] call assert_byte param-assignment [ line_cursor#1 ] ( main:2::test_bytes:7 [ line_cursor#1 ] ) //SEG114 [55] phi from test_bytes to assert_byte [phi:test_bytes->assert_byte] //SEG115 [55] phi (byte*) line_cursor#50 = (const byte*) SCREEN#0 [phi:test_bytes->assert_byte#0] -- pbuz1=pbuc1 diff --git a/src/test/java/dk/camelot64/kickc/test/ref/linegen.asm b/src/test/java/dk/camelot64/kickc/test/ref/linegen.asm index fe501337b..3675ca9d6 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/linegen.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/linegen.asm @@ -260,10 +260,9 @@ divr16u: { and #$80 cmp #0 beq b2 - inc rem - bne !+ - inc rem+1 - !: + lda #1 + ora rem + sta rem b2: asl dividend rol dividend+1 @@ -295,7 +294,7 @@ divr16u: { rts } div16u: { - .label divisor = lin16u_gen.length-1 + .const divisor = lin16u_gen.length-1 .label return = $d lda #dividend & $80) != 0 ) { - rem++; + rem = rem | 1; } dividend = dividend << 1; quotient = quotient << 1; @@ -174,9 +174,7 @@ signed word div16s(signed word dividend, signed word divisor) { } } -Adding pre/post-modifier (byte) divr8u::rem ← ++ (byte) divr8u::rem Adding pre/post-modifier (byte) divr8u::quotient ← ++ (byte) divr8u::quotient -Adding pre/post-modifier (word) divr16u::rem ← ++ (word) divr16u::rem Adding pre/post-modifier (word) divr16u::quotient ← ++ (word) divr16u::quotient Importing print.kc PARSING src/test/java/dk/camelot64/kickc/test/kc/print.kc @@ -290,22 +288,23 @@ divr8u::@1: (boolean~) divr8u::$2 ← (byte~) divr8u::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0 (boolean~) divr8u::$3 ← ! (boolean~) divr8u::$2 if((boolean~) divr8u::$3) goto divr8u::@2 - (byte) divr8u::rem ← ++ (byte) divr8u::rem + (byte~) divr8u::$4 ← (byte) divr8u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::rem ← (byte~) divr8u::$4 divr8u::@2: - (byte~) divr8u::$4 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::dividend ← (byte~) divr8u::$4 - (byte~) divr8u::$5 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::quotient ← (byte~) divr8u::$5 - (boolean~) divr8u::$6 ← (byte) divr8u::rem >= (byte) divr8u::divisor - (boolean~) divr8u::$7 ← ! (boolean~) divr8u::$6 - if((boolean~) divr8u::$7) goto divr8u::@3 + (byte~) divr8u::$5 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::dividend ← (byte~) divr8u::$5 + (byte~) divr8u::$6 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::quotient ← (byte~) divr8u::$6 + (boolean~) divr8u::$7 ← (byte) divr8u::rem >= (byte) divr8u::divisor + (boolean~) divr8u::$8 ← ! (boolean~) divr8u::$7 + if((boolean~) divr8u::$8) goto divr8u::@3 (byte) divr8u::quotient ← ++ (byte) divr8u::quotient - (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 ← (byte) divr8u::rem - (byte) divr8u::divisor - (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 + (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 ← (byte) divr8u::rem - (byte) divr8u::divisor + (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 divr8u::@3: (byte) divr8u::i ← ++ (byte) divr8u::i - (boolean~) divr8u::$9 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) divr8u::$9) goto divr8u::@1 + (boolean~) divr8u::$10 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) divr8u::$10) goto divr8u::@1 (byte) rem8u ← (byte) divr8u::rem (byte) divr8u::return ← (byte) divr8u::quotient goto divr8u::@return @@ -333,22 +332,23 @@ divr16u::@1: (boolean~) divr16u::$3 ← (byte~) divr16u::$2 != (byte/signed byte/word/signed word/dword/signed dword) 0 (boolean~) divr16u::$4 ← ! (boolean~) divr16u::$3 if((boolean~) divr16u::$4) goto divr16u::@2 - (word) divr16u::rem ← ++ (word) divr16u::rem + (word~) divr16u::$5 ← (word) divr16u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem ← (word~) divr16u::$5 divr16u::@2: - (word~) divr16u::$5 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem >= (word) divr16u::divisor - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem >= (word) divr16u::divisor + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 (word) divr16u::quotient ← ++ (word) divr16u::quotient - (word~) divr16u::$9 ← (word) divr16u::rem - (word) divr16u::divisor - (word) divr16u::rem ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem - (word) divr16u::divisor + (word) divr16u::rem ← (word~) divr16u::$10 divr16u::@3: (byte) divr16u::i ← ++ (byte) divr16u::i - (boolean~) divr16u::$10 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 (word) rem16u ← (word) divr16u::rem (word) divr16u::return ← (word) divr16u::quotient goto divr16u::@return @@ -707,15 +707,16 @@ SYMBOLS (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) (word~) divr16u::$0 (byte~) divr16u::$1 -(boolean~) divr16u::$10 +(word~) divr16u::$10 +(boolean~) divr16u::$11 (byte~) divr16u::$2 (boolean~) divr16u::$3 (boolean~) divr16u::$4 (word~) divr16u::$5 (word~) divr16u::$6 -(boolean~) divr16u::$7 +(word~) divr16u::$7 (boolean~) divr16u::$8 -(word~) divr16u::$9 +(boolean~) divr16u::$9 (label) divr16u::@1 (label) divr16u::@2 (label) divr16u::@3 @@ -729,14 +730,15 @@ SYMBOLS (byte()) divr8u((byte) divr8u::dividend , (byte) divr8u::divisor , (byte) divr8u::rem) (byte~) divr8u::$0 (byte~) divr8u::$1 +(boolean~) divr8u::$10 (boolean~) divr8u::$2 (boolean~) divr8u::$3 (byte~) divr8u::$4 (byte~) divr8u::$5 -(boolean~) divr8u::$6 +(byte~) divr8u::$6 (boolean~) divr8u::$7 -(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 -(boolean~) divr8u::$9 +(boolean~) divr8u::$8 +(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 (label) divr8u::@1 (label) divr8u::@2 (label) divr8u::@3 @@ -892,26 +894,27 @@ divr8u::@1: scope:[divr8u] from divr8u divr8u::@3 if((boolean~) divr8u::$3) goto divr8u::@2 to:divr8u::@4 divr8u::@2: scope:[divr8u] from divr8u::@1 divr8u::@4 - (byte~) divr8u::$4 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::dividend ← (byte~) divr8u::$4 - (byte~) divr8u::$5 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::quotient ← (byte~) divr8u::$5 - (boolean~) divr8u::$6 ← (byte) divr8u::rem >= (byte) divr8u::divisor - (boolean~) divr8u::$7 ← ! (boolean~) divr8u::$6 - if((boolean~) divr8u::$7) goto divr8u::@3 + (byte~) divr8u::$5 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::dividend ← (byte~) divr8u::$5 + (byte~) divr8u::$6 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::quotient ← (byte~) divr8u::$6 + (boolean~) divr8u::$7 ← (byte) divr8u::rem >= (byte) divr8u::divisor + (boolean~) divr8u::$8 ← ! (boolean~) divr8u::$7 + if((boolean~) divr8u::$8) goto divr8u::@3 to:divr8u::@5 divr8u::@4: scope:[divr8u] from divr8u::@1 - (byte) divr8u::rem ← ++ (byte) divr8u::rem + (byte~) divr8u::$4 ← (byte) divr8u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::rem ← (byte~) divr8u::$4 to:divr8u::@2 divr8u::@3: scope:[divr8u] from divr8u::@2 divr8u::@5 (byte) divr8u::i ← ++ (byte) divr8u::i - (boolean~) divr8u::$9 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) divr8u::$9) goto divr8u::@1 + (boolean~) divr8u::$10 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) divr8u::$10) goto divr8u::@1 to:divr8u::@6 divr8u::@5: scope:[divr8u] from divr8u::@2 (byte) divr8u::quotient ← ++ (byte) divr8u::quotient - (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 ← (byte) divr8u::rem - (byte) divr8u::divisor - (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 + (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 ← (byte) divr8u::rem - (byte) divr8u::divisor + (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 to:divr8u::@3 divr8u::@6: scope:[divr8u] from divr8u::@3 (byte) rem8u ← (byte) divr8u::rem @@ -952,26 +955,27 @@ divr16u::@1: scope:[divr16u] from divr16u divr16u::@3 if((boolean~) divr16u::$4) goto divr16u::@2 to:divr16u::@4 divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 - (word~) divr16u::$5 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem >= (word) divr16u::divisor - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem >= (word) divr16u::divisor + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 to:divr16u::@5 divr16u::@4: scope:[divr16u] from divr16u::@1 - (word) divr16u::rem ← ++ (word) divr16u::rem + (word~) divr16u::$5 ← (word) divr16u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem ← (word~) divr16u::$5 to:divr16u::@2 divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (byte) divr16u::i ← ++ (byte) divr16u::i - (boolean~) divr16u::$10 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 to:divr16u::@6 divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::quotient ← ++ (word) divr16u::quotient - (word~) divr16u::$9 ← (word) divr16u::rem - (word) divr16u::divisor - (word) divr16u::rem ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem - (word) divr16u::divisor + (word) divr16u::rem ← (word~) divr16u::$10 to:divr16u::@3 divr16u::@6: scope:[divr16u] from divr16u::@3 (word) rem16u ← (word) divr16u::rem @@ -1362,8 +1366,8 @@ Removing unused procedure div8u Removing unused procedure print_dword Removing unused procedure divr8u Eliminating unused variable (byte) rem8u and assignment [0] (byte) rem8u ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (signed byte) rem8s and assignment [33] (signed byte) rem8s ← (byte/signed byte/word/signed word/dword/signed dword) 0 -Eliminating unused variable (signed word) rem16s and assignment [34] (signed word) rem16s ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (signed byte) rem8s and assignment [34] (signed byte) rem8s ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (signed word) rem16s and assignment [35] (signed word) rem16s ← (byte/signed byte/word/signed word/dword/signed dword) 0 Eliminating unused variable - keeping the call (void~) print_word::$1 Eliminating unused variable - keeping the call (void~) print_word::$3 Eliminating unused variable - keeping the call (void~) print_byte::$1 @@ -1480,13 +1484,13 @@ divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 (word) divr16u::rem#6 ← phi( divr16u::@1/(word) divr16u::rem#1 divr16u::@4/(word) divr16u::rem#2 ) (word) divr16u::quotient#3 ← phi( divr16u::@1/(word) divr16u::quotient#6 divr16u::@4/(word) divr16u::quotient#7 ) (word) divr16u::dividend#4 ← phi( divr16u::@1/(word) divr16u::dividend#3 divr16u::@4/(word) divr16u::dividend#7 ) - (word~) divr16u::$5 ← (word) divr16u::dividend#4 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend#1 ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient#1 ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem#6 >= (word) divr16u::divisor#2 - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend#4 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend#1 ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient#1 ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem#6 >= (word) divr16u::divisor#2 + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 to:divr16u::@5 divr16u::@4: scope:[divr16u] from divr16u::@1 (byte) divr16u::i#6 ← phi( divr16u::@1/(byte) divr16u::i#5 ) @@ -1494,7 +1498,8 @@ divr16u::@4: scope:[divr16u] from divr16u::@1 (word) divr16u::quotient#7 ← phi( divr16u::@1/(word) divr16u::quotient#6 ) (word) divr16u::dividend#7 ← phi( divr16u::@1/(word) divr16u::dividend#3 ) (word) divr16u::rem#7 ← phi( divr16u::@1/(word) divr16u::rem#1 ) - (word) divr16u::rem#2 ← ++ (word) divr16u::rem#7 + (word~) divr16u::$5 ← (word) divr16u::rem#7 | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem#2 ← (word~) divr16u::$5 to:divr16u::@2 divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (word) divr16u::divisor#7 ← phi( divr16u::@2/(word) divr16u::divisor#2 divr16u::@5/(word) divr16u::divisor#3 ) @@ -1503,8 +1508,8 @@ divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (word) divr16u::rem#11 ← phi( divr16u::@2/(word) divr16u::rem#6 divr16u::@5/(word) divr16u::rem#3 ) (byte) divr16u::i#2 ← phi( divr16u::@2/(byte) divr16u::i#3 divr16u::@5/(byte) divr16u::i#4 ) (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2 - (boolean~) divr16u::$10 ← (byte) divr16u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 to:divr16u::@6 divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::dividend#8 ← phi( divr16u::@2/(word) divr16u::dividend#1 ) @@ -1513,8 +1518,8 @@ divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::rem#8 ← phi( divr16u::@2/(word) divr16u::rem#6 ) (word) divr16u::quotient#4 ← phi( divr16u::@2/(word) divr16u::quotient#1 ) (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#4 - (word~) divr16u::$9 ← (word) divr16u::rem#8 - (word) divr16u::divisor#3 - (word) divr16u::rem#3 ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem#8 - (word) divr16u::divisor#3 + (word) divr16u::rem#3 ← (word~) divr16u::$10 to:divr16u::@3 divr16u::@6: scope:[divr16u] from divr16u::@3 (word) divr16u::quotient#5 ← phi( divr16u::@3/(word) divr16u::quotient#8 ) @@ -1906,15 +1911,16 @@ SYMBOL TABLE SSA (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) (word~) divr16u::$0 (byte~) divr16u::$1 -(boolean~) divr16u::$10 +(word~) divr16u::$10 +(boolean~) divr16u::$11 (byte~) divr16u::$2 (boolean~) divr16u::$3 (boolean~) divr16u::$4 (word~) divr16u::$5 (word~) divr16u::$6 -(boolean~) divr16u::$7 +(word~) divr16u::$7 (boolean~) divr16u::$8 -(word~) divr16u::$9 +(boolean~) divr16u::$9 (label) divr16u::@1 (label) divr16u::@2 (label) divr16u::@3 @@ -2176,7 +2182,7 @@ SYMBOL TABLE SSA OPTIMIZING CONTROL FLOW GRAPH Inversing boolean not (boolean~) divr16u::$4 ← (byte~) divr16u::$2 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) divr16u::$3 ← (byte~) divr16u::$2 != (byte/signed byte/word/signed word/dword/signed dword) 0 -Inversing boolean not (boolean~) divr16u::$8 ← (word) divr16u::rem#6 < (word) divr16u::divisor#2 from (boolean~) divr16u::$7 ← (word) divr16u::rem#6 >= (word) divr16u::divisor#2 +Inversing boolean not (boolean~) divr16u::$9 ← (word) divr16u::rem#6 < (word) divr16u::divisor#2 from (boolean~) divr16u::$8 ← (word) divr16u::rem#6 >= (word) divr16u::divisor#2 Succesful SSA optimization Pass2UnaryNotSimplification Not aliassing across scopes: div16u::dividend#1 div16u::dividend#0 Not aliassing across scopes: div16u::divisor#1 div16u::divisor#0 @@ -2242,16 +2248,17 @@ Alias (word) divr16u::return#0 = (word) divr16u::return#4 Alias (word) rem16u#1 = (word) rem16u#11 (word) rem16u#12 (word) rem16u#2 Alias (word) div16u::return#0 = (word~) div16u::$0 (word) div16u::return#3 (word) div16u::return#1 Alias (word) divr16u::rem#1 = (word~) divr16u::$0 (word) divr16u::rem#7 -Alias (word) divr16u::dividend#1 = (word~) divr16u::$5 (word) divr16u::dividend#8 -Alias (word) divr16u::quotient#1 = (word~) divr16u::$6 (word) divr16u::quotient#4 +Alias (word) divr16u::dividend#1 = (word~) divr16u::$6 (word) divr16u::dividend#8 +Alias (word) divr16u::quotient#1 = (word~) divr16u::$7 (word) divr16u::quotient#4 Alias (word) divr16u::dividend#3 = (word) divr16u::dividend#7 Alias (word) divr16u::quotient#6 = (word) divr16u::quotient#7 Alias (word) divr16u::divisor#4 = (word) divr16u::divisor#5 Alias (byte) divr16u::i#5 = (byte) divr16u::i#6 +Alias (word) divr16u::rem#2 = (word~) divr16u::$5 Alias (word) divr16u::rem#6 = (word) divr16u::rem#8 Alias (word) divr16u::divisor#2 = (word) divr16u::divisor#3 Alias (byte) divr16u::i#3 = (byte) divr16u::i#4 -Alias (word) divr16u::rem#3 = (word~) divr16u::$9 +Alias (word) divr16u::rem#3 = (word~) divr16u::$10 Alias (word) divr16u::rem#11 = (word) divr16u::rem#9 Alias (word) divr16u::return#1 = (word) divr16u::quotient#5 (word) divr16u::quotient#8 (word) divr16u::return#5 (word) divr16u::return#2 Alias (word) rem16u#13 = (word) rem16u#3 (word) rem16u#4 @@ -2479,8 +2486,8 @@ Redundant Phi (byte*) line_cursor#16 (byte*) line_cursor#14 Redundant Phi (byte*) char_cursor#21 (byte*) char_cursor#19 Succesful SSA optimization Pass2RedundantPhiElimination Simple Condition (boolean~) divr16u::$4 if((byte~) divr16u::$2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16u::@2 -Simple Condition (boolean~) divr16u::$8 if((word) divr16u::rem#6<(word) divr16u::divisor#6) goto divr16u::@3 -Simple Condition (boolean~) divr16u::$10 if((byte) divr16u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto divr16u::@1 +Simple Condition (boolean~) divr16u::$9 if((word) divr16u::rem#6<(word) divr16u::divisor#6) goto divr16u::@3 +Simple Condition (boolean~) divr16u::$11 if((byte) divr16u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto divr16u::@1 Simple Condition (boolean~) print_str::$0 if(*((byte*) print_str::str#2)!=(byte) '@') goto print_str::@2 Simple Condition (boolean~) print_ln::$1 if((byte*) line_cursor#1<(byte*) char_cursor#11) goto print_ln::@1 Simple Condition (boolean~) print_cls::$1 if((byte*) print_cls::sc#1!=(byte*~) print_cls::$0) goto print_cls::@1 @@ -2924,7 +2931,7 @@ divr16u::@1: scope:[divr16u] from divr16u divr16u::@3 [78] if((byte~) divr16u::$2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16u::@2 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ) to:divr16u::@4 divr16u::@4: scope:[divr16u] from divr16u::@1 - [79] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) + [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) to:divr16u::@2 divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 [80] (word) divr16u::rem#6 ← phi( divr16u::@1/(word) divr16u::rem#1 divr16u::@4/(word) divr16u::rem#2 ) [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#6 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#6 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#6 ] ) @@ -3797,11 +3804,10 @@ divr16u: { jmp b4 //SEG166 divr16u::@4 b4: - //SEG167 [79] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG167 [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG168 [80] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] b2_from_b1: b2_from_b4: @@ -3870,7 +3876,7 @@ divr16u: { } //SEG187 div16u div16u: { - .label divisor = lin16u_gen.length-1 + .const divisor = lin16u_gen.length-1 .label return = $36 .label return_2 = $22 //SEG188 [92] call divr16u param-assignment [ rem16u#13 divr16u::return#1 ] ( main:2::lin16u_gen:5::div16u:57 [ rem16u#13 divr16u::return#1 ] ) @@ -3943,6 +3949,7 @@ Statement [71] if((word) lin16u_gen::i#1<(const word) lin16u_gen::length#0) goto Statement [76] (byte~) divr16u::$1 ← > (word) divr16u::dividend#3 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:29 [ divr16u::i#2 divr16u::i#1 ] Statement [77] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte/word/signed word/dword/signed dword) 128 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ) always clobbers reg byte a +Statement [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) always clobbers reg byte a Statement [83] if((word) divr16u::rem#6<(word) divr16u::divisor#6) goto divr16u::@3 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] ) always clobbers reg byte a Statement [85] (word) divr16u::rem#3 ← (word) divr16u::rem#6 - (word) divr16u::divisor#6 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ) always clobbers reg byte a Statement [89] (word) rem16u#13 ← (word) divr16u::rem#11 [ rem16u#13 divr16u::return#1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 rem16u#13 divr16u::return#1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ rem16u#13 divr16u::return#1 ] ) always clobbers reg byte a @@ -3974,6 +3981,7 @@ Statement [69] (word*) lin16u_gen::lintab#1 ← (word*) lin16u_gen::lintab#2 + ( Statement [71] if((word) lin16u_gen::i#1<(const word) lin16u_gen::length#0) goto lin16u_gen::@1 [ lin16u_gen::step#0 lin16u_gen::val#1 lin16u_gen::lintab#1 lin16u_gen::i#1 ] ( main:2::lin16u_gen:5 [ lin16u_gen::step#0 lin16u_gen::val#1 lin16u_gen::lintab#1 lin16u_gen::i#1 ] ) always clobbers reg byte a Statement [76] (byte~) divr16u::$1 ← > (word) divr16u::dividend#3 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ) always clobbers reg byte a Statement [77] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte/word/signed word/dword/signed dword) 128 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ) always clobbers reg byte a +Statement [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) always clobbers reg byte a Statement [83] if((word) divr16u::rem#6<(word) divr16u::divisor#6) goto divr16u::@3 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::rem#6 divr16u::quotient#1 ] ) always clobbers reg byte a Statement [85] (word) divr16u::rem#3 ← (word) divr16u::rem#6 - (word) divr16u::divisor#6 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ) always clobbers reg byte a Statement [89] (word) rem16u#13 ← (word) divr16u::rem#11 [ rem16u#13 divr16u::return#1 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 rem16u#13 divr16u::return#1 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ rem16u#13 divr16u::return#1 ] ) always clobbers reg byte a @@ -4022,19 +4030,19 @@ Uplift Scope [div16u] 4: zp ZP_WORD:34 [ div16u::return#2 ] 1.33: zp ZP_WORD:54 Uplift Scope [print_word] 5: zp ZP_WORD:30 [ print_word::w#0 ] Uplift Scope [print_ln] -Uplifting [] best 16755 combination zp ZP_WORD:3 [ line_cursor#9 line_cursor#19 line_cursor#1 ] zp ZP_WORD:7 [ char_cursor#32 char_cursor#45 char_cursor#47 char_cursor#51 char_cursor#2 char_cursor#11 char_cursor#1 ] zp ZP_WORD:50 [ rem16u#13 ] -Uplifting [print_str] best 16755 combination zp ZP_WORD:9 [ print_str::str#2 print_str::str#0 ] -Uplifting [divr16u] best 16565 combination zp ZP_WORD:23 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#1 divr16u::rem#2 divr16u::rem#3 ] zp ZP_WORD:27 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:25 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#1 ] zp ZP_WORD:38 [ divr16u::return#3 ] zp ZP_WORD:52 [ divr16u::return#0 ] zp ZP_WORD:21 [ divr16u::divisor#6 ] -Uplifting [lin16u_gen] best 16565 combination zp ZP_WORD:46 [ lin16u_gen::$5 ] zp ZP_WORD:19 [ lin16u_gen::i#2 lin16u_gen::i#1 ] zp ZP_DWORD:13 [ lin16u_gen::val#2 lin16u_gen::val#1 ] zp ZP_WORD:17 [ lin16u_gen::lintab#2 lin16u_gen::lintab#1 ] zp ZP_WORD:40 [ lin16u_gen::stepf#0 ] zp ZP_DWORD:42 [ lin16u_gen::step#0 ] zp ZP_WORD:36 [ lin16u_gen::stepi#0 ] -Uplifting [print_byte] best 16523 combination reg byte x [ print_byte::b#3 print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [print_cls] best 16523 combination zp ZP_WORD:11 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [main] best 16523 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] -Uplifting [print_char] best 16514 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] -Uplifting [div16u] best 16514 combination zp ZP_WORD:34 [ div16u::return#2 ] zp ZP_WORD:54 [ div16u::return#0 ] -Uplifting [print_word] best 16514 combination zp ZP_WORD:30 [ print_word::w#0 ] -Uplifting [print_ln] best 16514 combination +Uplifting [] best 16710 combination zp ZP_WORD:3 [ line_cursor#9 line_cursor#19 line_cursor#1 ] zp ZP_WORD:7 [ char_cursor#32 char_cursor#45 char_cursor#47 char_cursor#51 char_cursor#2 char_cursor#11 char_cursor#1 ] zp ZP_WORD:50 [ rem16u#13 ] +Uplifting [print_str] best 16710 combination zp ZP_WORD:9 [ print_str::str#2 print_str::str#0 ] +Uplifting [divr16u] best 16520 combination zp ZP_WORD:23 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#1 divr16u::rem#2 divr16u::rem#3 ] zp ZP_WORD:27 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:25 [ divr16u::dividend#3 divr16u::dividend#5 divr16u::dividend#1 ] zp ZP_WORD:38 [ divr16u::return#3 ] zp ZP_WORD:52 [ divr16u::return#0 ] zp ZP_WORD:21 [ divr16u::divisor#6 ] +Uplifting [lin16u_gen] best 16520 combination zp ZP_WORD:46 [ lin16u_gen::$5 ] zp ZP_WORD:19 [ lin16u_gen::i#2 lin16u_gen::i#1 ] zp ZP_DWORD:13 [ lin16u_gen::val#2 lin16u_gen::val#1 ] zp ZP_WORD:17 [ lin16u_gen::lintab#2 lin16u_gen::lintab#1 ] zp ZP_WORD:40 [ lin16u_gen::stepf#0 ] zp ZP_DWORD:42 [ lin16u_gen::step#0 ] zp ZP_WORD:36 [ lin16u_gen::stepi#0 ] +Uplifting [print_byte] best 16478 combination reg byte x [ print_byte::b#3 print_byte::b#2 print_byte::b#0 print_byte::b#1 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [print_cls] best 16478 combination zp ZP_WORD:11 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [main] best 16478 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplifting [print_char] best 16469 combination reg byte a [ print_char::ch#2 print_char::ch#0 print_char::ch#1 ] +Uplifting [div16u] best 16469 combination zp ZP_WORD:34 [ div16u::return#2 ] zp ZP_WORD:54 [ div16u::return#0 ] +Uplifting [print_word] best 16469 combination zp ZP_WORD:30 [ print_word::w#0 ] +Uplifting [print_ln] best 16469 combination Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::i#2 main::i#1 ] -Uplifting [main] best 16514 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] +Uplifting [main] best 16469 combination zp ZP_BYTE:2 [ main::i#2 main::i#1 ] Coalescing zero page register [ zp ZP_WORD:23 [ divr16u::rem#5 divr16u::rem#10 divr16u::rem#4 divr16u::rem#11 divr16u::rem#6 divr16u::rem#1 divr16u::rem#2 divr16u::rem#3 ] ] with [ zp ZP_WORD:50 [ rem16u#13 ] ] Coalescing zero page register [ zp ZP_WORD:27 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 ] ] with [ zp ZP_WORD:38 [ divr16u::return#3 ] ] Coalescing zero page register [ zp ZP_WORD:27 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 divr16u::return#3 ] ] with [ zp ZP_WORD:40 [ lin16u_gen::stepf#0 ] ] @@ -4574,11 +4582,10 @@ divr16u: { jmp b4 //SEG166 divr16u::@4 b4: - //SEG167 [79] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG167 [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG168 [80] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] b2_from_b1: b2_from_b4: @@ -4643,7 +4650,7 @@ divr16u: { } //SEG187 div16u div16u: { - .label divisor = lin16u_gen.length-1 + .const divisor = lin16u_gen.length-1 .label return = $d //SEG188 [92] call divr16u param-assignment [ rem16u#13 divr16u::return#1 ] ( main:2::lin16u_gen:5::div16u:57 [ rem16u#13 divr16u::return#1 ] ) //SEG189 [73] phi from div16u to divr16u [phi:div16u->divr16u] @@ -4965,7 +4972,7 @@ reg byte a [ divr16u::$2 ] FINAL ASSEMBLER -Score: 14401 +Score: 14356 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -5400,11 +5407,10 @@ divr16u: { cmp #0 beq b2 //SEG166 divr16u::@4 - //SEG167 [79] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG167 [79] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::lin16u_gen:5::divr16u:61 [ lin16u_gen::stepi#0 divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::lin16u_gen:5::div16u:57::divr16u:92 [ divr16u::divisor#6 divr16u::dividend#3 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG168 [80] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] //SEG169 [80] phi (word) divr16u::rem#6 = (word) divr16u::rem#1 [phi:divr16u::@1/divr16u::@4->divr16u::@2#0] -- register_copy //SEG170 divr16u::@2 @@ -5457,7 +5463,7 @@ divr16u: { } //SEG187 div16u div16u: { - .label divisor = lin16u_gen.length-1 + .const divisor = lin16u_gen.length-1 .label return = $d //SEG188 [92] call divr16u param-assignment [ rem16u#13 divr16u::return#1 ] ( main:2::lin16u_gen:5::div16u:57 [ rem16u#13 divr16u::return#1 ] ) //SEG189 [73] phi from div16u to divr16u [phi:div16u->divr16u] diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm b/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm index 00adba9f6..b84e6e032 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.asm @@ -288,10 +288,9 @@ divr16u: { and #$80 cmp #0 beq b2 - inc rem - bne !+ - inc rem+1 - !: + lda #1 + ora rem + sta rem b2: asl dividend rol dividend+1 @@ -465,7 +464,9 @@ divr8u: { and dividend cmp #0 beq b2 - inc rem + lda #1 + ora rem + sta rem b2: asl dividend txa diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.cfg b/src/test/java/dk/camelot64/kickc/test/ref/test-division.cfg index 9dae35fc1..f60fa5e91 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.cfg +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.cfg @@ -246,7 +246,7 @@ divr16u::@1: scope:[divr16u] from divr16u divr16u::@3 [118] if((byte~) divr16u::$2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16u::@2 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ) to:divr16u::@4 divr16u::@4: scope:[divr16u] from divr16u::@1 - [119] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) + [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) to:divr16u::@2 divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 [120] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#1 divr16u::@4/(word) divr16u::rem#2 ) [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] ) @@ -418,7 +418,7 @@ divr8u::@1: scope:[divr8u] from divr8u divr8u::@3 [202] if((byte~) divr8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr8u::@2 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] ) to:divr8u::@4 divr8u::@4: scope:[divr8u] from divr8u::@1 - [203] (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) + [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) to:divr8u::@2 divr8u::@2: scope:[divr8u] from divr8u::@1 divr8u::@4 [204] (byte) divr8u::rem#5 ← phi( divr8u::@1/(byte) divr8u::rem#1 divr8u::@4/(byte) divr8u::rem#2 ) [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] ) diff --git a/src/test/java/dk/camelot64/kickc/test/ref/test-division.log b/src/test/java/dk/camelot64/kickc/test/ref/test-division.log index 2e6e6dcfa..d3163c27b 100644 --- a/src/test/java/dk/camelot64/kickc/test/ref/test-division.log +++ b/src/test/java/dk/camelot64/kickc/test/ref/test-division.log @@ -200,7 +200,7 @@ byte divr8u(byte dividend, byte divisor, byte rem) { for( byte i : 0..7) { rem = rem << 1; if( (dividend & $80) != 0 ) { - rem++; + rem = rem | 1; } dividend = dividend << 1; quotient = quotient << 1; @@ -233,7 +233,7 @@ word divr16u(word dividend, word divisor, word rem) { for( byte i : 0..15) { rem = rem << 1; if( (>dividend & $80) != 0 ) { - rem++; + rem = rem | 1; } dividend = dividend << 1; quotient = quotient << 1; @@ -316,9 +316,7 @@ signed word div16s(signed word dividend, signed word divisor) { } } -Adding pre/post-modifier (byte) divr8u::rem ← ++ (byte) divr8u::rem Adding pre/post-modifier (byte) divr8u::quotient ← ++ (byte) divr8u::quotient -Adding pre/post-modifier (word) divr16u::rem ← ++ (word) divr16u::rem Adding pre/post-modifier (word) divr16u::quotient ← ++ (word) divr16u::quotient STATEMENTS @@ -451,22 +449,23 @@ divr8u::@1: (boolean~) divr8u::$2 ← (byte~) divr8u::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0 (boolean~) divr8u::$3 ← ! (boolean~) divr8u::$2 if((boolean~) divr8u::$3) goto divr8u::@2 - (byte) divr8u::rem ← ++ (byte) divr8u::rem + (byte~) divr8u::$4 ← (byte) divr8u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::rem ← (byte~) divr8u::$4 divr8u::@2: - (byte~) divr8u::$4 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::dividend ← (byte~) divr8u::$4 - (byte~) divr8u::$5 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::quotient ← (byte~) divr8u::$5 - (boolean~) divr8u::$6 ← (byte) divr8u::rem >= (byte) divr8u::divisor - (boolean~) divr8u::$7 ← ! (boolean~) divr8u::$6 - if((boolean~) divr8u::$7) goto divr8u::@3 + (byte~) divr8u::$5 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::dividend ← (byte~) divr8u::$5 + (byte~) divr8u::$6 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::quotient ← (byte~) divr8u::$6 + (boolean~) divr8u::$7 ← (byte) divr8u::rem >= (byte) divr8u::divisor + (boolean~) divr8u::$8 ← ! (boolean~) divr8u::$7 + if((boolean~) divr8u::$8) goto divr8u::@3 (byte) divr8u::quotient ← ++ (byte) divr8u::quotient - (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 ← (byte) divr8u::rem - (byte) divr8u::divisor - (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 + (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 ← (byte) divr8u::rem - (byte) divr8u::divisor + (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 divr8u::@3: (byte) divr8u::i ← ++ (byte) divr8u::i - (boolean~) divr8u::$9 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) divr8u::$9) goto divr8u::@1 + (boolean~) divr8u::$10 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) divr8u::$10) goto divr8u::@1 (byte) rem8u ← (byte) divr8u::rem (byte) divr8u::return ← (byte) divr8u::quotient goto divr8u::@return @@ -494,22 +493,23 @@ divr16u::@1: (boolean~) divr16u::$3 ← (byte~) divr16u::$2 != (byte/signed byte/word/signed word/dword/signed dword) 0 (boolean~) divr16u::$4 ← ! (boolean~) divr16u::$3 if((boolean~) divr16u::$4) goto divr16u::@2 - (word) divr16u::rem ← ++ (word) divr16u::rem + (word~) divr16u::$5 ← (word) divr16u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem ← (word~) divr16u::$5 divr16u::@2: - (word~) divr16u::$5 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem >= (word) divr16u::divisor - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem >= (word) divr16u::divisor + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 (word) divr16u::quotient ← ++ (word) divr16u::quotient - (word~) divr16u::$9 ← (word) divr16u::rem - (word) divr16u::divisor - (word) divr16u::rem ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem - (word) divr16u::divisor + (word) divr16u::rem ← (word~) divr16u::$10 divr16u::@3: (byte) divr16u::i ← ++ (byte) divr16u::i - (boolean~) divr16u::$10 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 (word) rem16u ← (word) divr16u::rem (word) divr16u::return ← (word) divr16u::quotient goto divr16u::@return @@ -829,15 +829,16 @@ SYMBOLS (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) (word~) divr16u::$0 (byte~) divr16u::$1 -(boolean~) divr16u::$10 +(word~) divr16u::$10 +(boolean~) divr16u::$11 (byte~) divr16u::$2 (boolean~) divr16u::$3 (boolean~) divr16u::$4 (word~) divr16u::$5 (word~) divr16u::$6 -(boolean~) divr16u::$7 +(word~) divr16u::$7 (boolean~) divr16u::$8 -(word~) divr16u::$9 +(boolean~) divr16u::$9 (label) divr16u::@1 (label) divr16u::@2 (label) divr16u::@3 @@ -851,14 +852,15 @@ SYMBOLS (byte()) divr8u((byte) divr8u::dividend , (byte) divr8u::divisor , (byte) divr8u::rem) (byte~) divr8u::$0 (byte~) divr8u::$1 +(boolean~) divr8u::$10 (boolean~) divr8u::$2 (boolean~) divr8u::$3 (byte~) divr8u::$4 (byte~) divr8u::$5 -(boolean~) divr8u::$6 +(byte~) divr8u::$6 (boolean~) divr8u::$7 -(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 -(boolean~) divr8u::$9 +(boolean~) divr8u::$8 +(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 (label) divr8u::@1 (label) divr8u::@2 (label) divr8u::@3 @@ -1236,26 +1238,27 @@ divr8u::@1: scope:[divr8u] from divr8u divr8u::@3 if((boolean~) divr8u::$3) goto divr8u::@2 to:divr8u::@4 divr8u::@2: scope:[divr8u] from divr8u::@1 divr8u::@4 - (byte~) divr8u::$4 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::dividend ← (byte~) divr8u::$4 - (byte~) divr8u::$5 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::quotient ← (byte~) divr8u::$5 - (boolean~) divr8u::$6 ← (byte) divr8u::rem >= (byte) divr8u::divisor - (boolean~) divr8u::$7 ← ! (boolean~) divr8u::$6 - if((boolean~) divr8u::$7) goto divr8u::@3 + (byte~) divr8u::$5 ← (byte) divr8u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::dividend ← (byte~) divr8u::$5 + (byte~) divr8u::$6 ← (byte) divr8u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::quotient ← (byte~) divr8u::$6 + (boolean~) divr8u::$7 ← (byte) divr8u::rem >= (byte) divr8u::divisor + (boolean~) divr8u::$8 ← ! (boolean~) divr8u::$7 + if((boolean~) divr8u::$8) goto divr8u::@3 to:divr8u::@5 divr8u::@4: scope:[divr8u] from divr8u::@1 - (byte) divr8u::rem ← ++ (byte) divr8u::rem + (byte~) divr8u::$4 ← (byte) divr8u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::rem ← (byte~) divr8u::$4 to:divr8u::@2 divr8u::@3: scope:[divr8u] from divr8u::@2 divr8u::@5 (byte) divr8u::i ← ++ (byte) divr8u::i - (boolean~) divr8u::$9 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) divr8u::$9) goto divr8u::@1 + (boolean~) divr8u::$10 ← (byte) divr8u::i != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) divr8u::$10) goto divr8u::@1 to:divr8u::@6 divr8u::@5: scope:[divr8u] from divr8u::@2 (byte) divr8u::quotient ← ++ (byte) divr8u::quotient - (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 ← (byte) divr8u::rem - (byte) divr8u::divisor - (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 + (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 ← (byte) divr8u::rem - (byte) divr8u::divisor + (byte) divr8u::rem ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 to:divr8u::@3 divr8u::@6: scope:[divr8u] from divr8u::@3 (byte) rem8u ← (byte) divr8u::rem @@ -1296,26 +1299,27 @@ divr16u::@1: scope:[divr16u] from divr16u divr16u::@3 if((boolean~) divr16u::$4) goto divr16u::@2 to:divr16u::@4 divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 - (word~) divr16u::$5 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem >= (word) divr16u::divisor - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem >= (word) divr16u::divisor + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 to:divr16u::@5 divr16u::@4: scope:[divr16u] from divr16u::@1 - (word) divr16u::rem ← ++ (word) divr16u::rem + (word~) divr16u::$5 ← (word) divr16u::rem | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem ← (word~) divr16u::$5 to:divr16u::@2 divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (byte) divr16u::i ← ++ (byte) divr16u::i - (boolean~) divr16u::$10 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 to:divr16u::@6 divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::quotient ← ++ (word) divr16u::quotient - (word~) divr16u::$9 ← (word) divr16u::rem - (word) divr16u::divisor - (word) divr16u::rem ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem - (word) divr16u::divisor + (word) divr16u::rem ← (word~) divr16u::$10 to:divr16u::@3 divr16u::@6: scope:[divr16u] from divr16u::@3 (word) rem16u ← (word) divr16u::rem @@ -1636,7 +1640,7 @@ Eliminating unused variable - keeping the call (void~) main::$1 Eliminating unused variable - keeping the call (void~) main::$2 Eliminating unused variable - keeping the call (void~) main::$3 Eliminating unused variable - keeping the call (void~) main::$4 -Eliminating unused variable (byte) test_8u::rem and assignment [207] (byte) test_8u::rem ← (byte/signed byte/word/signed word/dword/signed dword) 0 +Eliminating unused variable (byte) test_8u::rem and assignment [209] (byte) test_8u::rem ← (byte/signed byte/word/signed word/dword/signed dword) 0 Eliminating unused variable - keeping the call (void~) test_8u::$1 Eliminating unused variable - keeping the call (void~) test_8u::$2 Eliminating unused variable - keeping the call (void~) test_8u::$3 @@ -2034,13 +2038,13 @@ divr8u::@2: scope:[divr8u] from divr8u::@1 divr8u::@4 (byte) divr8u::rem#5 ← phi( divr8u::@1/(byte) divr8u::rem#1 divr8u::@4/(byte) divr8u::rem#2 ) (byte) divr8u::quotient#3 ← phi( divr8u::@1/(byte) divr8u::quotient#6 divr8u::@4/(byte) divr8u::quotient#7 ) (byte) divr8u::dividend#3 ← phi( divr8u::@1/(byte) divr8u::dividend#2 divr8u::@4/(byte) divr8u::dividend#6 ) - (byte~) divr8u::$4 ← (byte) divr8u::dividend#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::dividend#1 ← (byte~) divr8u::$4 - (byte~) divr8u::$5 ← (byte) divr8u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) divr8u::quotient#1 ← (byte~) divr8u::$5 - (boolean~) divr8u::$6 ← (byte) divr8u::rem#5 >= (byte) divr8u::divisor#1 - (boolean~) divr8u::$7 ← ! (boolean~) divr8u::$6 - if((boolean~) divr8u::$7) goto divr8u::@3 + (byte~) divr8u::$5 ← (byte) divr8u::dividend#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::dividend#1 ← (byte~) divr8u::$5 + (byte~) divr8u::$6 ← (byte) divr8u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::quotient#1 ← (byte~) divr8u::$6 + (boolean~) divr8u::$7 ← (byte) divr8u::rem#5 >= (byte) divr8u::divisor#1 + (boolean~) divr8u::$8 ← ! (boolean~) divr8u::$7 + if((boolean~) divr8u::$8) goto divr8u::@3 to:divr8u::@5 divr8u::@4: scope:[divr8u] from divr8u::@1 (byte) divr8u::i#6 ← phi( divr8u::@1/(byte) divr8u::i#5 ) @@ -2048,7 +2052,8 @@ divr8u::@4: scope:[divr8u] from divr8u::@1 (byte) divr8u::quotient#7 ← phi( divr8u::@1/(byte) divr8u::quotient#6 ) (byte) divr8u::dividend#6 ← phi( divr8u::@1/(byte) divr8u::dividend#2 ) (byte) divr8u::rem#6 ← phi( divr8u::@1/(byte) divr8u::rem#1 ) - (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#6 + (byte~) divr8u::$4 ← (byte) divr8u::rem#6 | (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) divr8u::rem#2 ← (byte~) divr8u::$4 to:divr8u::@2 divr8u::@3: scope:[divr8u] from divr8u::@2 divr8u::@5 (byte) divr8u::divisor#6 ← phi( divr8u::@2/(byte) divr8u::divisor#1 divr8u::@5/(byte) divr8u::divisor#2 ) @@ -2057,8 +2062,8 @@ divr8u::@3: scope:[divr8u] from divr8u::@2 divr8u::@5 (byte) divr8u::rem#10 ← phi( divr8u::@2/(byte) divr8u::rem#5 divr8u::@5/(byte) divr8u::rem#3 ) (byte) divr8u::i#2 ← phi( divr8u::@2/(byte) divr8u::i#3 divr8u::@5/(byte) divr8u::i#4 ) (byte) divr8u::i#1 ← ++ (byte) divr8u::i#2 - (boolean~) divr8u::$9 ← (byte) divr8u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 8 - if((boolean~) divr8u::$9) goto divr8u::@1 + (boolean~) divr8u::$10 ← (byte) divr8u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 8 + if((boolean~) divr8u::$10) goto divr8u::@1 to:divr8u::@6 divr8u::@5: scope:[divr8u] from divr8u::@2 (byte) divr8u::dividend#7 ← phi( divr8u::@2/(byte) divr8u::dividend#1 ) @@ -2067,8 +2072,8 @@ divr8u::@5: scope:[divr8u] from divr8u::@2 (byte) divr8u::rem#7 ← phi( divr8u::@2/(byte) divr8u::rem#5 ) (byte) divr8u::quotient#4 ← phi( divr8u::@2/(byte) divr8u::quotient#1 ) (byte) divr8u::quotient#2 ← ++ (byte) divr8u::quotient#4 - (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 ← (byte) divr8u::rem#7 - (byte) divr8u::divisor#2 - (byte) divr8u::rem#3 ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 + (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 ← (byte) divr8u::rem#7 - (byte) divr8u::divisor#2 + (byte) divr8u::rem#3 ← (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 to:divr8u::@3 divr8u::@6: scope:[divr8u] from divr8u::@3 (byte) divr8u::quotient#5 ← phi( divr8u::@3/(byte) divr8u::quotient#8 ) @@ -2140,13 +2145,13 @@ divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#1 divr16u::@4/(word) divr16u::rem#2 ) (word) divr16u::quotient#3 ← phi( divr16u::@1/(word) divr16u::quotient#6 divr16u::@4/(word) divr16u::quotient#7 ) (word) divr16u::dividend#3 ← phi( divr16u::@1/(word) divr16u::dividend#2 divr16u::@4/(word) divr16u::dividend#6 ) - (word~) divr16u::$5 ← (word) divr16u::dividend#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::dividend#1 ← (word~) divr16u::$5 - (word~) divr16u::$6 ← (word) divr16u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (word) divr16u::quotient#1 ← (word~) divr16u::$6 - (boolean~) divr16u::$7 ← (word) divr16u::rem#5 >= (word) divr16u::divisor#1 - (boolean~) divr16u::$8 ← ! (boolean~) divr16u::$7 - if((boolean~) divr16u::$8) goto divr16u::@3 + (word~) divr16u::$6 ← (word) divr16u::dividend#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::dividend#1 ← (word~) divr16u::$6 + (word~) divr16u::$7 ← (word) divr16u::quotient#3 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::quotient#1 ← (word~) divr16u::$7 + (boolean~) divr16u::$8 ← (word) divr16u::rem#5 >= (word) divr16u::divisor#1 + (boolean~) divr16u::$9 ← ! (boolean~) divr16u::$8 + if((boolean~) divr16u::$9) goto divr16u::@3 to:divr16u::@5 divr16u::@4: scope:[divr16u] from divr16u::@1 (byte) divr16u::i#6 ← phi( divr16u::@1/(byte) divr16u::i#5 ) @@ -2154,7 +2159,8 @@ divr16u::@4: scope:[divr16u] from divr16u::@1 (word) divr16u::quotient#7 ← phi( divr16u::@1/(word) divr16u::quotient#6 ) (word) divr16u::dividend#6 ← phi( divr16u::@1/(word) divr16u::dividend#2 ) (word) divr16u::rem#6 ← phi( divr16u::@1/(word) divr16u::rem#1 ) - (word) divr16u::rem#2 ← ++ (word) divr16u::rem#6 + (word~) divr16u::$5 ← (word) divr16u::rem#6 | (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) divr16u::rem#2 ← (word~) divr16u::$5 to:divr16u::@2 divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (word) divr16u::divisor#6 ← phi( divr16u::@2/(word) divr16u::divisor#1 divr16u::@5/(word) divr16u::divisor#2 ) @@ -2163,8 +2169,8 @@ divr16u::@3: scope:[divr16u] from divr16u::@2 divr16u::@5 (word) divr16u::rem#10 ← phi( divr16u::@2/(word) divr16u::rem#5 divr16u::@5/(word) divr16u::rem#3 ) (byte) divr16u::i#2 ← phi( divr16u::@2/(byte) divr16u::i#3 divr16u::@5/(byte) divr16u::i#4 ) (byte) divr16u::i#1 ← ++ (byte) divr16u::i#2 - (boolean~) divr16u::$10 ← (byte) divr16u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 16 - if((boolean~) divr16u::$10) goto divr16u::@1 + (boolean~) divr16u::$11 ← (byte) divr16u::i#1 != (byte/signed byte/word/signed word/dword/signed dword) 16 + if((boolean~) divr16u::$11) goto divr16u::@1 to:divr16u::@6 divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::dividend#7 ← phi( divr16u::@2/(word) divr16u::dividend#1 ) @@ -2173,8 +2179,8 @@ divr16u::@5: scope:[divr16u] from divr16u::@2 (word) divr16u::rem#7 ← phi( divr16u::@2/(word) divr16u::rem#5 ) (word) divr16u::quotient#4 ← phi( divr16u::@2/(word) divr16u::quotient#1 ) (word) divr16u::quotient#2 ← ++ (word) divr16u::quotient#4 - (word~) divr16u::$9 ← (word) divr16u::rem#7 - (word) divr16u::divisor#2 - (word) divr16u::rem#3 ← (word~) divr16u::$9 + (word~) divr16u::$10 ← (word) divr16u::rem#7 - (word) divr16u::divisor#2 + (word) divr16u::rem#3 ← (word~) divr16u::$10 to:divr16u::@3 divr16u::@6: scope:[divr16u] from divr16u::@3 (word) divr16u::quotient#5 ← phi( divr16u::@3/(word) divr16u::quotient#8 ) @@ -3415,15 +3421,16 @@ SYMBOL TABLE SSA (word()) divr16u((word) divr16u::dividend , (word) divr16u::divisor , (word) divr16u::rem) (word~) divr16u::$0 (byte~) divr16u::$1 -(boolean~) divr16u::$10 +(word~) divr16u::$10 +(boolean~) divr16u::$11 (byte~) divr16u::$2 (boolean~) divr16u::$3 (boolean~) divr16u::$4 (word~) divr16u::$5 (word~) divr16u::$6 -(boolean~) divr16u::$7 +(word~) divr16u::$7 (boolean~) divr16u::$8 -(word~) divr16u::$9 +(boolean~) divr16u::$9 (label) divr16u::@1 (label) divr16u::@2 (label) divr16u::@3 @@ -3487,14 +3494,15 @@ SYMBOL TABLE SSA (byte()) divr8u((byte) divr8u::dividend , (byte) divr8u::divisor , (byte) divr8u::rem) (byte~) divr8u::$0 (byte~) divr8u::$1 +(boolean~) divr8u::$10 (boolean~) divr8u::$2 (boolean~) divr8u::$3 (byte~) divr8u::$4 (byte~) divr8u::$5 -(boolean~) divr8u::$6 +(byte~) divr8u::$6 (boolean~) divr8u::$7 -(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 -(boolean~) divr8u::$9 +(boolean~) divr8u::$8 +(byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 (label) divr8u::@1 (label) divr8u::@2 (label) divr8u::@3 @@ -4175,9 +4183,9 @@ OPTIMIZING CONTROL FLOW GRAPH Inversing boolean not (boolean~) print_sword::$1 ← (signed word) print_sword::w#5 >= (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) print_sword::$0 ← (signed word) print_sword::w#5 < (byte/signed byte/word/signed word/dword/signed dword) 0 Inversing boolean not (boolean~) print_sbyte::$1 ← (signed byte) print_sbyte::b#5 >= (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) print_sbyte::$0 ← (signed byte) print_sbyte::b#5 < (byte/signed byte/word/signed word/dword/signed dword) 0 Inversing boolean not (boolean~) divr8u::$3 ← (byte~) divr8u::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) divr8u::$2 ← (byte~) divr8u::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0 -Inversing boolean not (boolean~) divr8u::$7 ← (byte) divr8u::rem#5 < (byte) divr8u::divisor#1 from (boolean~) divr8u::$6 ← (byte) divr8u::rem#5 >= (byte) divr8u::divisor#1 +Inversing boolean not (boolean~) divr8u::$8 ← (byte) divr8u::rem#5 < (byte) divr8u::divisor#1 from (boolean~) divr8u::$7 ← (byte) divr8u::rem#5 >= (byte) divr8u::divisor#1 Inversing boolean not (boolean~) divr16u::$4 ← (byte~) divr16u::$2 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) divr16u::$3 ← (byte~) divr16u::$2 != (byte/signed byte/word/signed word/dword/signed dword) 0 -Inversing boolean not (boolean~) divr16u::$8 ← (word) divr16u::rem#5 < (word) divr16u::divisor#1 from (boolean~) divr16u::$7 ← (word) divr16u::rem#5 >= (word) divr16u::divisor#1 +Inversing boolean not (boolean~) divr16u::$9 ← (word) divr16u::rem#5 < (word) divr16u::divisor#1 from (boolean~) divr16u::$8 ← (word) divr16u::rem#5 >= (word) divr16u::divisor#1 Inversing boolean not (boolean~) div8s::$1 ← (signed byte) div8s::dividend#1 >= (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) div8s::$0 ← (signed byte) div8s::dividend#1 < (byte/signed byte/word/signed word/dword/signed dword) 0 Inversing boolean not (boolean~) div8s::$6 ← (signed byte) div8s::divisor#1 >= (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) div8s::$5 ← (signed byte) div8s::divisor#1 < (byte/signed byte/word/signed word/dword/signed dword) 0 Inversing boolean not (boolean~) div8s::$13 ← (byte) div8s::neg#4 != (byte/signed byte/word/signed word/dword/signed dword) 0 from (boolean~) div8s::$12 ← (byte) div8s::neg#4 == (byte/signed byte/word/signed word/dword/signed dword) 0 @@ -4395,16 +4403,17 @@ Alias (byte) divr8u::return#0 = (byte) divr8u::return#3 Alias (byte) rem8u#1 = (byte) rem8u#15 (byte) rem8u#16 (byte) rem8u#2 Alias (byte) div8u::return#0 = (byte~) div8u::$0 (byte) div8u::return#4 (byte) div8u::return#1 Alias (byte) divr8u::rem#1 = (byte~) divr8u::$0 (byte) divr8u::rem#6 -Alias (byte) divr8u::dividend#1 = (byte~) divr8u::$4 (byte) divr8u::dividend#7 -Alias (byte) divr8u::quotient#1 = (byte~) divr8u::$5 (byte) divr8u::quotient#4 +Alias (byte) divr8u::dividend#1 = (byte~) divr8u::$5 (byte) divr8u::dividend#7 +Alias (byte) divr8u::quotient#1 = (byte~) divr8u::$6 (byte) divr8u::quotient#4 Alias (byte) divr8u::dividend#2 = (byte) divr8u::dividend#6 Alias (byte) divr8u::quotient#6 = (byte) divr8u::quotient#7 Alias (byte) divr8u::divisor#3 = (byte) divr8u::divisor#4 Alias (byte) divr8u::i#5 = (byte) divr8u::i#6 +Alias (byte) divr8u::rem#2 = (byte~) divr8u::$4 Alias (byte) divr8u::rem#5 = (byte) divr8u::rem#7 Alias (byte) divr8u::divisor#1 = (byte) divr8u::divisor#2 Alias (byte) divr8u::i#3 = (byte) divr8u::i#4 -Alias (byte) divr8u::rem#3 = (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$8 +Alias (byte) divr8u::rem#3 = (byte/signed byte/word/signed word/dword/signed dword~) divr8u::$9 Alias (byte) divr8u::rem#10 = (byte) divr8u::rem#8 Alias (byte) divr8u::return#1 = (byte) divr8u::quotient#5 (byte) divr8u::quotient#8 (byte) divr8u::return#4 (byte) divr8u::return#2 Alias (byte) rem8u#17 = (byte) rem8u#3 (byte) rem8u#4 @@ -4413,16 +4422,17 @@ Alias (word) divr16u::return#0 = (word) divr16u::return#3 Alias (word) rem16u#1 = (word) rem16u#15 (word) rem16u#16 (word) rem16u#2 Alias (word) div16u::return#0 = (word~) div16u::$0 (word) div16u::return#4 (word) div16u::return#1 Alias (word) divr16u::rem#1 = (word~) divr16u::$0 (word) divr16u::rem#6 -Alias (word) divr16u::dividend#1 = (word~) divr16u::$5 (word) divr16u::dividend#7 -Alias (word) divr16u::quotient#1 = (word~) divr16u::$6 (word) divr16u::quotient#4 +Alias (word) divr16u::dividend#1 = (word~) divr16u::$6 (word) divr16u::dividend#7 +Alias (word) divr16u::quotient#1 = (word~) divr16u::$7 (word) divr16u::quotient#4 Alias (word) divr16u::dividend#2 = (word) divr16u::dividend#6 Alias (word) divr16u::quotient#6 = (word) divr16u::quotient#7 Alias (word) divr16u::divisor#3 = (word) divr16u::divisor#4 Alias (byte) divr16u::i#5 = (byte) divr16u::i#6 +Alias (word) divr16u::rem#2 = (word~) divr16u::$5 Alias (word) divr16u::rem#5 = (word) divr16u::rem#7 Alias (word) divr16u::divisor#1 = (word) divr16u::divisor#2 Alias (byte) divr16u::i#3 = (byte) divr16u::i#4 -Alias (word) divr16u::rem#3 = (word~) divr16u::$9 +Alias (word) divr16u::rem#3 = (word~) divr16u::$10 Alias (word) divr16u::rem#10 = (word) divr16u::rem#8 Alias (word) divr16u::return#1 = (word) divr16u::quotient#5 (word) divr16u::quotient#8 (word) divr16u::return#4 (word) divr16u::return#2 Alias (word) rem16u#17 = (word) rem16u#3 (word) rem16u#4 @@ -5088,11 +5098,11 @@ Simple Condition (boolean~) print_sword::$1 if((signed word) print_sword::w#5>=( Simple Condition (boolean~) print_sbyte::$1 if((signed byte) print_sbyte::b#5>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto print_sbyte::@1 Simple Condition (boolean~) print_cls::$1 if((byte*) print_cls::sc#1!=(byte*~) print_cls::$0) goto print_cls::@1 Simple Condition (boolean~) divr8u::$3 if((byte~) divr8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr8u::@2 -Simple Condition (boolean~) divr8u::$7 if((byte) divr8u::rem#5<(byte) divr8u::divisor#0) goto divr8u::@3 -Simple Condition (boolean~) divr8u::$9 if((byte) divr8u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto divr8u::@1 +Simple Condition (boolean~) divr8u::$8 if((byte) divr8u::rem#5<(byte) divr8u::divisor#0) goto divr8u::@3 +Simple Condition (boolean~) divr8u::$10 if((byte) divr8u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 8) goto divr8u::@1 Simple Condition (boolean~) divr16u::$4 if((byte~) divr16u::$2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16u::@2 -Simple Condition (boolean~) divr16u::$8 if((word) divr16u::rem#5<(word) divr16u::divisor#0) goto divr16u::@3 -Simple Condition (boolean~) divr16u::$10 if((byte) divr16u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto divr16u::@1 +Simple Condition (boolean~) divr16u::$9 if((word) divr16u::rem#5<(word) divr16u::divisor#0) goto divr16u::@3 +Simple Condition (boolean~) divr16u::$11 if((byte) divr16u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 16) goto divr16u::@1 Simple Condition (boolean~) div8s::$1 if((signed byte) div8s::dividend#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@1 Simple Condition (boolean~) div8s::$6 if((signed byte) div8s::divisor#0>=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@3 Simple Condition (boolean~) div8s::$13 if((byte) div8s::neg#4!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto div8s::@5 @@ -6065,7 +6075,7 @@ divr16u::@1: scope:[divr16u] from divr16u divr16u::@3 [118] if((byte~) divr16u::$2==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr16u::@2 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 ] ) to:divr16u::@4 divr16u::@4: scope:[divr16u] from divr16u::@1 - [119] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) + [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) to:divr16u::@2 divr16u::@2: scope:[divr16u] from divr16u::@1 divr16u::@4 [120] (word) divr16u::rem#5 ← phi( divr16u::@1/(word) divr16u::rem#1 divr16u::@4/(word) divr16u::rem#2 ) [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#5 ] ) @@ -6237,7 +6247,7 @@ divr8u::@1: scope:[divr8u] from divr8u divr8u::@3 [202] if((byte~) divr8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto divr8u::@2 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 ] ) to:divr8u::@4 divr8u::@4: scope:[divr8u] from divr8u::@1 - [203] (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) + [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) to:divr8u::@2 divr8u::@2: scope:[divr8u] from divr8u::@1 divr8u::@4 [204] (byte) divr8u::rem#5 ← phi( divr8u::@1/(byte) divr8u::rem#1 divr8u::@4/(byte) divr8u::rem#2 ) [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#5 ] ) @@ -7844,11 +7854,10 @@ divr16u: { jmp b4 //SEG244 divr16u::@4 b4: - //SEG245 [119] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG245 [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG246 [120] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] b2_from_b1: b2_from_b4: @@ -8347,8 +8356,10 @@ divr8u: { jmp b4 //SEG421 divr8u::@4 b4: - //SEG422 [203] (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=_inc_vbuz1 - inc rem + //SEG422 [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=vbuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG423 [204] phi from divr8u::@1 divr8u::@4 to divr8u::@2 [phi:divr8u::@1/divr8u::@4->divr8u::@2] b2_from_b1: b2_from_b4: @@ -8892,6 +8903,7 @@ Statement [111] (word) div16u::return#0 ← (word) divr16u::return#0 [ div16u::r Statement [116] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:34 [ divr16u::i#2 divr16u::i#1 ] Statement [117] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte/word/signed word/dword/signed dword) 128 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ) always clobbers reg byte a +Statement [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) always clobbers reg byte a Statement [123] if((word) divr16u::rem#5<(word) divr16u::divisor#0) goto divr16u::@3 [ divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] ) always clobbers reg byte a Statement [125] (word) divr16u::rem#3 ← (word) divr16u::rem#5 - (word) divr16u::divisor#0 [ divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ) always clobbers reg byte a Statement [133] (signed byte) test_8s::divisor#0 ← *((const signed byte[]) test_8s::divisors#0 + (byte) test_8s::i#10) [ line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 divr8u::rem#10 ] ( main:2::test_8s:11 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 divr8u::rem#10 ] ) always clobbers reg byte a @@ -8915,6 +8927,7 @@ Removing always clobbered register reg byte a as potential for zp ZP_BYTE:45 [ d Removing always clobbered register reg byte a as potential for zp ZP_BYTE:46 [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:47 [ divr8u::i#2 divr8u::i#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:104 [ test_8u::dividend#0 ] +Statement [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) always clobbers reg byte a Statement [209] (byte) divr8u::rem#3 ← (byte) divr8u::rem#5 - (byte) divr8u::divisor#0 [ divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] ) always clobbers reg byte a Statement [216] (word) test_16u::dividend#0 ← *((const word[]) test_16u::dividends#0 + (byte) test_16u::i#10) [ line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 ] ( main:2::test_16u:9 [ divr8u::rem#10 line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 ] ) always clobbers reg byte a Statement [217] (word) test_16u::divisor#0 ← *((const word[]) test_16u::divisors#0 + (byte) test_16u::i#10) [ line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 ] ( main:2::test_16u:9 [ divr8u::rem#10 line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 ] ) always clobbers reg byte a @@ -8978,6 +8991,7 @@ Statement [110] (word) divr16u::return#0 ← (word) divr16u::return#1 [ divr16u: Statement [111] (word) div16u::return#0 ← (word) divr16u::return#0 [ div16u::return#0 divr16u::rem#10 ] ( main:2::test_16s:13::div16s:21::div16u:94 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 div16u::return#0 divr16u::rem#10 ] main:2::test_16u:9::div16u:220 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 div16u::return#0 divr16u::rem#10 ] ) always clobbers reg byte a Statement [116] (byte~) divr16u::$1 ← > (word) divr16u::dividend#2 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$1 ] ) always clobbers reg byte a Statement [117] (byte~) divr16u::$2 ← (byte~) divr16u::$1 & (byte/word/signed word/dword/signed dword) 128 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#1 divr16u::$2 ] ) always clobbers reg byte a +Statement [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) always clobbers reg byte a Statement [123] if((word) divr16u::rem#5<(word) divr16u::divisor#0) goto divr16u::@3 [ divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::rem#5 divr16u::quotient#1 ] ) always clobbers reg byte a Statement [125] (word) divr16u::rem#3 ← (word) divr16u::rem#5 - (word) divr16u::divisor#0 [ divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::i#2 divr16u::dividend#1 divr16u::quotient#2 divr16u::rem#3 ] ) always clobbers reg byte a Statement [133] (signed byte) test_8s::divisor#0 ← *((const signed byte[]) test_8s::divisors#0 + (byte) test_8s::i#10) [ line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 divr8u::rem#10 ] ( main:2::test_8s:11 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 divr8u::rem#10 ] ) always clobbers reg byte a @@ -8989,6 +9003,7 @@ Statement [174] (byte) div8s::neg#2 ← (byte) div8s::neg#3 ^ (byte/signed byte/ Statement [187] (signed byte) rem8s#1 ← - (signed byte)(byte) divr8u::rem#10 [ div8s::resultu#0 divr8u::rem#10 rem8s#1 ] ( main:2::test_8s:11::div8s:136 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::resultu#0 divr8u::rem#10 rem8s#1 ] ) always clobbers reg byte a Statement [188] (signed byte) div8s::return#0 ← - (signed byte)(byte) div8s::resultu#0 [ divr8u::rem#10 div8s::return#0 rem8s#1 ] ( main:2::test_8s:11::div8s:136 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 divr8u::rem#10 div8s::return#0 rem8s#1 ] ) always clobbers reg byte a Statement [201] (byte~) divr8u::$1 ← (byte) divr8u::dividend#2 & (byte/word/signed word/dword/signed dword) 128 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 divr8u::$1 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 divr8u::$1 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#1 divr8u::$1 ] ) always clobbers reg byte a +Statement [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) always clobbers reg byte a Statement [209] (byte) divr8u::rem#3 ← (byte) divr8u::rem#5 - (byte) divr8u::divisor#0 [ divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::i#2 divr8u::dividend#1 divr8u::quotient#2 divr8u::rem#3 ] ) always clobbers reg byte a Statement [216] (word) test_16u::dividend#0 ← *((const word[]) test_16u::dividends#0 + (byte) test_16u::i#10) [ line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 ] ( main:2::test_16u:9 [ divr8u::rem#10 line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 ] ) always clobbers reg byte a Statement [217] (word) test_16u::divisor#0 ← *((const word[]) test_16u::divisors#0 + (byte) test_16u::i#10) [ line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 ] ( main:2::test_16u:9 [ divr8u::rem#10 line_cursor#1 rem16u#35 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 ] ) always clobbers reg byte a @@ -9103,62 +9118,62 @@ Uplift Scope [print_char] 14: zp ZP_BYTE:12 [ print_char::ch#4 print_char::ch#2 Uplift Scope [print_ln] Uplift Scope [main] -Uplifting [divr16u] best 45230 combination zp ZP_WORD:28 [ divr16u::rem#4 rem16u#31 divr16u::rem#10 rem16u#35 divr16u::rem#5 divr16u::rem#1 divr16u::rem#2 divr16u::rem#3 ] zp ZP_WORD:32 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:30 [ divr16u::dividend#2 divr16u::dividend#0 divr16u::dividend#1 ] zp ZP_WORD:74 [ divr16u::divisor#0 ] zp ZP_WORD:76 [ divr16u::return#0 ] -Uplifting [divr8u] best 43421 combination zp ZP_BYTE:44 [ divr8u::rem#4 rem8u#31 divr8u::rem#10 rem8u#36 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] reg byte x [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] reg byte a [ divr8u::$1 ] reg byte y [ divr8u::i#2 divr8u::i#1 ] zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] zp ZP_BYTE:92 [ divr8u::divisor#0 ] reg byte x [ divr8u::return#0 ] -Uplifting [] best 43377 combination zp ZP_WORD:13 [ char_cursor#80 char_cursor#133 char_cursor#130 char_cursor#132 char_cursor#128 char_cursor#129 char_cursor#155 char_cursor#126 char_cursor#17 char_cursor#162 char_cursor#135 char_cursor#131 char_cursor#1 char_cursor#179 char_cursor#185 ] zp ZP_WORD:5 [ line_cursor#20 line_cursor#39 line_cursor#1 line_cursor#41 ] zp ZP_WORD:3 [ rem16s#17 rem16s#3 rem16s#32 rem16s#1 ] reg byte x [ rem8s#18 rem8s#3 rem8s#33 rem8s#1 ] -Uplifting [print_str] best 43377 combination zp ZP_WORD:15 [ print_str::str#13 print_str::str#15 print_str::str#0 ] -Uplifting [print_byte] best 43369 combination zp ZP_BYTE:11 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] -Uplifting [print_word] best 43369 combination zp ZP_WORD:9 [ print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] -Uplifting [print_sword] best 43369 combination zp ZP_WORD:7 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 ] -Uplifting [print_sbyte] best 43369 combination zp ZP_BYTE:37 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] -Uplifting [div8u] best 43195 combination reg byte x [ div8u::divisor#2 div8u::divisor#0 div8u::divisor#1 ] reg byte a [ div8u::dividend#2 div8u::dividend#0 div8u::dividend#1 ] reg byte x [ div8u::return#3 ] reg byte x [ div8u::return#2 ] reg byte x [ div8u::return#0 ] -Uplifting [div16u] best 43195 combination zp ZP_WORD:26 [ div16u::divisor#2 div16u::divisor#0 div16u::divisor#1 ] zp ZP_WORD:24 [ div16u::dividend#2 div16u::dividend#0 div16u::dividend#1 ] zp ZP_WORD:100 [ div16u::return#3 ] zp ZP_WORD:70 [ div16u::return#2 ] zp ZP_WORD:78 [ div16u::return#0 ] +Uplifting [divr16u] best 45080 combination zp ZP_WORD:28 [ divr16u::rem#4 rem16u#31 divr16u::rem#10 rem16u#35 divr16u::rem#5 divr16u::rem#1 divr16u::rem#2 divr16u::rem#3 ] zp ZP_WORD:32 [ divr16u::quotient#3 divr16u::return#1 divr16u::quotient#1 divr16u::quotient#2 ] reg byte a [ divr16u::$1 ] reg byte a [ divr16u::$2 ] reg byte x [ divr16u::i#2 divr16u::i#1 ] zp ZP_WORD:30 [ divr16u::dividend#2 divr16u::dividend#0 divr16u::dividend#1 ] zp ZP_WORD:74 [ divr16u::divisor#0 ] zp ZP_WORD:76 [ divr16u::return#0 ] +Uplifting [divr8u] best 43271 combination zp ZP_BYTE:44 [ divr8u::rem#4 rem8u#31 divr8u::rem#10 rem8u#36 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] reg byte x [ divr8u::quotient#3 divr8u::return#1 divr8u::quotient#1 divr8u::quotient#2 ] reg byte a [ divr8u::$1 ] reg byte y [ divr8u::i#2 divr8u::i#1 ] zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] zp ZP_BYTE:92 [ divr8u::divisor#0 ] reg byte x [ divr8u::return#0 ] +Uplifting [] best 43227 combination zp ZP_WORD:13 [ char_cursor#80 char_cursor#133 char_cursor#130 char_cursor#132 char_cursor#128 char_cursor#129 char_cursor#155 char_cursor#126 char_cursor#17 char_cursor#162 char_cursor#135 char_cursor#131 char_cursor#1 char_cursor#179 char_cursor#185 ] zp ZP_WORD:5 [ line_cursor#20 line_cursor#39 line_cursor#1 line_cursor#41 ] zp ZP_WORD:3 [ rem16s#17 rem16s#3 rem16s#32 rem16s#1 ] reg byte x [ rem8s#18 rem8s#3 rem8s#33 rem8s#1 ] +Uplifting [print_str] best 43227 combination zp ZP_WORD:15 [ print_str::str#13 print_str::str#15 print_str::str#0 ] +Uplifting [print_byte] best 43219 combination zp ZP_BYTE:11 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] reg byte a [ print_byte::$0 ] reg byte a [ print_byte::$2 ] +Uplifting [print_word] best 43219 combination zp ZP_WORD:9 [ print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] +Uplifting [print_sword] best 43219 combination zp ZP_WORD:7 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 ] +Uplifting [print_sbyte] best 43219 combination zp ZP_BYTE:37 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] +Uplifting [div8u] best 43045 combination reg byte x [ div8u::divisor#2 div8u::divisor#0 div8u::divisor#1 ] reg byte a [ div8u::dividend#2 div8u::dividend#0 div8u::dividend#1 ] reg byte x [ div8u::return#3 ] reg byte x [ div8u::return#2 ] reg byte x [ div8u::return#0 ] +Uplifting [div16u] best 43045 combination zp ZP_WORD:26 [ div16u::divisor#2 div16u::divisor#0 div16u::divisor#1 ] zp ZP_WORD:24 [ div16u::dividend#2 div16u::dividend#0 div16u::dividend#1 ] zp ZP_WORD:100 [ div16u::return#3 ] zp ZP_WORD:70 [ div16u::return#2 ] zp ZP_WORD:78 [ div16u::return#0 ] Uplift attempts [div8s] 10000/248832 (limiting to 10000) -Uplifting [div8s] best 43005 combination reg byte a [ div8s::return#3 ] reg byte x [ div8s::divisoru#3 div8s::divisoru#4 div8s::divisoru#5 ] reg byte a [ div8s::return#2 div8s::return#6 div8s::return#0 ] reg byte y [ div8s::dividendu#3 div8s::dividendu#7 div8s::dividendu#8 ] reg byte a [ div8s::dividend#0 ] zp ZP_BYTE:40 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] reg byte x [ div8s::divisor#0 ] reg byte a [ div8s::$2 ] zp ZP_BYTE:89 [ div8s::$7 ] zp ZP_BYTE:91 [ div8s::resultu#0 ] +Uplifting [div8s] best 42855 combination reg byte a [ div8s::return#3 ] reg byte x [ div8s::divisoru#3 div8s::divisoru#4 div8s::divisoru#5 ] reg byte a [ div8s::return#2 div8s::return#6 div8s::return#0 ] reg byte y [ div8s::dividendu#3 div8s::dividendu#7 div8s::dividendu#8 ] reg byte a [ div8s::dividend#0 ] zp ZP_BYTE:40 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] reg byte x [ div8s::divisor#0 ] reg byte a [ div8s::$2 ] zp ZP_BYTE:89 [ div8s::$7 ] zp ZP_BYTE:91 [ div8s::resultu#0 ] Limited combination testing to 10000 combinations of 248832 possible. -Uplifting [div16s] best 42996 combination zp ZP_WORD:60 [ div16s::return#3 ] zp ZP_WORD:19 [ div16s::divisoru#3 div16s::divisoru#4 div16s::divisoru#5 ] zp ZP_WORD:22 [ div16s::return#2 div16s::return#6 div16s::return#0 ] zp ZP_WORD:17 [ div16s::dividendu#3 div16s::dividendu#7 div16s::dividendu#8 ] zp ZP_WORD:56 [ div16s::dividend#0 ] reg byte y [ div16s::neg#4 div16s::neg#3 div16s::neg#2 ] zp ZP_WORD:58 [ div16s::divisor#0 ] zp ZP_WORD:66 [ div16s::$2 ] zp ZP_WORD:68 [ div16s::$7 ] zp ZP_WORD:72 [ div16s::resultu#0 ] -Uplifting [print_cls] best 42996 combination zp ZP_WORD:50 [ print_cls::sc#2 print_cls::sc#1 ] -Uplifting [test_16u] best 42996 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] zp ZP_WORD:96 [ test_16u::dividend#0 ] zp ZP_WORD:98 [ test_16u::divisor#0 ] zp ZP_WORD:102 [ test_16u::res#0 ] -Uplifting [test_8s] best 42996 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] zp ZP_BYTE:82 [ test_8s::dividend#0 ] zp ZP_BYTE:83 [ test_8s::divisor#0 ] zp ZP_BYTE:87 [ test_8s::res#0 ] -Uplifting [test_16s] best 42996 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] zp ZP_WORD:52 [ test_16s::dividend#0 ] zp ZP_WORD:54 [ test_16s::divisor#0 ] zp ZP_WORD:62 [ test_16s::res#0 ] -Uplifting [test_8u] best 42936 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] zp ZP_BYTE:104 [ test_8u::dividend#0 ] zp ZP_BYTE:105 [ test_8u::divisor#0 ] reg byte x [ test_8u::res#0 ] -Uplifting [print_char] best 42921 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] -Uplifting [print_ln] best 42921 combination -Uplifting [main] best 42921 combination +Uplifting [div16s] best 42846 combination zp ZP_WORD:60 [ div16s::return#3 ] zp ZP_WORD:19 [ div16s::divisoru#3 div16s::divisoru#4 div16s::divisoru#5 ] zp ZP_WORD:22 [ div16s::return#2 div16s::return#6 div16s::return#0 ] zp ZP_WORD:17 [ div16s::dividendu#3 div16s::dividendu#7 div16s::dividendu#8 ] zp ZP_WORD:56 [ div16s::dividend#0 ] reg byte y [ div16s::neg#4 div16s::neg#3 div16s::neg#2 ] zp ZP_WORD:58 [ div16s::divisor#0 ] zp ZP_WORD:66 [ div16s::$2 ] zp ZP_WORD:68 [ div16s::$7 ] zp ZP_WORD:72 [ div16s::resultu#0 ] +Uplifting [print_cls] best 42846 combination zp ZP_WORD:50 [ print_cls::sc#2 print_cls::sc#1 ] +Uplifting [test_16u] best 42846 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] zp ZP_WORD:96 [ test_16u::dividend#0 ] zp ZP_WORD:98 [ test_16u::divisor#0 ] zp ZP_WORD:102 [ test_16u::res#0 ] +Uplifting [test_8s] best 42846 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] zp ZP_BYTE:82 [ test_8s::dividend#0 ] zp ZP_BYTE:83 [ test_8s::divisor#0 ] zp ZP_BYTE:87 [ test_8s::res#0 ] +Uplifting [test_16s] best 42846 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] zp ZP_WORD:52 [ test_16s::dividend#0 ] zp ZP_WORD:54 [ test_16s::divisor#0 ] zp ZP_WORD:62 [ test_16s::res#0 ] +Uplifting [test_8u] best 42786 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] zp ZP_BYTE:104 [ test_8u::dividend#0 ] zp ZP_BYTE:105 [ test_8u::divisor#0 ] reg byte x [ test_8u::res#0 ] +Uplifting [print_char] best 42771 combination reg byte a [ print_char::ch#4 print_char::ch#2 print_char::ch#3 ] +Uplifting [print_ln] best 42771 combination +Uplifting [main] best 42771 combination Attempting to uplift remaining variables inzp ZP_BYTE:44 [ divr8u::rem#4 rem8u#31 divr8u::rem#10 rem8u#36 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] -Uplifting [divr8u] best 42921 combination zp ZP_BYTE:44 [ divr8u::rem#4 rem8u#31 divr8u::rem#10 rem8u#36 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] +Uplifting [divr8u] best 42771 combination zp ZP_BYTE:44 [ divr8u::rem#4 rem8u#31 divr8u::rem#10 rem8u#36 divr8u::rem#5 divr8u::rem#1 divr8u::rem#2 divr8u::rem#3 ] Attempting to uplift remaining variables inzp ZP_BYTE:11 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] -Uplifting [print_byte] best 42921 combination zp ZP_BYTE:11 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] +Uplifting [print_byte] best 42771 combination zp ZP_BYTE:11 [ print_byte::b#7 print_byte::b#9 print_byte::b#1 print_byte::b#2 print_byte::b#3 print_byte::b#4 print_byte::b#5 print_byte::b#6 ] Attempting to uplift remaining variables inzp ZP_BYTE:37 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] -Uplifting [print_sbyte] best 42921 combination zp ZP_BYTE:37 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] +Uplifting [print_sbyte] best 42771 combination zp ZP_BYTE:37 [ print_sbyte::b#6 print_sbyte::b#5 print_sbyte::b#1 print_sbyte::b#2 print_sbyte::b#3 print_sbyte::b#4 print_sbyte::b#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] -Uplifting [divr8u] best 42921 combination zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] +Uplifting [divr8u] best 42771 combination zp ZP_BYTE:45 [ divr8u::dividend#2 divr8u::dividend#0 divr8u::dividend#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] -Uplifting [test_16s] best 42921 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] +Uplifting [test_16s] best 42771 combination zp ZP_BYTE:2 [ test_16s::i#10 test_16s::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] -Uplifting [test_8s] best 42921 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] +Uplifting [test_8s] best 42771 combination zp ZP_BYTE:35 [ test_8s::i#10 test_8s::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] -Uplifting [test_16u] best 42921 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] +Uplifting [test_16u] best 42771 combination zp ZP_BYTE:48 [ test_16u::i#10 test_16u::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] -Uplifting [test_8u] best 42921 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] +Uplifting [test_8u] best 42771 combination zp ZP_BYTE:49 [ test_8u::i#10 test_8u::i#1 ] Attempting to uplift remaining variables inzp ZP_BYTE:92 [ divr8u::divisor#0 ] -Uplifting [divr8u] best 42921 combination zp ZP_BYTE:92 [ divr8u::divisor#0 ] +Uplifting [divr8u] best 42771 combination zp ZP_BYTE:92 [ divr8u::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:82 [ test_8s::dividend#0 ] -Uplifting [test_8s] best 42921 combination zp ZP_BYTE:82 [ test_8s::dividend#0 ] +Uplifting [test_8s] best 42771 combination zp ZP_BYTE:82 [ test_8s::dividend#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:104 [ test_8u::dividend#0 ] -Uplifting [test_8u] best 42921 combination zp ZP_BYTE:104 [ test_8u::dividend#0 ] +Uplifting [test_8u] best 42771 combination zp ZP_BYTE:104 [ test_8u::dividend#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:40 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] -Uplifting [div8s] best 42921 combination zp ZP_BYTE:40 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] +Uplifting [div8s] best 42771 combination zp ZP_BYTE:40 [ div8s::neg#4 div8s::neg#3 div8s::neg#2 ] Attempting to uplift remaining variables inzp ZP_BYTE:105 [ test_8u::divisor#0 ] -Uplifting [test_8u] best 42921 combination zp ZP_BYTE:105 [ test_8u::divisor#0 ] +Uplifting [test_8u] best 42771 combination zp ZP_BYTE:105 [ test_8u::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:83 [ test_8s::divisor#0 ] -Uplifting [test_8s] best 42921 combination zp ZP_BYTE:83 [ test_8s::divisor#0 ] +Uplifting [test_8s] best 42771 combination zp ZP_BYTE:83 [ test_8s::divisor#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:87 [ test_8s::res#0 ] -Uplifting [test_8s] best 42921 combination zp ZP_BYTE:87 [ test_8s::res#0 ] +Uplifting [test_8s] best 42771 combination zp ZP_BYTE:87 [ test_8s::res#0 ] Attempting to uplift remaining variables inzp ZP_BYTE:89 [ div8s::$7 ] -Uplifting [div8s] best 42917 combination reg byte x [ div8s::$7 ] +Uplifting [div8s] best 42767 combination reg byte x [ div8s::$7 ] Attempting to uplift remaining variables inzp ZP_BYTE:91 [ div8s::resultu#0 ] -Uplifting [div8s] best 42916 combination reg byte y [ div8s::resultu#0 ] +Uplifting [div8s] best 42766 combination reg byte y [ div8s::resultu#0 ] Coalescing zero page register [ zp ZP_WORD:22 [ div16s::return#2 div16s::return#6 div16s::return#0 ] ] with [ zp ZP_WORD:72 [ div16s::resultu#0 ] ] Coalescing zero page register [ zp ZP_WORD:7 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 ] ] with [ zp ZP_WORD:9 [ print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] ] Coalescing zero page register [ zp ZP_WORD:7 [ print_sword::w#6 print_sword::w#5 print_sword::w#1 print_sword::w#2 print_sword::w#3 print_sword::w#4 print_sword::w#0 print_word::w#5 print_word::w#7 print_word::w#1 print_word::w#2 print_word::w#3 print_word::w#4 ] ] with [ zp ZP_WORD:52 [ test_16s::dividend#0 ] ] @@ -9892,11 +9907,10 @@ divr16u: { jmp b4 //SEG244 divr16u::@4 b4: - //SEG245 [119] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG245 [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG246 [120] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] b2_from_b1: b2_from_b4: @@ -10346,8 +10360,10 @@ divr8u: { jmp b4 //SEG421 divr8u::@4 b4: - //SEG422 [203] (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=_inc_vbuz1 - inc rem + //SEG422 [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=vbuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG423 [204] phi from divr8u::@1 divr8u::@4 to divr8u::@2 [phi:divr8u::@1/divr8u::@4->divr8u::@2] b2_from_b1: b2_from_b4: @@ -11612,7 +11628,7 @@ reg byte x [ test_8u::res#0 ] FINAL ASSEMBLER -Score: 33716 +Score: 33566 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -12166,11 +12182,10 @@ divr16u: { cmp #0 beq b2 //SEG244 divr16u::@4 - //SEG245 [119] (word) divr16u::rem#2 ← ++ (word) divr16u::rem#1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=_inc_vwuz1 - inc rem - bne !+ - inc rem+1 - !: + //SEG245 [119] (word) divr16u::rem#2 ← (word) divr16u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ( main:2::test_16s:13::div16s:21::div16u:94::divr16u:109 [ test_16s::i#10 test_16s::dividend#0 test_16s::divisor#0 line_cursor#1 div16s::neg#4 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] main:2::test_16u:9::div16u:220::divr16u:109 [ divr8u::rem#10 line_cursor#1 test_16u::i#10 test_16u::dividend#0 test_16u::divisor#0 divr16u::divisor#0 divr16u::dividend#2 divr16u::quotient#3 divr16u::i#2 divr16u::rem#2 ] ) -- vwuz1=vwuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG246 [120] phi from divr16u::@1 divr16u::@4 to divr16u::@2 [phi:divr16u::@1/divr16u::@4->divr16u::@2] //SEG247 [120] phi (word) divr16u::rem#5 = (word) divr16u::rem#1 [phi:divr16u::@1/divr16u::@4->divr16u::@2#0] -- register_copy //SEG248 divr16u::@2 @@ -12529,8 +12544,10 @@ divr8u: { cmp #0 beq b2 //SEG421 divr8u::@4 - //SEG422 [203] (byte) divr8u::rem#2 ← ++ (byte) divr8u::rem#1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=_inc_vbuz1 - inc rem + //SEG422 [203] (byte) divr8u::rem#2 ← (byte) divr8u::rem#1 | (byte/signed byte/word/signed word/dword/signed dword) 1 [ divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ( main:2::test_8s:11::div8s:136::div8u:179::divr8u:194 [ divr16u::rem#10 line_cursor#1 test_8s::i#10 test_8s::dividend#0 test_8s::divisor#0 div8s::neg#4 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] main:2::test_8u:7::div8u:249::divr8u:194 [ line_cursor#41 char_cursor#135 test_8u::i#10 test_8u::dividend#0 test_8u::divisor#0 divr8u::divisor#0 divr8u::dividend#2 divr8u::quotient#3 divr8u::i#2 divr8u::rem#2 ] ) -- vbuz1=vbuz1_bor_vbuc1 + lda #1 + ora rem + sta rem //SEG423 [204] phi from divr8u::@1 divr8u::@4 to divr8u::@2 [phi:divr8u::@1/divr8u::@4->divr8u::@2] //SEG424 [204] phi (byte) divr8u::rem#5 = (byte) divr8u::rem#1 [phi:divr8u::@1/divr8u::@4->divr8u::@2#0] -- register_copy //SEG425 divr8u::@2