1 .globl func_add1, func_add1_end 2 .proc func_add1 3func_add1: 4{.mib; add r8 = 1, r32 5 nop.i 0 6 br.ret.sptk.many rp 7} 8func_add1_end: 9 .endp func_add1 10 11 .globl func_add3, func_add3_end 12 .proc func_add3 13func_add3: 14{.mmi; alloc loc0 = ar.pfs, 2, 1, 2, 0 15 mov r2 = sp 16 add sp = -16, sp 17} ;; 18{.mii; ld8 r8 = [in1], 8 // load the function pointer 19 mov r3 = rp 20 mov rp = loc0 // trash rp 21} ;; 22{.mmi; ld8 r9 = [r8], 8 // load the entry-point 23 st8 [r2] = r3 24 mov out0 = in0 25} ;; 26{.mii; ld8 gp = [r8] // load the gp 27 mov b6 = r9 28 mov out1 = in1 29} 30{.mib; nop 0 31 nop 0 32 br.call.sptk rp = b6 33} 34{.mmi; add r2 = 16, sp 35 ;; 36 ld8 r3 = [r2] // r3 = saved rp 37 mov ar.pfs = loc0 38} ;; 39{.mii; nop 0 40 mov rp = r3 41 adds sp = 16, sp 42} ;; 43{.mib; st8 [sp] = in0 // trash rp save location 44 add r8 = 2, r8 45 br.ret.sptk.many rp 46} 47func_add3_end: 48 .endp func_add3 49 50 .globl func_vframe, func_vframe_end 51 .proc func_vframe 52func_vframe: 53{.mii; alloc r16 = ar.pfs, 1, 2, 0, 0 // 0 54 mov loc0 = rp 55 mov loc1 = sp 56} ;; 57{.mmi; sub sp = sp, in0 58 st8 [loc1] = r16 59 mov r2 = -99 // 0 60} ;; 61{.mii; nop 0 62 mov rp = r2 63 mov ar.pfs = r0 64} 65{.mib; mov r16 = r2 66 tbit.nz p6, p0 = in0, 4 67(p6) br.cond.sptk.many .exit 68} ;; 69{.mmi; ld8 r16 = [loc1] 70 ;; 71 mov r3 = loc0 // 8 move saved rp to r3 72 mov ar.pfs = r16 73} ;; 74{.mmi; mov sp = loc1 // 10 75 st8 [loc1] = r0 // trash saved pfs 76 mov loc0 = r2 77} ;; 78{.mib; mov r8 = 10 79 mov rp = r3 80 br.ret.sptk.many rp 81} 82.exit: 83{.mmi; ld8 r16 = [loc1] 84 ;; 85 sub sp = 32, sp 86 mov ar.pfs = r16 87} ;; 88{.mmi; mov sp = loc1 89 st8 [loc1] = r0 // trash saved pfs 90 mov rp = loc0 91} 92{.mib; nop 0 93 mov r8 = 4 94 br.ret.sptk.many rp 95} 96func_vframe_end: 97 .endp func_vframe 98 99#ifdef __linux__ 100 /* We do not need executable stack. */ 101 .section .note.GNU-stack,"",@progbits 102#endif 103