-
Notifications
You must be signed in to change notification settings - Fork 12
feat: migrate cpp/language/basic_concepts/as_if #88
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
Open
Sudrut
wants to merge
1
commit into
cppdoc-cc:main
Choose a base branch
from
Sudrut:migrate-language-asif
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
|
@Sudrut is attempting to deploy a commit to the microcber's projects Team on Vercel. A member of the Team first needs to authorize it. |
Lancern
reviewed
Dec 21, 2025
Comment on lines
+101
to
+132
| ``` | ||
| # full code of the main() function as produced by the GCC compiler | ||
| # x86 (Intel) platform: | ||
| movl input(%rip), %eax # eax = input | ||
| leal 3(%rax,%rax), %eax # eax = 3 + eax + eax | ||
| movl %eax, result(%rip) # result = eax | ||
| xorl %eax, %eax # eax = 0 (the return value of main()) | ||
| ret | ||
|
|
||
| # PowerPC (IBM) platform: | ||
| lwz 9,LC..1(2) | ||
| li 3,0 # r3 = 0 (the return value of main()) | ||
| lwz 11,0(9) # r11 = input; | ||
| slwi 11,11,1 # r11 = r11 << 1; | ||
| addi 0,11,3 # r0 = r11 + 3; | ||
| stw 0,4(9) # result = r0; | ||
| blr | ||
|
|
||
| # Sparc (Sun) platform: | ||
| sethi %hi(result), %g2 | ||
| sethi %hi(input), %g1 | ||
| mov 0, %o0 # o0 = 0 (the return value of main) | ||
| ld [%g1+%lo(input)], %g1 # g1 = input | ||
| add %g1, %g1, %g1 # g1 = g1 + g1 | ||
| add %g1, 3, %g1 # g1 = 3 + g1 | ||
| st %g1, [%g2+%lo(result)] # result = g1 | ||
| jmp %o7+8 | ||
| nop | ||
|
|
||
| # in all cases, the side effects of preinc() were eliminated, and the | ||
| # entire main() function was reduced to the equivalent of result = 2 * input + 3; | ||
| ``` |
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could split this code block into three tabs and each tab shows the code generated for a specific target platform.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.