Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@7shi
Created May 6, 2012 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 7shi/2614606 to your computer and use it in GitHub Desktop.
Save 7shi/2614606 to your computer and use it in GitHub Desktop.
Alphaの32/64bitコード比較
.set noreorder
.set volatile
.set noat
.text
.align 2
.globl test
.ent test
test:
.frame $30,0,$26,0
ldgp $29,0($27)
$test..ng:
.prologue 1
lda $1,global
stl $16,0($1)
ret $31,($26),1
.end test
.align 2
.globl test2
.ent test2
test2:
.frame $30,16,$26,0
.mask 0x4000000,-16
ldgp $29,0($27)
$test2..ng:
lda $30,-16($30)
stq $26,0($30)
.prologue 1
lda $16,4($31)
jsr $26,test
ldgp $29,0($26)
lda $16,8($31)
jsr $26,test
ldgp $29,0($26)
lda $16,8($31)
jsr $26,test
ldgp $29,0($26)
ldq $26,0($30)
lda $30,16($30)
ret $31,($26),1
.end test2
.comm global,4,4
.ident "GCC: (GNU) 4.6.1"
alpha-elf.x: file format elf64-alpha
Disassembly of section .text:
00000001200000e8 <test>:
int global;
void test(int v) {
1200000e8: 02 00 bb 27 ldah gp,2(t12)
1200000ec: d0 80 bd 23 lda gp,-32560(gp)
global = v;
1200000f0: 08 80 3d a4 ldq t0,-32760(gp)
1200000f4: 00 00 01 b2 stl a0,0(t0)
}
1200000f8: 01 80 fa 6b ret
00000001200000fc <test2>:
void test2(void) {
1200000fc: 02 00 bb 27 ldah gp,2(t12)
120000100: bc 80 bd 23 lda gp,-32580(gp)
120000104: f0 ff de 23 lda sp,-16(sp)
120000108: 00 00 5e b7 stq ra,0(sp)
test(sizeof(int));
12000010c: 04 00 1f 22 lda a0,4
120000110: 00 80 7d a7 ldq t12,-32768(gp)
120000114: f4 7f 5b 6b jsr ra,(t12),1200000e8 <test>
120000118: 02 00 ba 27 ldah gp,2(ra)
12000011c: a0 80 bd 23 lda gp,-32608(gp)
test(sizeof(long));
120000120: 08 00 1f 22 lda a0,8
120000124: 00 80 7d a7 ldq t12,-32768(gp)
120000128: ef 7f 5b 6b jsr ra,(t12),1200000e8 <test>
12000012c: 02 00 ba 27 ldah gp,2(ra)
120000130: 8c 80 bd 23 lda gp,-32628(gp)
test(sizeof(void *));
120000134: 08 00 1f 22 lda a0,8
120000138: 00 80 7d a7 ldq t12,-32768(gp)
12000013c: ea 7f 5b 6b jsr ra,(t12),1200000e8 <test>
120000140: 02 00 ba 27 ldah gp,2(ra)
120000144: 78 80 bd 23 lda gp,-32648(gp)
}
120000148: 00 00 5e a7 ldq ra,0(sp)
12000014c: 10 00 de 23 lda sp,16(sp)
120000150: 01 80 fa 6b ret
.set noreorder
.set volatile
.set noat
.globl __fltused
.file 1 "alpha.c"
.text
.align 2
.globl test
.ent test
test:
.frame $30,0,$26,0
.prologue 0
lda $1,global
stl $16,0($1)
ret $31,($26),1
.end test
.align 2
.globl test2
.ent test2
test2:
.frame $30,0,$26,0
.mask 0x4000000,0
lda $30,-16($30)
stq $26,0($30)
.prologue 0
lda $16,4
bsr $26,test
lda $16,4
bsr $26,test
lda $16,4
bsr $26,test
ldq $26,0($30)
lda $30,16($30)
ret $31,($26),1
.end test2
.comm global,4
int global;
void test(int v) {
global = v;
}
void test2(void) {
test(sizeof(int));
test(sizeof(long));
test(sizeof(void *));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment