1/* Contract for all versions is same as cas.l r2,r3,@r0 2 * pr and r1 are also clobbered (by jsr & r1 as temp). 3 * r0,r2,r4-r15 must be preserved. 4 * r3 contains result (==r2 iff cas succeeded). */ 5 6 .align 2 7.global __sh_cas_gusa 8.hidden __sh_cas_gusa 9__sh_cas_gusa: 10 mov.l r5,@-r15 11 mov.l r4,@-r15 12 mov r0,r4 13 mova 1f,r0 14 mov r15,r1 15 mov #(0f-1f),r15 160: mov.l @r4,r5 17 cmp/eq r5,r2 18 bf 1f 19 mov.l r3,@r4 201: mov r1,r15 21 mov r5,r3 22 mov r4,r0 23 mov.l @r15+,r4 24 rts 25 mov.l @r15+,r5 26 27.global __sh_cas_llsc 28.hidden __sh_cas_llsc 29__sh_cas_llsc: 30 mov r0,r1 31 .word 0x00ab /* synco */ 320: .word 0x0163 /* movli.l @r1,r0 */ 33 cmp/eq r0,r2 34 bf 1f 35 mov r3,r0 36 .word 0x0173 /* movco.l r0,@r1 */ 37 bf 0b 38 mov r2,r0 391: .word 0x00ab /* synco */ 40 mov r0,r3 41 rts 42 mov r1,r0 43 44.global __sh_cas_imask 45.hidden __sh_cas_imask 46__sh_cas_imask: 47 mov r0,r1 48 stc sr,r0 49 mov.l r0,@-r15 50 or #0xf0,r0 51 ldc r0,sr 52 mov.l @r1,r0 53 cmp/eq r0,r2 54 bf 1f 55 mov.l r3,@r1 561: ldc.l @r15+,sr 57 mov r0,r3 58 rts 59 mov r1,r0 60 61.global __sh_cas_cas_l 62.hidden __sh_cas_cas_l 63__sh_cas_cas_l: 64 rts 65 .word 0x2323 /* cas.l r2,r3,@r0 */ 66