Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fpcomp example #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Chapter 12/fpcomp.s
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fpcomp: // load the 3 numbers
FSUB S3, S1, S0
FABS S3, S3
FCMP S3, S2
B.LE notequal
B.GE notequal
MOV X0, #1
B done

Expand Down
5 changes: 5 additions & 0 deletions Chapter 12/maincomp.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ loop:
SUBS W19, W19, #1 // decrement loop counter
B.NE loop // loop if more points

// Store running sum for later use
ADRP X0, runsum@PAGE
ADD X0, X0, runsum@PAGEOFF
STR S1, [X0]

// compare running sum to real sum
FCMP S1, S2
// print if the numbers are equal or not
Expand Down