Blame thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/driver/others/lamch.c

kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
/* Copyright 2009, 2010 The University of Texas at Austin.           */
kusano 2b45e8
/* All rights reserved.                                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* Redistribution and use in source and binary forms, with or        */
kusano 2b45e8
/* without modification, are permitted provided that the following   */
kusano 2b45e8
/* conditions are met:                                               */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   1. Redistributions of source code must retain the above         */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer.                                                  */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   2. Redistributions in binary form must reproduce the above      */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer in the documentation and/or other materials       */
kusano 2b45e8
/*      provided with the distribution.                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
kusano 2b45e8
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
kusano 2b45e8
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
kusano 2b45e8
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
kusano 2b45e8
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
kusano 2b45e8
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
kusano 2b45e8
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
kusano 2b45e8
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
kusano 2b45e8
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
kusano 2b45e8
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
kusano 2b45e8
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
kusano 2b45e8
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
kusano 2b45e8
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
kusano 2b45e8
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* The views and conclusions contained in the software and           */
kusano 2b45e8
/* documentation are those of the authors and should not be          */
kusano 2b45e8
/* interpreted as representing official policies, either expressed   */
kusano 2b45e8
/* or implied, of The University of Texas at Austin.                 */
kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
kusano 2b45e8
#include "common.h"
kusano 2b45e8
kusano 2b45e8
#if 0
kusano 2b45e8
static FLOAT hdata[] __attribute__((aligned(128))) = {
kusano 2b45e8
#ifdef XDOUBLE
kusano 2b45e8
  +0x1.0000000000000000P-00064L,
kusano 2b45e8
  +0x1.0000000000000000P-16382L,
kusano 2b45e8
  +0x1.0000000000000000P+00001L,
kusano 2b45e8
  +0x1.0000000000000000P-00063L,
kusano 2b45e8
  +0x1.0000000000000000P+00006L,
kusano 2b45e8
  +0x1.0000000000000000P+00000L,
kusano 2b45e8
  -0x1.ffe8000000000000P+00013L,
kusano 2b45e8
  +0x1.0000000000000000P-16382L,
kusano 2b45e8
  +0x1.0004000000000000P+00014L,
kusano 2b45e8
  +0x1.fffffffffffffffeP+16383L,
kusano 2b45e8
#elif defined DOUBLE
kusano 2b45e8
  +0x1.0000000000000P-0053,
kusano 2b45e8
  +0x1.0000000000000P-1022,
kusano 2b45e8
  +0x1.0000000000000P+0001,
kusano 2b45e8
  +0x1.0000000000000P-0052,
kusano 2b45e8
  +0x1.a800000000000P+0005,
kusano 2b45e8
  +0x1.0000000000000P+0000,
kusano 2b45e8
  -0x1.fe80000000000P+0009,
kusano 2b45e8
  +0x1.0000000000000P-1022,
kusano 2b45e8
  +0x1.0000000000000P+0010,
kusano 2b45e8
  +0x1.fffffffffffffP+1023,
kusano 2b45e8
#else
kusano 2b45e8
  +0x1.000000P-024f,
kusano 2b45e8
  +0x1.000000P-126f,
kusano 2b45e8
  +0x1.000000P+001f,
kusano 2b45e8
  +0x1.000000P-023f,
kusano 2b45e8
  +0x1.800000P+004f,
kusano 2b45e8
  +0x1.000000P+000f,
kusano 2b45e8
  -0x1.f40000P+006f,
kusano 2b45e8
  +0x1.000000P-126f,
kusano 2b45e8
  +0x1.000000P+007f,
kusano 2b45e8
  +0x1.fffffeP+127f,
kusano 2b45e8
#endif
kusano 2b45e8
};
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
static unsigned int idata[] __attribute__((aligned(128))) = {
kusano 2b45e8
kusano 2b45e8
#if   defined XDOUBLE
kusano 2b45e8
#ifndef __BIG_ENDIAN__
kusano 2b45e8
  0x00000000, 0x80000000, 0x00003fbf, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00000001, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00004000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00003fc0, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00004005, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00003fff, 0x00000000,
kusano 2b45e8
  0x00000000, 0xff400000, 0x0000c00c, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80000000, 0x00000001, 0x00000000,
kusano 2b45e8
  0x00000000, 0x80200000, 0x0000400d, 0x00000000,
kusano 2b45e8
  0xffffffff, 0xffffffff, 0x00007ffe, 0x00000000,
kusano 2b45e8
#else
kusano 2b45e8
  0x00000000, 0x00003fbf, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00000001, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00004000, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00003fc0, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00004005, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00003fff, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x0000c00c, 0xff400000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00000001, 0x80000000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x0000400d, 0x80200000, 0x00000000,
kusano 2b45e8
  0x00000000, 0x00007ffe, 0xffffffff, 0xffffffff,
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
#elif defined DOUBLE
kusano 2b45e8
#ifndef __BIG_ENDIAN__
kusano 2b45e8
  0x00000000, 0x3ca00000,
kusano 2b45e8
  0x00000000, 0x00100000,
kusano 2b45e8
  0x00000000, 0x40000000,
kusano 2b45e8
  0x00000000, 0x3cb00000,
kusano 2b45e8
  0x00000000, 0x404a8000,
kusano 2b45e8
  0x00000000, 0x3ff00000,
kusano 2b45e8
  0x00000000, 0xc08fe800,
kusano 2b45e8
  0x00000000, 0x00100000,
kusano 2b45e8
  0x00000000, 0x40900000,
kusano 2b45e8
  0xffffffff, 0x7fefffff,
kusano 2b45e8
#else
kusano 2b45e8
  0x3ca00000, 0x00000000,
kusano 2b45e8
  0x00100000, 0x00000000,
kusano 2b45e8
  0x40000000, 0x00000000,
kusano 2b45e8
  0x3cb00000, 0x00000000,
kusano 2b45e8
  0x404a8000, 0x00000000,
kusano 2b45e8
  0x3ff00000, 0x00000000,
kusano 2b45e8
  0xc08fe800, 0x00000000,
kusano 2b45e8
  0x00100000, 0x00000000,
kusano 2b45e8
  0x40900000, 0x00000000,
kusano 2b45e8
  0x7fefffff, 0xffffffff,
kusano 2b45e8
#endif
kusano 2b45e8
#else
kusano 2b45e8
kusano 2b45e8
  0x33800000,
kusano 2b45e8
  0x00800000,
kusano 2b45e8
  0x40000000,
kusano 2b45e8
  0x34000000,
kusano 2b45e8
  0x41c00000,
kusano 2b45e8
  0x3f800000,
kusano 2b45e8
  0xc2fa0000,
kusano 2b45e8
  0x00800000,
kusano 2b45e8
  0x43000000,
kusano 2b45e8
  0x7f7fffff,
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
};
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
#ifdef NEED_F2CCONV
kusano 2b45e8
double
kusano 2b45e8
#else
kusano 2b45e8
FLOAT
kusano 2b45e8
#endif
kusano 2b45e8
NAME(char *P){
kusano 2b45e8
  
kusano 2b45e8
  char p = *P;
kusano 2b45e8
  int pos;
kusano 2b45e8
  FLOAT *hdata = (FLOAT *)idata;
kusano 2b45e8
kusano 2b45e8
  TOUPPER(p);
kusano 2b45e8
kusano 2b45e8
  switch (p) {
kusano 2b45e8
  case 'E':
kusano 2b45e8
    pos = 0;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'S':
kusano 2b45e8
    pos = 1;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'B':
kusano 2b45e8
    pos = 2;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'P':
kusano 2b45e8
    pos = 3;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'N':
kusano 2b45e8
    pos = 4;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'R':
kusano 2b45e8
    pos = 5;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'M':
kusano 2b45e8
    pos = 6;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'U':
kusano 2b45e8
    pos = 7;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'L':
kusano 2b45e8
    pos = 8;
kusano 2b45e8
    break;
kusano 2b45e8
  case 'O':
kusano 2b45e8
    pos = 9;
kusano 2b45e8
    break;
kusano 2b45e8
  default:
kusano 2b45e8
    pos = 0;
kusano 2b45e8
    break;
kusano 2b45e8
  }
kusano 2b45e8
kusano 2b45e8
 return hdata[pos];
kusano 2b45e8
kusano 2b45e8
}