⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppc_dtoui.s

📁 powerpc 405 优化过的硬浮点库
💻 S
字号:
/* fpopt/ppc_dtoui.S, pl_FPE_common, pl_linux 11/24/03 16:19:32                                                                  */
/*----------------------------------------------------------------------------- */
/*  Copyright (c) 2003, IBM Corporation                                         */
/*  All rights reserved.                                                        */
/*                                                                              */
/*  Redistribution and use in source and binary forms, with or                  */
/*  without modification, are permitted provided that the following             */
/*  conditions are met:                                                         */
/*                                                                              */
/*    * Redistributions of source code must retain the above                    */
/*      copyright notice, this list of conditions and the following             */
/*      disclaimer.                                                             */
/*    * Redistributions in binary form must reproduce the above                 */
/*      copyright notice, this list of conditions and the following             */
/*      disclaimer in the documentation and/or other materials                  */
/*      provided with the distribution.                                         */
/*    * Neither the name of IBM nor the names of its contributors               */
/*      may be used to endorse or promote products derived from this            */
/*      software without specific prior written permission.                     */
/*                                                                              */
/*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND                      */
/*  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,                 */
/*  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF                    */
/*  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                    */
/*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS           */
/*  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,         */
/*  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,                    */
/*  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR          */
/*  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY         */
/*  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT                */
/*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE           */
/*  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    */
/*                                                                              */
/*----------------------------------------------------------------------------- */
/*                                                                              */
/* Function: Convert double floating point to 4-byte unsigned integer.          */
/* Input:    r3,r4(fpa)                                                         */
/* Output:   r3                                                                 */
/* Notes:   1. A stack frame is created, following ABI specification, and       */
/*             non-volatile registers are saved and restored on the stack.      */
/*          2. This is not a standard IEEE operation.                           */
/*          3. Algorithm (Wtype = signed integer and Wtype_MIN=0x80000000)      */
/*             if (fpa >= - (Wtype_MIN)                                         */
/*               return (Wtype) (fpa + Wtype_MIN) - Wtype_MIN;                  */
/*             return (Wtype) a;                                                */
/*                                                                              */
/*----------------------------------------------------------------------------- */
                    
#include <ppc4xx.inc>
#include "fpeLib.inc"

function_prolog(__fixunsdfsi)

/* For negative numbers, just convert to signed integer */
     or.     r3,r3,r3      
     blt     __fixdfsi               /* return directly from there */      
     
     rlwinm  r8,r3,12,0x000007FF      /* extract exponent */
/* For numbers less than maximum positive signed integer, convert normally */     
     cmpwi   r8, 0x041e     
     blt     __fixdfsi               /* return directly form there */
     
/* Create stack frame, just to save link register! */
     mflr    r0                      /* save link register in caller's stack */
     stw     r0,4(r1)               
     stwu    r1,-STACKSIZE(r1)       /* set up stack frame to hold saved regs */

/* floating add the minimum signed integer value */     
     lis     r5,0xC1E0                    
     xor     r6,r6,r6
     bl      __adddf3
     
/* convert result to signed integer */
     bl      __fixdfsi   
     
/* add minimum signed integer value */
     addis   r3,r3,0x8000       
     
/* restore link register, and return */  
     lwz     r1,0(r1)                /* previous stack frame */
     lwz     r0,4(r1)                /* saved link register */
     mtlr    r0                      /* restore link register */
     blr                             /* return */
function_epilog(__fixunsdfsi)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -