feat: migrate cpp/language/basic_concepts/as_if#88
Merged
Lancern merged 2 commits intocppdoc-cc:mainfrom Jan 4, 2026
Merged
Conversation
|
@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.
Maybe we could split this code block into three tabs and each tab shows the code generated for a specific target platform.
Contributor
Author
There was a problem hiding this comment.
Maybe we could split this code block into three tabs and each tab shows the code generated for a specific target platform.
It's divided to 3 tabs now.
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
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.