forked from davidgiven/ack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edit PowerPC assembly for .and, .cms, .ior, .xor, .zer
Remove one addi instruction from some loops. These loops had increased 2 pointers, they now increase 1 index. I must initialize the index, so I add "li r6, 0" before each loop. Change .zer to use subf instead of neg, add. Change .xor to take the size on the real stack, as .and and .or have done since 81c677d.
- Loading branch information
Showing
6 changed files
with
59 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
.sect .text | ||
|
||
! Set symmetric difference. | ||
! Stack: ( b a -- a/b ) | ||
! With r3 = size of set | ||
! Stack: ( b a size -- a/b ) | ||
|
||
.define .xor | ||
.xor: | ||
mr r4, sp ! r4 = ptr to set a | ||
add r5, sp, r3 ! r5 = ptr to set b | ||
srwi r6, r3, 2 | ||
mtspr ctr, r6 ! ctr = r3 / 4 | ||
lwz r3, 0(sp) ! r3 = size | ||
srwi r7, r3, 2 | ||
mtspr ctr, r7 ! ctr = size / 4 | ||
addi r4, sp, 4 ! r4 = ptr to set a | ||
add r5, r4, r3 ! r5 = ptr to set b | ||
li r6, 0 ! r6 = index | ||
1: | ||
lwz r7, 0(r4) | ||
lwz r8, 0(r5) | ||
lwzx r7, r4, r6 | ||
lwzx r8, r5, r6 | ||
xor r8, r7, r8 ! symmetric difference of words | ||
stw r8, 0(r5) | ||
addi r4, r4, 4 | ||
addi r5, r5, 4 | ||
stwx r8, r5, r6 | ||
addi r6, r6, 4 | ||
bdnz 1b ! loop ctr times | ||
add sp, sp, r3 | ||
mr sp, r5 | ||
blr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters