Last active
October 19, 2016 17:13
-
-
Save igorsnunes/0e7d111c12094dd88251d49367a4fb4e to your computer and use it in GitHub Desktop.
Cmpldi vs li+cmpld
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
Compiling cmpldi.s and running with "perf stat" the output was "195.508661159 seconds time elapsed". | |
Doing the same with nocmpldi.s the output was "195.614111789 seconds". | |
The files were compiled using gcc version 4.9.2 and the following line was used to compile: | |
gcc cmpldi.s -o cmpldi.o | |
gcc nocmpldi.s -o nocmpldi.o | |
Based on these results, no performance gain was detected. |
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
.file "inline_branch_cmpldi.c" | |
.abiversion 2 | |
.section ".toc","aw" | |
.section ".text" | |
.align 2 | |
.globl main | |
.type main, @function | |
main: | |
std 31,-8(1) | |
stdu 1,-64(1) | |
mr 31,1 | |
lis 9,32767 | |
ori 9,9,32767 | |
sldi 9,9,7 | |
L1: | |
addi 9,9,-1 | |
cmpldi 9,0 | |
bne L1 | |
li 9,0 | |
mr 3,9 | |
addi 1,31,64 | |
ld 31,-8(1) | |
blr | |
.long 0 | |
.byte 0,0,0,0,128,1,0,1 | |
.size main,.-main | |
.ident "GCC: (Ubuntu 4.9.2-10ubuntu13) 4.9.2" | |
.section .note.GNU-stack,"",@progbits |
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
.file "inline_branch_nocmpldi.c" | |
.abiversion 2 | |
.section ".toc","aw" | |
.section ".text" | |
.align 2 | |
.globl main | |
.type main, @function | |
main: | |
std 31,-8(1) | |
stdu 1,-64(1) | |
mr 31,1 | |
lis 9,32767 | |
ori 9,9,32767 | |
sldi 9,9,7 | |
L1: | |
addi 9,9,-1 | |
li 8, 0 | |
cmpld 9,8 | |
bne L1 | |
li 9,0 | |
mr 3,9 | |
addi 1,31,64 | |
ld 31,-8(1) | |
blr | |
.long 0 | |
.byte 0,0,0,0,128,1,0,1 | |
.size main,.-main | |
.ident "GCC: (Ubuntu 4.9.2-10ubuntu13) 4.9.2" | |
.section .note.GNU-stack,"",@progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment