Back to home page

OSCL-LXR

 
 

    


0001 /* fls64.S: SPARC default __fls definition.
0002  *
0003  * SPARC default __fls definition, which follows the same algorithm as
0004  * in generic __fls(). This function will be boot time patched on T4
0005  * and onward.
0006  */
0007 
0008 #include <linux/linkage.h>
0009 #include <asm/export.h>
0010 
0011     .text
0012     .register   %g2, #scratch
0013     .register   %g3, #scratch
0014 ENTRY(__fls)
0015     mov -1, %g2
0016     sllx    %g2, 32, %g2
0017     and %o0, %g2, %g2
0018     brnz,pt %g2, 1f
0019      mov    63, %g1
0020     sllx    %o0, 32, %o0
0021     mov 31, %g1
0022 1:
0023     mov -1, %g2
0024     sllx    %g2, 48, %g2
0025     and %o0, %g2, %g2
0026     brnz,pt %g2, 2f
0027      mov    -1, %g2
0028     sllx    %o0, 16, %o0
0029     add %g1, -16, %g1
0030 2:
0031     mov -1, %g2
0032     sllx    %g2, 56, %g2
0033     and %o0, %g2, %g2
0034     brnz,pt %g2, 3f
0035      mov    -1, %g2
0036     sllx    %o0, 8, %o0
0037     add %g1, -8, %g1
0038 3:
0039     sllx    %g2, 60, %g2
0040     and %o0, %g2, %g2
0041     brnz,pt %g2, 4f
0042      mov    -1, %g2
0043     sllx    %o0, 4, %o0
0044     add %g1, -4, %g1
0045 4:
0046     sllx    %g2, 62, %g2
0047     and %o0, %g2, %g2
0048     brnz,pt %g2, 5f
0049      mov    -1, %g3
0050     sllx    %o0, 2, %o0
0051     add %g1, -2, %g1
0052 5:
0053     mov 0, %g2
0054     sllx    %g3, 63, %g3
0055     and %o0, %g3, %o0
0056     movre   %o0, 1, %g2
0057     sub %g1, %g2, %g1
0058     jmp %o7+8
0059      sra    %g1, 0, %o0
0060 ENDPROC(__fls)
0061 EXPORT_SYMBOL(__fls)