1*0b57cec5SDimitry Andric//===----------------------Hexagon builtin routine ------------------------===// 2*0b57cec5SDimitry Andric// 3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric// 7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric/* ==================================================================== */ 9*0b57cec5SDimitry Andric/* FUNCTIONS Optimized double floating point operators */ 10*0b57cec5SDimitry Andric/* ==================================================================== */ 11*0b57cec5SDimitry Andric/* c = dadd_asm(a, b) */ 12*0b57cec5SDimitry Andric/* ==================================================================== 13*0b57cec5SDimitry Andric 14*0b57cec5SDimitry AndricQDOUBLE dadd(QDOUBLE a,QDOUBLE b) { 15*0b57cec5SDimitry Andric QDOUBLE c; 16*0b57cec5SDimitry Andric lint manta = a & MANTMASK; 17*0b57cec5SDimitry Andric int expa = HEXAGON_R_sxth_R(a) ; 18*0b57cec5SDimitry Andric lint mantb = b & MANTMASK; 19*0b57cec5SDimitry Andric int expb = HEXAGON_R_sxth_R(b) ; 20*0b57cec5SDimitry Andric int exp, expdiff, j, k, hi, lo, cn; 21*0b57cec5SDimitry Andric lint mant; 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric expdiff = (int) HEXAGON_P_vabsdiffh_PP(a, b); 24*0b57cec5SDimitry Andric expdiff = HEXAGON_R_sxth_R(expdiff) ; 25*0b57cec5SDimitry Andric if (expdiff > 63) { expdiff = 62;} 26*0b57cec5SDimitry Andric if (expa > expb) { 27*0b57cec5SDimitry Andric exp = expa + 1; 28*0b57cec5SDimitry Andric expa = 1; 29*0b57cec5SDimitry Andric expb = expdiff + 1; 30*0b57cec5SDimitry Andric } else { 31*0b57cec5SDimitry Andric exp = expb + 1; 32*0b57cec5SDimitry Andric expb = 1; 33*0b57cec5SDimitry Andric expa = expdiff + 1; 34*0b57cec5SDimitry Andric } 35*0b57cec5SDimitry Andric mant = (manta>>expa) + (mantb>>expb); 36*0b57cec5SDimitry Andric 37*0b57cec5SDimitry Andric hi = (int) (mant>>32); 38*0b57cec5SDimitry Andric lo = (int) (mant); 39*0b57cec5SDimitry Andric 40*0b57cec5SDimitry Andric k = HEXAGON_R_normamt_R(hi); 41*0b57cec5SDimitry Andric if(hi == 0 || hi == -1) k = 31+HEXAGON_R_normamt_R(lo); 42*0b57cec5SDimitry Andric 43*0b57cec5SDimitry Andric mant = (mant << k); 44*0b57cec5SDimitry Andric cn = (mant == 0x8000000000000000LL); 45*0b57cec5SDimitry Andric exp = exp - k + cn; 46*0b57cec5SDimitry Andric 47*0b57cec5SDimitry Andric if (mant == 0 || mant == -1) exp = 0x8001; 48*0b57cec5SDimitry Andric c = (mant & MANTMASK) | (((lint) exp) & EXP_MASK); 49*0b57cec5SDimitry Andric return(c); 50*0b57cec5SDimitry Andric } 51*0b57cec5SDimitry Andric * ==================================================================== */ 52*0b57cec5SDimitry Andric .text 53*0b57cec5SDimitry Andric .global dadd_asm 54*0b57cec5SDimitry Andric .type dadd_asm, @function 55*0b57cec5SDimitry Andricdadd_asm: 56*0b57cec5SDimitry Andric 57*0b57cec5SDimitry Andric#define manta R0 58*0b57cec5SDimitry Andric#define mantexpa R1:0 59*0b57cec5SDimitry Andric#define lmanta R1:0 60*0b57cec5SDimitry Andric#define mantb R2 61*0b57cec5SDimitry Andric#define mantexpb R3:2 62*0b57cec5SDimitry Andric#define lmantb R3:2 63*0b57cec5SDimitry Andric#define expa R4 64*0b57cec5SDimitry Andric#define expb R5 65*0b57cec5SDimitry Andric#define mantexpd R7:6 66*0b57cec5SDimitry Andric#define expd R6 67*0b57cec5SDimitry Andric#define exp R8 68*0b57cec5SDimitry Andric#define c63 R9 69*0b57cec5SDimitry Andric#define lmant R1:0 70*0b57cec5SDimitry Andric#define manth R1 71*0b57cec5SDimitry Andric#define mantl R0 72*0b57cec5SDimitry Andric#define zero R7:6 73*0b57cec5SDimitry Andric#define zerol R6 74*0b57cec5SDimitry Andric#define minus R3:2 75*0b57cec5SDimitry Andric#define minusl R2 76*0b57cec5SDimitry Andric#define maxneg R9 77*0b57cec5SDimitry Andric#define minmin R11:10 // exactly 0x800000000000000000LL 78*0b57cec5SDimitry Andric#define minminh R11 79*0b57cec5SDimitry Andric#define k R4 80*0b57cec5SDimitry Andric#define kl R5 81*0b57cec5SDimitry Andric#define ce P0 82*0b57cec5SDimitry Andric .falign 83*0b57cec5SDimitry Andric { 84*0b57cec5SDimitry Andric mantexpd = VABSDIFFH(mantexpa, mantexpb) //represented as 0x08001LL 85*0b57cec5SDimitry Andric c63 = #62 86*0b57cec5SDimitry Andric expa = SXTH(manta) 87*0b57cec5SDimitry Andric expb = SXTH(mantb) 88*0b57cec5SDimitry Andric } { 89*0b57cec5SDimitry Andric expd = SXTH(expd) 90*0b57cec5SDimitry Andric ce = CMP.GT(expa, expb); 91*0b57cec5SDimitry Andric if ( ce.new) exp = add(expa, #1) 92*0b57cec5SDimitry Andric if (!ce.new) exp = add(expb, #1) 93*0b57cec5SDimitry Andric } { 94*0b57cec5SDimitry Andric if ( ce) expa = #1 95*0b57cec5SDimitry Andric if (!ce) expb = #1 96*0b57cec5SDimitry Andric manta.L = #0 97*0b57cec5SDimitry Andric expd = MIN(expd, c63) 98*0b57cec5SDimitry Andric } { 99*0b57cec5SDimitry Andric if (!ce) expa = add(expd, #1) 100*0b57cec5SDimitry Andric if ( ce) expb = add(expd, #1) 101*0b57cec5SDimitry Andric mantb.L = #0 102*0b57cec5SDimitry Andric zero = #0 103*0b57cec5SDimitry Andric } { 104*0b57cec5SDimitry Andric lmanta = ASR(lmanta, expa) 105*0b57cec5SDimitry Andric lmantb = ASR(lmantb, expb) 106*0b57cec5SDimitry Andric minmin = #0 107*0b57cec5SDimitry Andric } { 108*0b57cec5SDimitry Andric lmant = add(lmanta, lmantb) 109*0b57cec5SDimitry Andric minus = #-1 110*0b57cec5SDimitry Andric minminh.H = #0x8000 111*0b57cec5SDimitry Andric } { 112*0b57cec5SDimitry Andric k = NORMAMT(manth) 113*0b57cec5SDimitry Andric kl = NORMAMT(mantl) 114*0b57cec5SDimitry Andric p0 = cmp.eq(manth, zerol) 115*0b57cec5SDimitry Andric p1 = cmp.eq(manth, minusl) 116*0b57cec5SDimitry Andric } { 117*0b57cec5SDimitry Andric p0 = OR(p0, p1) 118*0b57cec5SDimitry Andric if(p0.new) k = add(kl, #31) 119*0b57cec5SDimitry Andric maxneg.H = #0 120*0b57cec5SDimitry Andric } { 121*0b57cec5SDimitry Andric mantexpa = ASL(lmant, k) 122*0b57cec5SDimitry Andric exp = SUB(exp, k) 123*0b57cec5SDimitry Andric maxneg.L = #0x8001 124*0b57cec5SDimitry Andric } { 125*0b57cec5SDimitry Andric p0 = cmp.eq(mantexpa, zero) 126*0b57cec5SDimitry Andric p1 = cmp.eq(mantexpa, minus) 127*0b57cec5SDimitry Andric manta.L = #0 128*0b57cec5SDimitry Andric exp = ZXTH(exp) 129*0b57cec5SDimitry Andric } { 130*0b57cec5SDimitry Andric p2 = cmp.eq(mantexpa, minmin) //is result 0x80....0 131*0b57cec5SDimitry Andric if(p2.new) exp = add(exp, #1) 132*0b57cec5SDimitry Andric } 133*0b57cec5SDimitry Andric#if (__HEXAGON_ARCH__ == 60) 134*0b57cec5SDimitry Andric { 135*0b57cec5SDimitry Andric p0 = OR(p0, p1) 136*0b57cec5SDimitry Andric if( p0.new) manta = OR(manta,maxneg) 137*0b57cec5SDimitry Andric if(!p0.new) manta = OR(manta,exp) 138*0b57cec5SDimitry Andric } 139*0b57cec5SDimitry Andric jumpr r31 140*0b57cec5SDimitry Andric#else 141*0b57cec5SDimitry Andric { 142*0b57cec5SDimitry Andric p0 = OR(p0, p1) 143*0b57cec5SDimitry Andric if( p0.new) manta = OR(manta,maxneg) 144*0b57cec5SDimitry Andric if(!p0.new) manta = OR(manta,exp) 145*0b57cec5SDimitry Andric jumpr r31 146*0b57cec5SDimitry Andric } 147*0b57cec5SDimitry Andric#endif 148*0b57cec5SDimitry Andric/* =================================================================== * 149*0b57cec5SDimitry Andric QDOUBLE dsub(QDOUBLE a,QDOUBLE b) { 150*0b57cec5SDimitry Andric QDOUBLE c; 151*0b57cec5SDimitry Andric lint manta = a & MANTMASK; 152*0b57cec5SDimitry Andric int expa = HEXAGON_R_sxth_R(a) ; 153*0b57cec5SDimitry Andric lint mantb = b & MANTMASK; 154*0b57cec5SDimitry Andric int expb = HEXAGON_R_sxth_R(b) ; 155*0b57cec5SDimitry Andric int exp, expdiff, j, k, hi, lo, cn; 156*0b57cec5SDimitry Andric lint mant; 157*0b57cec5SDimitry Andric 158*0b57cec5SDimitry Andric expdiff = (int) HEXAGON_P_vabsdiffh_PP(a, b); 159*0b57cec5SDimitry Andric expdiff = HEXAGON_R_sxth_R(expdiff) ; 160*0b57cec5SDimitry Andric if (expdiff > 63) { expdiff = 62;} 161*0b57cec5SDimitry Andric if (expa > expb) { 162*0b57cec5SDimitry Andric exp = expa + 1; 163*0b57cec5SDimitry Andric expa = 1; 164*0b57cec5SDimitry Andric expb = expdiff + 1; 165*0b57cec5SDimitry Andric } else { 166*0b57cec5SDimitry Andric exp = expb + 1; 167*0b57cec5SDimitry Andric expb = 1; 168*0b57cec5SDimitry Andric expa = expdiff + 1; 169*0b57cec5SDimitry Andric } 170*0b57cec5SDimitry Andric mant = (manta>>expa) - (mantb>>expb); 171*0b57cec5SDimitry Andric 172*0b57cec5SDimitry Andric hi = (int) (mant>>32); 173*0b57cec5SDimitry Andric lo = (int) (mant); 174*0b57cec5SDimitry Andric 175*0b57cec5SDimitry Andric k = HEXAGON_R_normamt_R(hi); 176*0b57cec5SDimitry Andric if(hi == 0 || hi == -1) k = 31+HEXAGON_R_normamt_R(lo); 177*0b57cec5SDimitry Andric 178*0b57cec5SDimitry Andric mant = (mant << k); 179*0b57cec5SDimitry Andric cn = (mant == 0x8000000000000000LL); 180*0b57cec5SDimitry Andric exp = exp - k + cn; 181*0b57cec5SDimitry Andric 182*0b57cec5SDimitry Andric if (mant == 0 || mant == -1) exp = 0x8001; 183*0b57cec5SDimitry Andric c = (mant & MANTMASK) | (((lint) exp) & EXP_MASK); 184*0b57cec5SDimitry Andric return(c); 185*0b57cec5SDimitry Andric } 186*0b57cec5SDimitry Andric * ==================================================================== */ 187*0b57cec5SDimitry Andric .text 188*0b57cec5SDimitry Andric .global dsub_asm 189*0b57cec5SDimitry Andric .type dsub_asm, @function 190*0b57cec5SDimitry Andricdsub_asm: 191*0b57cec5SDimitry Andric 192*0b57cec5SDimitry Andric#define manta R0 193*0b57cec5SDimitry Andric#define mantexpa R1:0 194*0b57cec5SDimitry Andric#define lmanta R1:0 195*0b57cec5SDimitry Andric#define mantb R2 196*0b57cec5SDimitry Andric#define mantexpb R3:2 197*0b57cec5SDimitry Andric#define lmantb R3:2 198*0b57cec5SDimitry Andric#define expa R4 199*0b57cec5SDimitry Andric#define expb R5 200*0b57cec5SDimitry Andric#define mantexpd R7:6 201*0b57cec5SDimitry Andric#define expd R6 202*0b57cec5SDimitry Andric#define exp R8 203*0b57cec5SDimitry Andric#define c63 R9 204*0b57cec5SDimitry Andric#define lmant R1:0 205*0b57cec5SDimitry Andric#define manth R1 206*0b57cec5SDimitry Andric#define mantl R0 207*0b57cec5SDimitry Andric#define zero R7:6 208*0b57cec5SDimitry Andric#define zerol R6 209*0b57cec5SDimitry Andric#define minus R3:2 210*0b57cec5SDimitry Andric#define minusl R2 211*0b57cec5SDimitry Andric#define maxneg R9 212*0b57cec5SDimitry Andric#define minmin R11:10 // exactly 0x800000000000000000LL 213*0b57cec5SDimitry Andric#define minminh R11 214*0b57cec5SDimitry Andric#define k R4 215*0b57cec5SDimitry Andric#define kl R5 216*0b57cec5SDimitry Andric#define ce P0 217*0b57cec5SDimitry Andric .falign 218*0b57cec5SDimitry Andric { 219*0b57cec5SDimitry Andric mantexpd = VABSDIFFH(mantexpa, mantexpb) //represented as 0x08001LL 220*0b57cec5SDimitry Andric c63 = #62 221*0b57cec5SDimitry Andric expa = SXTH(manta) 222*0b57cec5SDimitry Andric expb = SXTH(mantb) 223*0b57cec5SDimitry Andric } { 224*0b57cec5SDimitry Andric expd = SXTH(expd) 225*0b57cec5SDimitry Andric ce = CMP.GT(expa, expb); 226*0b57cec5SDimitry Andric if ( ce.new) exp = add(expa, #1) 227*0b57cec5SDimitry Andric if (!ce.new) exp = add(expb, #1) 228*0b57cec5SDimitry Andric } { 229*0b57cec5SDimitry Andric if ( ce) expa = #1 230*0b57cec5SDimitry Andric if (!ce) expb = #1 231*0b57cec5SDimitry Andric manta.L = #0 232*0b57cec5SDimitry Andric expd = MIN(expd, c63) 233*0b57cec5SDimitry Andric } { 234*0b57cec5SDimitry Andric if (!ce) expa = add(expd, #1) 235*0b57cec5SDimitry Andric if ( ce) expb = add(expd, #1) 236*0b57cec5SDimitry Andric mantb.L = #0 237*0b57cec5SDimitry Andric zero = #0 238*0b57cec5SDimitry Andric } { 239*0b57cec5SDimitry Andric lmanta = ASR(lmanta, expa) 240*0b57cec5SDimitry Andric lmantb = ASR(lmantb, expb) 241*0b57cec5SDimitry Andric minmin = #0 242*0b57cec5SDimitry Andric } { 243*0b57cec5SDimitry Andric lmant = sub(lmanta, lmantb) 244*0b57cec5SDimitry Andric minus = #-1 245*0b57cec5SDimitry Andric minminh.H = #0x8000 246*0b57cec5SDimitry Andric } { 247*0b57cec5SDimitry Andric k = NORMAMT(manth) 248*0b57cec5SDimitry Andric kl = NORMAMT(mantl) 249*0b57cec5SDimitry Andric p0 = cmp.eq(manth, zerol) 250*0b57cec5SDimitry Andric p1 = cmp.eq(manth, minusl) 251*0b57cec5SDimitry Andric } { 252*0b57cec5SDimitry Andric p0 = OR(p0, p1) 253*0b57cec5SDimitry Andric if(p0.new) k = add(kl, #31) 254*0b57cec5SDimitry Andric maxneg.H = #0 255*0b57cec5SDimitry Andric } { 256*0b57cec5SDimitry Andric mantexpa = ASL(lmant, k) 257*0b57cec5SDimitry Andric exp = SUB(exp, k) 258*0b57cec5SDimitry Andric maxneg.L = #0x8001 259*0b57cec5SDimitry Andric } { 260*0b57cec5SDimitry Andric p0 = cmp.eq(mantexpa, zero) 261*0b57cec5SDimitry Andric p1 = cmp.eq(mantexpa, minus) 262*0b57cec5SDimitry Andric manta.L = #0 263*0b57cec5SDimitry Andric exp = ZXTH(exp) 264*0b57cec5SDimitry Andric } { 265*0b57cec5SDimitry Andric p2 = cmp.eq(mantexpa, minmin) //is result 0x80....0 266*0b57cec5SDimitry Andric if(p2.new) exp = add(exp, #1) 267*0b57cec5SDimitry Andric } 268*0b57cec5SDimitry Andric#if (__HEXAGON_ARCH__ == 60) 269*0b57cec5SDimitry Andric { 270*0b57cec5SDimitry Andric p0 = OR(p0, p1) 271*0b57cec5SDimitry Andric if( p0.new) manta = OR(manta,maxneg) 272*0b57cec5SDimitry Andric if(!p0.new) manta = OR(manta,exp) 273*0b57cec5SDimitry Andric } 274*0b57cec5SDimitry Andric jumpr r31 275*0b57cec5SDimitry Andric#else 276*0b57cec5SDimitry Andric { 277*0b57cec5SDimitry Andric p0 = OR(p0, p1) 278*0b57cec5SDimitry Andric if( p0.new) manta = OR(manta,maxneg) 279*0b57cec5SDimitry Andric if(!p0.new) manta = OR(manta,exp) 280*0b57cec5SDimitry Andric jumpr r31 281*0b57cec5SDimitry Andric } 282*0b57cec5SDimitry Andric#endif 283*0b57cec5SDimitry Andric/* ==================================================================== * 284*0b57cec5SDimitry Andric QDOUBLE dmpy(QDOUBLE a,QDOUBLE b) { 285*0b57cec5SDimitry Andric QDOUBLE c; 286*0b57cec5SDimitry Andric lint manta = a & MANTMASK; 287*0b57cec5SDimitry Andric int expa = HEXAGON_R_sxth_R(a) ; 288*0b57cec5SDimitry Andric lint mantb = b & MANTMASK; 289*0b57cec5SDimitry Andric int expb = HEXAGON_R_sxth_R(b) ; 290*0b57cec5SDimitry Andric int exp, k; 291*0b57cec5SDimitry Andric lint mant; 292*0b57cec5SDimitry Andric int hia, hib, hi, lo; 293*0b57cec5SDimitry Andric unsigned int loa, lob; 294*0b57cec5SDimitry Andric 295*0b57cec5SDimitry Andric hia = (int)(a >> 32); 296*0b57cec5SDimitry Andric loa = HEXAGON_R_extractu_RII((int)manta, 31, 1); 297*0b57cec5SDimitry Andric hib = (int)(b >> 32); 298*0b57cec5SDimitry Andric lob = HEXAGON_R_extractu_RII((int)mantb, 31, 1); 299*0b57cec5SDimitry Andric 300*0b57cec5SDimitry Andric mant = HEXAGON_P_mpy_RR(hia, lob); 301*0b57cec5SDimitry Andric mant = HEXAGON_P_mpyacc_RR(mant,hib, loa); 302*0b57cec5SDimitry Andric mant = (mant >> 30) + (HEXAGON_P_mpy_RR(hia, hib)<<1); 303*0b57cec5SDimitry Andric 304*0b57cec5SDimitry Andric hi = (int) (mant>>32); 305*0b57cec5SDimitry Andric lo = (int) (mant); 306*0b57cec5SDimitry Andric 307*0b57cec5SDimitry Andric k = HEXAGON_R_normamt_R(hi); 308*0b57cec5SDimitry Andric if(hi == 0 || hi == -1) k = 31+HEXAGON_R_normamt_R(lo); 309*0b57cec5SDimitry Andric mant = mant << k; 310*0b57cec5SDimitry Andric exp = expa + expb - k; 311*0b57cec5SDimitry Andric if (mant == 0 || mant == -1) exp = 0x8001; 312*0b57cec5SDimitry Andric c = (mant & MANTMASK) | (((lint) exp) & EXP_MASK); 313*0b57cec5SDimitry Andric return(c); 314*0b57cec5SDimitry Andric } 315*0b57cec5SDimitry Andric * ==================================================================== */ 316*0b57cec5SDimitry Andric .text 317*0b57cec5SDimitry Andric .global dmpy_asm 318*0b57cec5SDimitry Andric .type dmpy_asm, @function 319*0b57cec5SDimitry Andricdmpy_asm: 320*0b57cec5SDimitry Andric 321*0b57cec5SDimitry Andric#define mantal R0 322*0b57cec5SDimitry Andric#define mantah R1 323*0b57cec5SDimitry Andric#define mantexpa R1:0 324*0b57cec5SDimitry Andric#define mantbl R2 325*0b57cec5SDimitry Andric#define mantbh R3 326*0b57cec5SDimitry Andric#define mantexpb R3:2 327*0b57cec5SDimitry Andric#define expa R4 328*0b57cec5SDimitry Andric#define expb R5 329*0b57cec5SDimitry Andric#define mantexpd R7:6 330*0b57cec5SDimitry Andric#define exp R8 331*0b57cec5SDimitry Andric#define lmantc R11:10 332*0b57cec5SDimitry Andric#define mantch R11 333*0b57cec5SDimitry Andric#define mantcl R10 334*0b57cec5SDimitry Andric#define zero0 R7:6 335*0b57cec5SDimitry Andric#define zero0l R6 336*0b57cec5SDimitry Andric#define minus1 R3:2 337*0b57cec5SDimitry Andric#define minus1l R2 338*0b57cec5SDimitry Andric#define maxneg R9 339*0b57cec5SDimitry Andric#define k R4 340*0b57cec5SDimitry Andric#define kl R5 341*0b57cec5SDimitry Andric 342*0b57cec5SDimitry Andric .falign 343*0b57cec5SDimitry Andric { 344*0b57cec5SDimitry Andric mantbl = lsr(mantbl, #16) 345*0b57cec5SDimitry Andric mantal = lsr(mantal, #16) 346*0b57cec5SDimitry Andric expa = sxth(mantal) 347*0b57cec5SDimitry Andric expb = sxth(mantbl) 348*0b57cec5SDimitry Andric } 349*0b57cec5SDimitry Andric { 350*0b57cec5SDimitry Andric lmantc = mpy(mantah, mantbh) 351*0b57cec5SDimitry Andric mantexpd = mpy(mantah, mantbl) 352*0b57cec5SDimitry Andric } 353*0b57cec5SDimitry Andric { 354*0b57cec5SDimitry Andric lmantc = add(lmantc, lmantc) //<<1 355*0b57cec5SDimitry Andric mantexpd+= mpy(mantbh, mantal) 356*0b57cec5SDimitry Andric } 357*0b57cec5SDimitry Andric { 358*0b57cec5SDimitry Andric lmantc += asr(mantexpd, #15) 359*0b57cec5SDimitry Andric exp = add(expa, expb) 360*0b57cec5SDimitry Andric zero0 = #0 361*0b57cec5SDimitry Andric minus1 = #-1 362*0b57cec5SDimitry Andric } 363*0b57cec5SDimitry Andric { 364*0b57cec5SDimitry Andric k = normamt(mantch) 365*0b57cec5SDimitry Andric kl = normamt(mantcl) 366*0b57cec5SDimitry Andric p0 = cmp.eq(mantch, zero0l) 367*0b57cec5SDimitry Andric p1 = cmp.eq(mantch, minus1l) 368*0b57cec5SDimitry Andric } 369*0b57cec5SDimitry Andric { 370*0b57cec5SDimitry Andric p0 = or(p0, p1) 371*0b57cec5SDimitry Andric if(p0.new) k = add(kl, #31) 372*0b57cec5SDimitry Andric maxneg.H = #0 373*0b57cec5SDimitry Andric } 374*0b57cec5SDimitry Andric { 375*0b57cec5SDimitry Andric mantexpa = asl(lmantc, k) 376*0b57cec5SDimitry Andric exp = sub(exp, k) 377*0b57cec5SDimitry Andric maxneg.L = #0x8001 378*0b57cec5SDimitry Andric } 379*0b57cec5SDimitry Andric { 380*0b57cec5SDimitry Andric p0 = cmp.eq(mantexpa, zero0) 381*0b57cec5SDimitry Andric p1 = cmp.eq(mantexpa, minus1) 382*0b57cec5SDimitry Andric mantal.L = #0 383*0b57cec5SDimitry Andric exp = zxth(exp) 384*0b57cec5SDimitry Andric } 385*0b57cec5SDimitry Andric#if (__HEXAGON_ARCH__ == 60) 386*0b57cec5SDimitry Andric { 387*0b57cec5SDimitry Andric p0 = or(p0, p1) 388*0b57cec5SDimitry Andric if( p0.new) mantal = or(mantal,maxneg) 389*0b57cec5SDimitry Andric if(!p0.new) mantal = or(mantal,exp) 390*0b57cec5SDimitry Andric } 391*0b57cec5SDimitry Andric jumpr r31 392*0b57cec5SDimitry Andric#else 393*0b57cec5SDimitry Andric { 394*0b57cec5SDimitry Andric p0 = or(p0, p1) 395*0b57cec5SDimitry Andric if( p0.new) mantal = or(mantal,maxneg) 396*0b57cec5SDimitry Andric if(!p0.new) mantal = or(mantal,exp) 397*0b57cec5SDimitry Andric jumpr r31 398*0b57cec5SDimitry Andric } 399*0b57cec5SDimitry Andric#endif 400