Page MenuHomec4science

order_fence_asm
No OneTemporary

File Metadata

Created
Thu, Jan 9, 22:09

order_fence_asm

.file "order_fence.c"
.text
.p2align 4,,15
.globl thread1Func
.type thread1Func, @function
thread1Func:
.LFB22:
.cfi_startproc
.p2align 4,,10
.p2align 3
.L3:
movzbl t1block(%rip), %eax
testb %al, %al
jne .L3
movb $1, t1block(%rip)
movl $1, X(%rip)
#APP
# 18 "order_fence.c" 1
mfence
# 0 "" 2
#NO_APP
movl Y(%rip), %eax
movl %eax, r1(%rip)
movb $1, t1fin(%rip)
jmp .L3
.cfi_endproc
.LFE22:
.size thread1Func, .-thread1Func
.p2align 4,,15
.globl thread2Func
.type thread2Func, @function
thread2Func:
.LFB23:
.cfi_startproc
.p2align 4,,10
.p2align 3
.L8:
movzbl t2block(%rip), %eax
testb %al, %al
jne .L8
movb $1, t2block(%rip)
movl $1, Y(%rip)
#APP
# 32 "order_fence.c" 1
mfence
# 0 "" 2
#NO_APP
movl X(%rip), %eax
movl %eax, r2(%rip)
movb $1, t2fin(%rip)
jmp .L8
.cfi_endproc
.LFE23:
.size thread2Func, .-thread2Func
.section .rodata.str1.8,"aMS",@progbits,1
.align 8
.LC0:
.string "Failed to set main thread affinity"
.align 8
.LC1:
.string "%d memory re-orderings detected in %d iterations - %d percent\n"
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB24:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
subq $160, %rsp
.cfi_def_cfa_offset 176
movb $1, t2block(%rip)
movb $1, t1block(%rip)
movb $0, t2fin(%rip)
movb $0, t1fin(%rip)
call pthread_self
xorl %ecx, %ecx
xorl %esi, %esi
movl $thread1Func, %edx
movq %rsp, %rdi
movq %rax, %rbx
call pthread_create
leaq 16(%rsp), %rdi
xorl %ecx, %ecx
xorl %esi, %esi
movl $thread2Func, %edx
call pthread_create
leaq 32(%rsp), %rdx
xorl %eax, %eax
movl $16, %ecx
movl $128, %esi
movq %rdx, %rdi
rep stosq
movq %rbx, %rdi
movq $1, 32(%rsp)
call pthread_setaffinity_np
xorl %esi, %esi
testl %eax, %eax
movl $999999, %edx
jne .L27
.L22:
movl $0, X(%rip)
movl $0, Y(%rip)
movb $0, t2fin(%rip)
movb $0, t1fin(%rip)
movb $0, t2block(%rip)
movb $0, t1block(%rip)
.p2align 4,,10
.p2align 3
.L13:
movzbl t1fin(%rip), %eax
testb %al, %al
je .L13
movzbl t2fin(%rip), %eax
testb %al, %al
je .L13
movl r1(%rip), %eax
testl %eax, %eax
jne .L15
movl r2(%rip), %eax
cmpl $1, %eax
adcl $0, %esi
.L15:
subl $1, %edx
jne .L22
movl %esi, %edi
movl $100, %eax
movl $1125899907, %ecx
imull %eax, %edi
movl %edi, %eax
sarl $31, %edi
imull %ecx
xorl %eax, %eax
movl %edx, %ecx
movl $1000000, %edx
sarl $18, %ecx
subl %edi, %ecx
movl $.LC1, %edi
call printf
addq $160, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
ret
.L27:
.cfi_restore_state
movl $.LC0, %edi
call puts
addq $160, %rsp
.cfi_def_cfa_offset 16
xorl %eax, %eax
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE24:
.size main, .-main
.comm t2fin,1,1
.comm t1fin,1,1
.comm t2block,1,1
.comm t1block,1,1
.comm r2,4,4
.comm r1,4,4
.comm Y,4,4
.comm X,4,4
.ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-37)"
.section .note.GNU-stack,"",@progbits

Event Timeline