Vijay Kumar | 70cbec0 | 2017-10-11 12:50:04 -0600 | [diff] [blame] | 1 | /* NG4fls.S: SPARC optimized fls and __fls for T4 and above. |
| 2 | * |
| 3 | * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #include <linux/linkage.h> |
| 7 | |
| 8 | #define LZCNT_O0_G2 \ |
| 9 | .word 0x85b002e8 |
| 10 | |
| 11 | .text |
| 12 | .register %g2, #scratch |
| 13 | .register %g3, #scratch |
| 14 | |
| 15 | ENTRY(NG4fls) |
| 16 | LZCNT_O0_G2 !lzcnt %o0, %g2 |
| 17 | mov 64, %g3 |
| 18 | retl |
| 19 | sub %g3, %g2, %o0 |
| 20 | ENDPROC(NG4fls) |
Vijay Kumar | 2b41ce5 | 2017-10-11 12:50:05 -0600 | [diff] [blame] | 21 | |
| 22 | ENTRY(__NG4fls) |
| 23 | brz,pn %o0, 1f |
| 24 | LZCNT_O0_G2 !lzcnt %o0, %g2 |
| 25 | mov 63, %g3 |
| 26 | sub %g3, %g2, %o0 |
| 27 | 1: |
| 28 | retl |
| 29 | nop |
| 30 | ENDPROC(__NG4fls) |