1f81b1c5bSmrgdnl PowerPC-64 mpn_invert_limb -- Invert a normalized limb. 2f81b1c5bSmrg 3*671ea119Smrgdnl Copyright 2015, 2017 Free Software Foundation, Inc. 4f81b1c5bSmrg 5f81b1c5bSmrgdnl This file is part of the GNU MP Library. 6f81b1c5bSmrgdnl 7f81b1c5bSmrgdnl The GNU MP Library is free software; you can redistribute it and/or modify 8f81b1c5bSmrgdnl it under the terms of either: 9f81b1c5bSmrgdnl 10f81b1c5bSmrgdnl * the GNU Lesser General Public License as published by the Free 11f81b1c5bSmrgdnl Software Foundation; either version 3 of the License, or (at your 12f81b1c5bSmrgdnl option) any later version. 13f81b1c5bSmrgdnl 14f81b1c5bSmrgdnl or 15f81b1c5bSmrgdnl 16f81b1c5bSmrgdnl * the GNU General Public License as published by the Free Software 17f81b1c5bSmrgdnl Foundation; either version 2 of the License, or (at your option) any 18f81b1c5bSmrgdnl later version. 19f81b1c5bSmrgdnl 20f81b1c5bSmrgdnl or both in parallel, as here. 21f81b1c5bSmrgdnl 22f81b1c5bSmrgdnl The GNU MP Library is distributed in the hope that it will be useful, but 23f81b1c5bSmrgdnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24f81b1c5bSmrgdnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25f81b1c5bSmrgdnl for more details. 26f81b1c5bSmrgdnl 27f81b1c5bSmrgdnl You should have received copies of the GNU General Public License and the 28f81b1c5bSmrgdnl GNU Lesser General Public License along with the GNU MP Library. If not, 29f81b1c5bSmrgdnl see https://www.gnu.org/licenses/. 30f81b1c5bSmrg 31f81b1c5bSmrginclude(`../config.m4') 32f81b1c5bSmrg 33f81b1c5bSmrgC cycles/limb (approximate) 34f81b1c5bSmrgC POWER3/PPC630 - 35f81b1c5bSmrgC POWER4/PPC970 - 36f81b1c5bSmrgC POWER5 - 37f81b1c5bSmrgC POWER6 - 38f81b1c5bSmrgC POWER7 ? 39f81b1c5bSmrgC POWER8 32 40f81b1c5bSmrg 41f81b1c5bSmrgC This runs on POWER7 and later, but is faster only on later CPUs. 42f81b1c5bSmrgC We might want to inline this, considering its small footprint. 43f81b1c5bSmrg 44f81b1c5bSmrgASM_START() 45f81b1c5bSmrgPROLOGUE(mpn_invert_limb) 46f81b1c5bSmrg sldi. r4, r3, 1 47f81b1c5bSmrg neg r5, r3 48*671ea119Smrg divdeu( r3, r5, r3) 49f81b1c5bSmrg beq- L(1) 50f81b1c5bSmrg blr 51f81b1c5bSmrgL(1): li r3, -1 52f81b1c5bSmrg blr 53f81b1c5bSmrgEPILOGUE() 54