-
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
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. |
| ``` | ||
| # 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; | ||
| ``` |
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.
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.
It's divided to 3 tabs now.
Lancern
left a comment
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.
LGTM
No description provided.