mulsf3.S revision 1.1.1.3
1/* Copyright (C) 2008-2017 Free Software Foundation, Inc. 2 Contributor: Joern Rennecke <joern.rennecke@embecosm.com> 3 on behalf of Synopsys Inc. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free 9Software Foundation; either version 3, or (at your option) any later 10version. 11 12GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13WARRANTY; without even the implied warranty of MERCHANTABILITY or 14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15for more details. 16 17Under Section 7 of GPL version 3, you are granted additional 18permissions described in the GCC Runtime Library Exception, version 193.1, as published by the Free Software Foundation. 20 21You should have received a copy of the GNU General Public License and 22a copy of the GCC Runtime Library Exception along with this program; 23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24<http://www.gnu.org/licenses/>. */ 25 26#include "../arc-ieee-754.h" 27 28#if 0 /* DEBUG */ 29 .global __mulsf3 30 FUNC(__mulsf3) 31 .balign 4 32__mulsf3: 33 push_s blink 34 push_s r1 35 bl.d __mulsf3_c 36 push_s r0 37 ld_s r1,[sp,4] 38 st_s r0,[sp,4] 39 bl.d __mulsf3_asm 40 pop_s r0 41 pop_s r1 42 pop_s blink 43 cmp r0,r1 44 jeq_s [blink] 45 and r12,r0,r1 46 bic.f 0,0x7f800000,r12 47 bne 0f 48 bmsk.f 0,r0,22 49 bmsk.ne.f r1,r1,22 50 jne_s [blink] ; both NaN -> OK 510: bl abort 52 ENDFUNC(__mulsf3) 53#define __mulsf3 __mulsf3_asm 54#endif /* DEBUG */ 55 56 .balign 4 57 .global __mulsf3 58 FUNC(__mulsf3) 59__mulsf3: 60 ld.as r9,[pcl,80]; [pcl,((.L7f800000-.+2)/4)] 61 bmsk r4,r1,22 62 bset r2,r0,23 63 asl_s r2,r2,8 64 bset r3,r4,23 65 and r11,r0,r9 66 breq.d r11,0,.Ldenorm_dbl0 67 and r12,r1,r9 68 breq.d r12,0,.Ldenorm_dbl1 69 xor_s r0,r0,r1 70 mululw 0,r2,r3 71 machulw r6,r2,r3 72 breq.d r11,r9,.Linf_nan_dbl0 73 ld.as r4,[pcl,69]; [pcl,((.L7fffffff-.+2)/4)] 74 breq.d r12,r9,.Linf_nan_dbl1 75.Lpast_denorm: 76 asl.f 0,r6,8 77 mov r7,acc2 78 add.pl r6,r6,r6 79 bclr.pl r6,r6,23 80 add.pl.f r7,r7,r7 81 add.cs r6,r6,1 82 lsr.f 0,r6,1 83 add_s r12,r12,r11 84 adc.f 0,r7,r4 85 add_s r12,r12, \ 86 -0x3f800000 87 adc.f r8,r6,r12 88 tst.pl r8,r9 89 bic r0,r0,r4 90 min r3,r8,r9 91 jpnz.d [blink] 92 add.pnz r0,r0,r3 93; infinity or denormal number 94 add.ne.f r3,r3,r3 95 asr_s r3,r3,23+1 96 bset r6,r6,23 97 bpnz.d .Linfinity 98 sub_s r3,r3,1 99 neg_s r2,r3 100 brhi.d r2,24,.Lret_r0 ; right shift shift > 24 -> return +-0 101 lsr r2,r6,r2 102 asl r9,r6,r3 103 lsr.f 0,r2,1 104 tst r7,r7 105 add_s r0,r0,r2 106 bset.ne r9,r9,0 107 adc.f 0,r9,r4 108 j_s.d [blink] 109 add.cs r0,r0,1 110.Linfinity: 111 j_s.d [blink] 112 add_s r0,r0,r9 113 114.Lret_r0: j_s [blink] 115 116 .balign 4 117.Ldenorm_dbl0: 118 bclr_s r2,r2,31 119 norm.f r4,r2 120 add_s r2,r2,r2 121 asl r2,r2,r4 122 breq.d r12,r9,.Ldenorm_dbl0_inf_nan_dbl1 123 asl r4,r4,23 124 mululw 0,r2,r3 125 machulw r6,r2,r3 126 sub.ne.f r12,r12,r4 127 ld.as r4,[pcl,28]; [pcl,((.L7fffffff-.+2)/4)] 128 bhi.d .Lpast_denorm 129 xor_s r0,r0,r1 130 bmsk r1,r0,30 131 j_s.d [blink] 132 bic_s r0,r0,r1 133 134 .balign 4 135.Ldenorm_dbl0_inf_nan_dbl1: 136 bmsk.f 0,r0,30 137 mov.eq r1,-1 138.Linf_nan_dbl1: 139 xor_s r1,r1,r0 140.Linf_nan_dbl0: 141 bclr_s r1,r1,31 142 j_s.d [blink] 143 xor_s r0,r0,r1 144 145 .balign 4 146.Ldenorm_dbl1: 147 breq.d r11,r9,.Linf_nan_dbl0_2 148 norm.f r3,r4 149 sub_s r3,r3,7 150 asl r4,r4,r3 151 mululw 0,r2,r4 152 machulw r6,r2,r4 153 sub_s r3,r3,1 154 asl_s r3,r3,23 155 sub.ne.f r11,r11,r3 156 ld.as r4,[pcl,11]; [pcl,((.L7fffffff-.+2)/4)] 157 bhi.d .Lpast_denorm 158 bmsk r8,r0,30 159 j_s.d [blink] 160 bic r0,r0,r8 161 162 .balign 4 163.Linf_nan_dbl0_2: 164 bclr_s r1,r1,31 165 xor_s r0,r0,r1 166 sub.eq r1,r1,1 ; inf/nan * 0 -> nan 167 bic.f 0,r9,r1 168 j_s.d [blink] 169 or.eq r0,r0,r1 ; r1 nan -> result nan 170 171 .balign 4 172.L7f800000: 173 .long 0x7f800000 174.L7fffffff: 175 .long 0x7fffffff 176 ENDFUNC(__mulsf3) 177