~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to arch/sparc/lib/ffs.S

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <linux/linkage.h>
 
2
 
 
3
        .register       %g2,#scratch
 
4
 
 
5
        .text
 
6
        .align  32
 
7
 
 
8
ENTRY(ffs)
 
9
        brnz,pt %o0, 1f
 
10
         mov    1, %o1
 
11
        retl
 
12
         clr    %o0
 
13
        nop
 
14
        nop
 
15
ENTRY(__ffs)
 
16
        sllx    %o0, 32, %g1            /* 1  */
 
17
        srlx    %o0, 32, %g2
 
18
 
 
19
        clr     %o1                     /* 2  */
 
20
        movrz   %g1, %g2, %o0
 
21
 
 
22
        movrz   %g1, 32, %o1            /* 3  */
 
23
1:      clr     %o2
 
24
 
 
25
        sllx    %o0, (64 - 16), %g1     /* 4  */
 
26
        srlx    %o0, 16, %g2
 
27
 
 
28
        movrz   %g1, %g2, %o0           /* 5  */
 
29
        clr     %o3
 
30
 
 
31
        movrz   %g1, 16, %o2            /* 6  */
 
32
        clr     %o4
 
33
 
 
34
        and     %o0, 0xff, %g1          /* 7  */
 
35
        srlx    %o0, 8, %g2
 
36
 
 
37
        movrz   %g1, %g2, %o0           /* 8  */
 
38
        clr     %o5
 
39
 
 
40
        movrz   %g1, 8, %o3             /* 9  */
 
41
        add     %o2, %o1, %o2
 
42
 
 
43
        and     %o0, 0xf, %g1           /* 10 */
 
44
        srlx    %o0, 4, %g2
 
45
 
 
46
        movrz   %g1, %g2, %o0           /* 11 */
 
47
        add     %o2, %o3, %o2
 
48
 
 
49
        movrz   %g1, 4, %o4             /* 12 */
 
50
 
 
51
        and     %o0, 0x3, %g1           /* 13 */
 
52
        srlx    %o0, 2, %g2
 
53
 
 
54
        movrz   %g1, %g2, %o0           /* 14 */
 
55
        add     %o2, %o4, %o2
 
56
 
 
57
        movrz   %g1, 2, %o5             /* 15 */
 
58
 
 
59
        and     %o0, 0x1, %g1           /* 16 */
 
60
 
 
61
        add     %o2, %o5, %o2           /* 17 */
 
62
        xor     %g1, 0x1, %g1
 
63
 
 
64
        retl                            /* 18 */
 
65
         add    %o2, %g1, %o0
 
66
ENDPROC(ffs)
 
67
ENDPROC(__ffs)
 
68
 
 
69
        .section        .popc_6insn_patch, "ax"
 
70
        .word           ffs
 
71
        brz,pn  %o0, 98f
 
72
         neg    %o0, %g1
 
73
        xnor    %o0, %g1, %o1
 
74
        popc    %o1, %o0
 
75
98:     retl
 
76
         nop
 
77
        .word           __ffs
 
78
        neg     %o0, %g1
 
79
        xnor    %o0, %g1, %o1
 
80
        popc    %o1, %o0
 
81
        retl
 
82
         sub    %o0, 1, %o0
 
83
        nop
 
84
        .previous