Commit 53682077 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Avoid unnecesssary remainder calculations

Detail:
  s/HeapSort, s/vdu/vdugrafc, s/vdu/vduswis - Avoid unnecessary remainder calculations in DivRem macro
  s/PMF/i2cutils, s/PMF/osword - Make use of DivRem's ability to accept a constant as the divisor
Admin:
  Tested on Cortex-A15


Version 5.35, 4.79.2.318. Tagged as 'Kernel-5_35-4_79_2_318'
parent 280c28ef
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.317"
Module_Date SETS "26 Apr 2016"
Module_ApplicationDate SETS "26-Apr-16"
Module_MinorVersion SETS "4.79.2.318"
Module_Date SETS "08 May 2016"
Module_ApplicationDate SETS "08-May-16"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.317)"
Module_HelpVersion SETS "5.35 (26 Apr 2016) 4.79.2.317"
Module_FullVersion SETS "5.35 (4.79.2.318)"
Module_HelpVersion SETS "5.35 (08 May 2016) 4.79.2.318"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.317
#define Module_Date_CMHG 26 Apr 2016
#define Module_MinorVersion_CMHG 4.79.2.318
#define Module_Date_CMHG 08 May 2016
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.317"
#define Module_Date "26 Apr 2016"
#define Module_MinorVersion "4.79.2.318"
#define Module_Date "08 May 2016"
#define Module_ApplicationDate "26-Apr-16"
#define Module_ApplicationDate "08-May-16"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.317)"
#define Module_HelpVersion "5.35 (26 Apr 2016) 4.79.2.317"
#define Module_FullVersion "5.35 (4.79.2.318)"
#define Module_HelpVersion "5.35 (08 May 2016) 4.79.2.318"
#define Module_LibraryVersionInfo "5:35"
......@@ -239,7 +239,7 @@ h8 STR hs_R, [hs_array, hs_i, LSL #2] ; R(i) = R
STR r14, [r5] ; mark item 'done'
SUB r5, r7, r1 ; r14 := index of next item (r8 pres.)
DivRem r14, r5, r8, r0 ; r5,r0 corrupt
DivRem r14, r5, r8, r0, norem ; r5,r0 corrupt
ADD r5, r2, r14, LSL #2 ; r5 -> next item
[ DebugHeapSort
DREG r7, " next block "
......
......@@ -61,11 +61,10 @@ E2ROMAddress32K * &a6 ; 24CS256 device - 32K (top 2K possibly
;
HexToBCD ROUT
Push "R1,R2, R14"
MOV R1, #10
DivRem R2, R0, R1, R14 ; R2=R0 DIV 10; R0=R0 MOD 10
Push "R2, R14"
DivRem R2, R0, #10, R14 ; R2=R0 DIV 10; R0=R0 MOD 10
ADD R0, R0, R2, LSL #4
Pull "R1,R2, PC"
Pull "R2, PC"
; *****************************************************************************
;
......
......@@ -659,8 +659,7 @@ OsWord0F ROUT
Pull "r0,r2,r3,r5" ; hours, day of month, month, year
ADD sp, sp, #8 ; junk day of week, day of year
ADD sp, sp, r10 ; and string on stack
MOV r4, #100
DivRem r6, r5, r4, r14 ; r5 = Year (lo), r6 = Year (hi)
DivRem r6, r5, #100, r14 ; r5 = Year (lo), r6 = Year (hi)
BL SetTime ; also updates 5-byte RealTime
......
......@@ -254,28 +254,15 @@ GenEllParm
MOV R0,R7 ;Setup SliceCnt
;MOV R7,R0 ;Div R5,R5,R0 using R7,R9,R10
MOV R9,R5,LSL #16
; *****Change made by DJS
; Use new DivRem macro, not old DIVREM
; Original code was:
; DIVREM R5,R9,R7,R10 ;R5 := totalshear/ellipseheight
DivRem R5,R9,R7,R10 ;R5 := totalshear/ellipseheight
; *****End of change made by DJS
;BIC R5,R5,#&FF ;Slugg accuracy for compatability?
DivRem R5,R9,R7,R10,norem ;R5 := totalshear/ellipseheight
CMP R8,#0
RSBLT R5,R5,#0 ;Correct for negative slope
MOV R7,R0 ;Div R6,R6,R0 using R7,R9,R10
MOV R9,R6,LSL #8
; *****Change made by DJS
; Use new DivRem macro, not old DIVREM
; Original code was:
; DIVREM R6,R9,R7,R10 ;R6 := slicewidth/ellipseheight
DivRem R6,R9,R7,R10 ;R6 := slicewidth/ellipseheight
; *****End of change made by DJS
DivRem R6,R9,R7,R10,norem ;R6 := slicewidth/ellipseheight
; R5 holds shear per scanline
......
......@@ -119,10 +119,10 @@ SWIReadVduVariables ; alternative symbol used for init'ing
MOVEQ R3, #0 ; else 0
SUB R7, R0, R2 ; R7 = width-1-(width reduction)
DivRem R0, R7, R4, R2 ; R0 = (width-(1 or sizex))DIV spacex
DivRem R0, R7, R4, R2, norem ; R0 = (width-(1 or sizex))DIV spacex
SUB R7, R3, R1 ; R7 = height-(1-height reduction)
DivRem R1, R7, R5, R3 ; R1 = (height-(1 or sizey))DIV spacey
DivRem R1, R7, R5, R3, norem ; R1 = (height-(1 or sizey))DIV spacey
32
TST R6, #8 ; are X and Y reversed ?
EORNE R0, R0, R1 ; yes, then swap
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment