/usr/src/linux-headers-5.15.0-181/arch/powerpc/include/asm
NameSizeModeActions
book3s/-0755rm
nohash/-0755rm
vdso/-0755rm
8xx_immap.h140990644editdlrm
accounting.h9080644editdlrm
agp.h5250644editdlrm
archrandom.h8380644editdlrm
asm-compat.h18820644editdlrm
asm-const.h4680644editdlrm
asm-offsets.h350644editdlrm
asm-prototypes.h51300644editdlrm
async_tx.h9080644editdlrm
atomic.h142670644editdlrm
backlight.h11150644editdlrm
barrier.h39770644editdlrm
bitops.h79130644editdlrm
bootx.h11420644editdlrm
bpf_perf_event.h2330644editdlrm
btext.h10060644editdlrm
bug.h40900644editdlrm
cache.h28880644editdlrm
cacheflush.h38510644editdlrm
cell-pmu.h34960644editdlrm
cell-regs.h97990644editdlrm
checksum.h57230644editdlrm
clocksource.h1850644editdlrm
cmpxchg.h122800644editdlrm
code-patching-asm.h3970644editdlrm
code-patching.h54430644editdlrm
compat.h33040644editdlrm
context_tracking.h2450644editdlrm
copro.h5930644editdlrm
cpm.h250644editdlrm
cpm1.h217110644editdlrm
cpm2.h495980644editdlrm
cpufeature.h9980644editdlrm
cpuidle.h34070644editdlrm
cputable.h232110644editdlrm
cputhreads.h38560644editdlrm
cputime.h30690644editdlrm
cpu_has_feature.h13390644editdlrm
cpu_setup_power.h5070644editdlrm
crashdump-ppc64.h6240644editdlrm
current.h6800644editdlrm
dbdma.h38090644editdlrm
dbell.h40250644editdlrm
dcr-generic.h9300644editdlrm
dcr-mmio.h10260644editdlrm
dcr-native.h38590644editdlrm
dcr-regs.h58460644editdlrm
dcr.h21080644editdlrm
debug.h18860644editdlrm
delay.h32970644editdlrm
device.h10160644editdlrm
disassemble.h21890644editdlrm
dma-direct.h3910644editdlrm
dma.h107250644editdlrm
drmem.h29700644editdlrm
dtl.h15150644editdlrm
dt_cpu_ftrs.h7560644editdlrm
edac.h11050644editdlrm
eeh.h153670644editdlrm
eeh_event.h8260644editdlrm
ehv_pic.h9630644editdlrm
elf.h62830644editdlrm
elfnote.h5270644editdlrm
emergency-restart.h430644editdlrm
emulated_ops.h20720644editdlrm
epapr_hcalls.h168270644editdlrm
exception-64e.h57850644editdlrm
exception-64s.h43500644editdlrm
exec.h2460644editdlrm
extable.h12050644editdlrm
fadump-internal.h43520644editdlrm
fadump.h10950644editdlrm
fb.h4830644editdlrm
feature-fixups.h98280644editdlrm
firmware.h53270644editdlrm
fixmap.h37230644editdlrm
floppy.h51110644editdlrm
fsl_85xx_cache_sram.h8120644editdlrm
fsl_gtm.h12030644editdlrm
fsl_hcalls.h176150644editdlrm
fsl_lbc.h104890644editdlrm
fsl_pamu_stash.h4110644editdlrm
fsl_pm.h11830644editdlrm
fs_pd.h10460644editdlrm
ftrace.h35500644editdlrm
futex.h22460644editdlrm
grackle.h3310644editdlrm
hardirq.h9480644editdlrm
head-64.h55070644editdlrm
heathrow.h25950644editdlrm
highmem.h20790644editdlrm
hmi.h9710644editdlrm
hugetlb.h21860644editdlrm
hvcall.h212500644editdlrm
hvconsole.h7900644editdlrm
hvcserver.h14730644editdlrm
hvsi.h28500644editdlrm
hw_breakpoint.h37350644editdlrm
hw_irq.h112180644editdlrm
hydra.h29480644editdlrm
i8259.h3610644editdlrm
ibmebus.h22040644editdlrm
icswx.h50900644editdlrm
ide.h5860644editdlrm
idle.h23720644editdlrm
imc-pmu.h39830644editdlrm
immap_cpm2.h107490644editdlrm
inst.h36830644editdlrm
interrupt.h183530644editdlrm
io-defs.h31640644editdlrm
io-workarounds.h13130644editdlrm
io.h313870644editdlrm
iommu.h102830644editdlrm
io_event_irq.h17460644editdlrm
ipic.h31410644editdlrm
irq.h13200644editdlrm
irqflags.h17770644editdlrm
irq_work.h2130644editdlrm
isa-bridge.h6540644editdlrm
jump_label.h13510644editdlrm
kasan.h13960644editdlrm
Kbuild2860644editdlrm
kdebug.h2910644editdlrm
kdump.h13990644editdlrm
kexec.h48380644editdlrm
kexec_ranges.h9430644editdlrm
keylargo.h110610644editdlrm
kfence.h6500644editdlrm
kgdb.h21560644editdlrm
kprobes.h28150644editdlrm
kup.h32970644editdlrm
kvm_asm.h49520644editdlrm
kvm_book3s.h172200644editdlrm
kvm_book3s_32.h8160644editdlrm
kvm_book3s_64.h183330644editdlrm
kvm_book3s_asm.h37770644editdlrm
kvm_book3s_uvmem.h27380644editdlrm
kvm_booke.h22330644editdlrm
kvm_booke_hv_asm.h19600644editdlrm
kvm_fpu.h21990644editdlrm
kvm_guest.h5660644editdlrm
kvm_host.h219660644editdlrm
kvm_para.h7520644editdlrm
kvm_ppc.h366990644editdlrm
libata-portmap.h2490644editdlrm
linkage.h5010644editdlrm
livepatch.h11400644editdlrm
local.h32580644editdlrm
lppaca.h50150644editdlrm
lv1call.h185550644editdlrm
machdep.h96300644editdlrm
macio.h39850644editdlrm
mc146818rtc.h7360644editdlrm
mce.h63960644editdlrm
mediabay.h13750644editdlrm
membarrier.h8770644editdlrm
mem_encrypt.h5320644editdlrm
mman.h14710644editdlrm
mmiowb.h3740644editdlrm
mmu.h112440644editdlrm
mmu_context.h96460644editdlrm
mmzone.h10030644editdlrm
module.h22840644editdlrm
module.lds.h950644editdlrm
mpc5xxx.h4390644editdlrm
mpc6xx.h1430644editdlrm
mpc52xx.h111000644editdlrm
mpc52xx_psc.h101250644editdlrm
mpc85xx.h23820644editdlrm
mpc5121.h38630644editdlrm
mpc8260.h7420644editdlrm
mpic.h143090644editdlrm
mpic_msgr.h34410644editdlrm
mpic_timer.h11830644editdlrm
msi_bitmap.h8670644editdlrm
nmi.h5790644editdlrm
nvram.h28340644editdlrm
ohare.h16840644editdlrm
opal-api.h316800644editdlrm
opal.h178430644editdlrm
paca.h87830644editdlrm
page.h103620644editdlrm
page_32.h16260644editdlrm
page_64.h27160644editdlrm
paravirt.h38810644editdlrm
parport.h9560644editdlrm
pasemi_dma.h232730644editdlrm
pci-bridge.h94810644editdlrm
pci.h36050644editdlrm
percpu.h8150644editdlrm
perf_event.h15090644editdlrm
perf_event_fsl_emb.h12520644editdlrm
perf_event_server.h71040644editdlrm
pgalloc.h20670644editdlrm
pgtable-be-types.h26010644editdlrm
pgtable-types.h18950644editdlrm
pgtable.h40470644editdlrm
pkeys.h42790644editdlrm
plpar_wrappers.h101930644editdlrm
pmac_feature.h133960644editdlrm
pmac_low_i2c.h31000644editdlrm
pmac_pfunc.h82370644editdlrm
pmc.h11160644editdlrm
pmi.h11770644editdlrm
pnv-ocxl.h30690644editdlrm
pnv-pci.h24320644editdlrm
powernv.h4540644editdlrm
ppc-opcode.h314190644editdlrm
ppc-pci.h22820644editdlrm
ppc4xx.h3280644editdlrm
ppc_asm.h205300644editdlrm
probes.h15420644editdlrm
processor.h118980644editdlrm
prom.h73240644editdlrm
ps3.h152190644editdlrm
ps3av.h234220644editdlrm
ps3gpu.h19280644editdlrm
ps3stor.h14080644editdlrm
pte-walk.h22810644editdlrm
ptrace.h105080644editdlrm
qspinlock.h20640644editdlrm
qspinlock_paravirt.h2210644editdlrm
reg.h644650644editdlrm
reg_8xx.h28670644editdlrm
reg_a2.h61280644editdlrm
reg_booke.h338820644editdlrm
reg_fsl_emb.h39610644editdlrm
rheap.h25780644editdlrm
rio.h4240644editdlrm
rtas-types.h29390644editdlrm
rtas.h125740644editdlrm
runlatch.h11840644editdlrm
seccomp.h10430644editdlrm
sections.h19820644editdlrm
secure_boot.h4760644editdlrm
security_features.h35090644editdlrm
secvar.h7650644editdlrm
serial.h4730644editdlrm
setjmp.h4000644editdlrm
setup.h24750644editdlrm
set_memory.h11600644editdlrm
sfp-machine.h126760644editdlrm
shmparam.h2060644editdlrm
signal.h3200644editdlrm
simple_spinlock.h66620644editdlrm
simple_spinlock_types.h4810644editdlrm
slice.h11210644editdlrm
smp.h78040644editdlrm
smu.h197890644editdlrm
sparsemem.h8430644editdlrm
spinlock.h4720644editdlrm
spinlock_types.h3820644editdlrm
spu.h239630644editdlrm
spu_csa.h61660644editdlrm
spu_info.h2720644editdlrm
spu_priv1.h51860644editdlrm
sstep.h47300644editdlrm
stackprotector.h7880644editdlrm
stacktrace.h2970644editdlrm
string.h25220644editdlrm
svm.h6520644editdlrm
swab.h1730644editdlrm
swiotlb.h3740644editdlrm
switch_to.h29660644editdlrm
synch.h20670644editdlrm
syscall.h30570644editdlrm
syscalls.h21890644editdlrm
task_size_32.h5440644editdlrm
task_size_64.h23900644editdlrm
tce.h8920644editdlrm
termios.h6530644editdlrm
thread_info.h61660644editdlrm
time.h29970644editdlrm
timex.h4630644editdlrm
tlb.h23080644editdlrm
tlbflush.h2710644editdlrm
tm.h6240644editdlrm
topology.h35360644editdlrm
trace.h46950644editdlrm
trace_clock.h3720644editdlrm
tsi108.h32640644editdlrm
tsi108_irq.h39160644editdlrm
tsi108_pci.h11910644editdlrm
types.h8220644editdlrm
uaccess.h142070644editdlrm
udbg.h20030644editdlrm
uic.h4030644editdlrm
ultravisor-api.h9410644editdlrm
ultravisor.h21010644editdlrm
uninorth.h84100644editdlrm
unistd.h14450644editdlrm
uprobes.h8010644editdlrm
user.h21920644editdlrm
vas.h75800644editdlrm
vdso.h10960644editdlrm
vdso_datapage.h35700644editdlrm
vermagic.h4900644editdlrm
vga.h12730644editdlrm
vio.h47340644editdlrm
vmalloc.h5540644editdlrm
word-at-a-time.h48780644editdlrm
xics.h45390644editdlrm
xive-regs.h50830644editdlrm
xive.h51910644editdlrm
xmon.h7330644editdlrm
xor.h10170644editdlrm
xor_altivec.h6830644editdlrm
Edit: /usr/src/linux-headers-5.15.0-181/arch/powerpc/include/asm/sfp-machine.h (12676B)
/* Machine-dependent software floating-point definitions. PPC version. Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Actually, this is a PPC (32bit) version, written based on the i386, sparc, and sparc64 versions, by me, Peter Maydell (pmaydell@chiark.greenend.org.uk). Comments are by and large also mine, although they may be inaccurate. In picking out asm fragments I've gone with the lowest common denominator, which also happens to be the hardware I have :-> That is, a SPARC without hardware multiply and divide. */ /* basic word size definitions */ #define _FP_W_TYPE_SIZE 32 #define _FP_W_TYPE unsigned int #define _FP_WS_TYPE signed int #define _FP_I_TYPE int #define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) #define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) #define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) /* You can optionally code some things like addition in asm. For * example, i386 defines __FP_FRAC_ADD_2 as asm. If you don't * then you get a fragment of C code [if you change an #ifdef 0 * in op-2.h] or a call to add_ssaaaa (see below). * Good places to look for asm fragments to use are gcc and glibc. * gcc's longlong.h is useful. */ /* We need to know how to multiply and divide. If the host word size * is >= 2*fracbits you can use FP_MUL_MEAT_n_imm(t,R,X,Y) which * codes the multiply with whatever gcc does to 'a * b'. * _FP_MUL_MEAT_n_wide(t,R,X,Y,f) is used when you have an asm * function that can multiply two 1W values and get a 2W result. * Otherwise you're stuck with _FP_MUL_MEAT_n_hard(t,R,X,Y) which * does bitshifting to avoid overflow. * For division there is FP_DIV_MEAT_n_imm(t,R,X,Y,f) for word size * >= 2*fracbits, where f is either _FP_DIV_HELP_imm or * _FP_DIV_HELP_ldiv (see op-1.h). * _FP_DIV_MEAT_udiv() is if you have asm to do 2W/1W => (1W, 1W). * [GCC and glibc have longlong.h which has the asm macro udiv_qrnnd * to do this.] * In general, 'n' is the number of words required to hold the type, * and 't' is either S, D or Q for single/double/quad. * -- PMM */ /* Example: SPARC64: * #define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_imm(S,R,X,Y) * #define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_1_wide(D,R,X,Y,umul_ppmm) * #define _FP_MUL_MEAT_Q(R,X,Y) _FP_MUL_MEAT_2_wide(Q,R,X,Y,umul_ppmm) * * #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y) * #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv_64(Q,R,X,Y) * * Example: i386: * #define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(S,R,X,Y,_i386_mul_32_64) * #define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(D,R,X,Y,_i386_mul_32_64) * * #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y,_i386_div_64_32) * #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv_64(D,R,X,Y) */ #define _FP_MUL_MEAT_S(R,X,Y) _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_D(R,X,Y) _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) /* These macros define what NaN looks like. They're supposed to expand to * a comma-separated set of 32bit unsigned ints that encode NaN. */ #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 #ifdef FP_EX_BOOKE_E500_SPE #define FP_EX_INEXACT (1 << 21) #define FP_EX_INVALID (1 << 20) #define FP_EX_DIVZERO (1 << 19) #define FP_EX_UNDERFLOW (1 << 18) #define FP_EX_OVERFLOW (1 << 17) #define FP_INHIBIT_RESULTS 0 #define __FPU_FPSCR (current->thread.spefscr) #define __FPU_ENABLED_EXC \ ({ \ (__FPU_FPSCR >> 2) & 0x1f; \ }) #else /* Exception flags. We use the bit positions of the appropriate bits in the FPSCR, which also correspond to the FE_* bits. This makes everything easier ;-). */ #define FP_EX_INVALID (1 << (31 - 2)) #define FP_EX_INVALID_SNAN EFLAG_VXSNAN #define FP_EX_INVALID_ISI EFLAG_VXISI #define FP_EX_INVALID_IDI EFLAG_VXIDI #define FP_EX_INVALID_ZDZ EFLAG_VXZDZ #define FP_EX_INVALID_IMZ EFLAG_VXIMZ #define FP_EX_OVERFLOW (1 << (31 - 3)) #define FP_EX_UNDERFLOW (1 << (31 - 4)) #define FP_EX_DIVZERO (1 << (31 - 5)) #define FP_EX_INEXACT (1 << (31 - 6)) #define __FPU_FPSCR (current->thread.fp_state.fpscr) /* We only actually write to the destination register * if exceptions signalled (if any) will not trap. */ #define __FPU_ENABLED_EXC \ ({ \ (__FPU_FPSCR >> 3) & 0x1f; \ }) #endif /* * If one NaN is signaling and the other is not, * we choose that one, otherwise we choose X. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ do { \ if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ { \ R##_s = X##_s; \ _FP_FRAC_COPY_##wc(R,X); \ } \ else \ { \ R##_s = Y##_s; \ _FP_FRAC_COPY_##wc(R,Y); \ } \ R##_c = FP_CLS_NAN; \ } while (0) #include #include #define __FPU_TRAP_P(bits) \ ((__FPU_ENABLED_EXC & (bits)) != 0) #define __FP_PACK_S(val,X) \ ({ int __exc = _FP_PACK_CANONICAL(S,1,X); \ if(!__exc || !__FPU_TRAP_P(__exc)) \ _FP_PACK_RAW_1_P(S,val,X); \ __exc; \ }) #define __FP_PACK_D(val,X) \ do { \ _FP_PACK_CANONICAL(D, 2, X); \ if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) \ _FP_PACK_RAW_2_P(D, val, X); \ } while (0) #define __FP_PACK_DS(val,X) \ do { \ FP_DECL_S(__X); \ FP_CONV(S, D, 1, 2, __X, X); \ _FP_PACK_CANONICAL(S, 1, __X); \ if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) { \ _FP_UNPACK_CANONICAL(S, 1, __X); \ FP_CONV(D, S, 2, 1, X, __X); \ _FP_PACK_CANONICAL(D, 2, X); \ if (!FP_CUR_EXCEPTIONS || !__FPU_TRAP_P(FP_CUR_EXCEPTIONS)) \ _FP_PACK_RAW_2_P(D, val, X); \ } \ } while (0) /* Obtain the current rounding mode. */ #define FP_ROUNDMODE \ ({ \ __FPU_FPSCR & 0x3; \ }) /* the asm fragments go here: all these are taken from glibc-2.0.5's * stdlib/longlong.h */ #include #include /* add_ssaaaa is used in op-2.h and should be equivalent to * #define add_ssaaaa(sh,sl,ah,al,bh,bl) (sh = ah+bh+ (( sl = al+bl) < al)) * add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1, * high_addend_2, low_addend_2) adds two UWtype integers, composed by * HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and LOW_ADDEND_2 * respectively. The result is placed in HIGH_SUM and LOW_SUM. Overflow * (i.e. carry out) is not stored anywhere, and is lost. */ #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (bh) && (bh) == 0) \ __asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ __asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ else \ __asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \ : "=r" (sh), "=&r" (sl) \ : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ } while (0) /* sub_ddmmss is used in op-2.h and udivmodti4.c and should be equivalent to * #define sub_ddmmss(sh, sl, ah, al, bh, bl) (sh = ah-bh - ((sl = al-bl) > al)) * sub_ddmmss(high_difference, low_difference, high_minuend, low_minuend, * high_subtrahend, low_subtrahend) subtracts two two-word UWtype integers, * composed by HIGH_MINUEND_1 and LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and * LOW_SUBTRAHEND_2 respectively. The result is placed in HIGH_DIFFERENCE * and LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere, * and is lost. */ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (ah) && (ah) == 0) \ __asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ __asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == 0) \ __asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ __asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else \ __asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \ : "=r" (sh), "=&r" (sl) \ : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \ } while (0) /* asm fragments for mul and div */ /* umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two * UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype * word product in HIGH_PROD and LOW_PROD. */ #define umul_ppmm(ph, pl, m0, m1) \ do { \ USItype __m0 = (m0), __m1 = (m1); \ __asm__ ("mulhwu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \ (pl) = __m0 * __m1; \ } while (0) /* udiv_qrnnd(quotient, remainder, high_numerator, low_numerator, * denominator) divides a UDWtype, composed by the UWtype integers * HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and places the quotient * in QUOTIENT and the remainder in REMAINDER. HIGH_NUMERATOR must be less * than DENOMINATOR for correct operation. If, in addition, the most * significant bit of DENOMINATOR must be 1, then the pre-processor symbol * UDIV_NEEDS_NORMALIZATION is defined to 1. */ #define udiv_qrnnd(q, r, n1, n0, d) \ do { \ UWtype __d1, __d0, __q1, __q0; \ UWtype __r1, __r0, __m; \ __d1 = __ll_highpart (d); \ __d0 = __ll_lowpart (d); \ \ __r1 = (n1) % __d1; \ __q1 = (n1) / __d1; \ __m = (UWtype) __q1 * __d0; \ __r1 = __r1 * __ll_B | __ll_highpart (n0); \ if (__r1 < __m) \ { \ __q1--, __r1 += (d); \ if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\ if (__r1 < __m) \ __q1--, __r1 += (d); \ } \ __r1 -= __m; \ \ __r0 = __r1 % __d1; \ __q0 = __r1 / __d1; \ __m = (UWtype) __q0 * __d0; \ __r0 = __r0 * __ll_B | __ll_lowpart (n0); \ if (__r0 < __m) \ { \ __q0--, __r0 += (d); \ if (__r0 >= (d)) \ if (__r0 < __m) \ __q0--, __r0 += (d); \ } \ __r0 -= __m; \ \ (q) = (UWtype) __q1 * __ll_B | __q0; \ (r) = __r0; \ } while (0) #define UDIV_NEEDS_NORMALIZATION 1 #define abort() \ return 0 #ifdef __BIG_ENDIAN #define __BYTE_ORDER __BIG_ENDIAN #else #define __BYTE_ORDER __LITTLE_ENDIAN #endif /* Exception flags. */ #define EFLAG_INVALID (1 << (31 - 2)) #define EFLAG_OVERFLOW (1 << (31 - 3)) #define EFLAG_UNDERFLOW (1 << (31 - 4)) #define EFLAG_DIVZERO (1 << (31 - 5)) #define EFLAG_INEXACT (1 << (31 - 6)) #define EFLAG_VXSNAN (1 << (31 - 7)) #define EFLAG_VXISI (1 << (31 - 8)) #define EFLAG_VXIDI (1 << (31 - 9)) #define EFLAG_VXZDZ (1 << (31 - 10)) #define EFLAG_VXIMZ (1 << (31 - 11)) #define EFLAG_VXVC (1 << (31 - 12)) #define EFLAG_VXSOFT (1 << (31 - 21)) #define EFLAG_VXSQRT (1 << (31 - 22)) #define EFLAG_VXCVI (1 << (31 - 23))