arch/m68k/math-emu/fp_arith.c
Source file repositories/reference/linux-study-clean/arch/m68k/math-emu/fp_arith.c
File Facts
- System
- Linux kernel
- Corpus path
arch/m68k/math-emu/fp_arith.c- Extension
.c- Size
- 14657 bytes
- Lines
- 685
- Domain
- Architecture Layer
- Bucket
- arch/m68k
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
fp_emu.hmulti_arith.hfp_arith.h
Detected Declarations
function fp_roundintfunction denormalizedfunction fmodfunction frem
Annotated Snippet
if (IS_ZERO(src)) {
if (src->sign != dest->sign) {
if (FPDATA->rnd == FPCR_ROUND_RM)
dest->sign = 1;
else
dest->sign = 0;
}
} else
fp_copy_ext(dest, src);
return dest;
}
dest->lowmant = src->lowmant = 0;
if ((diff = dest->exp - src->exp) > 0)
fp_denormalize(src, diff);
else if ((diff = -diff) > 0)
fp_denormalize(dest, diff);
if (dest->sign == src->sign) {
if (fp_addmant(dest, src))
if (!fp_addcarry(dest))
return dest;
} else {
if (dest->mant.m64 < src->mant.m64) {
fp_submant(dest, src, dest);
dest->sign = !dest->sign;
} else
fp_submant(dest, dest, src);
}
return dest;
}
/* fp_fsub: Implements the kernel of the FSUB, FSSUB, and FDSUB
instructions.
Remember that the arguments are in assembler-syntax order! */
struct fp_ext *fp_fsub(struct fp_ext *dest, struct fp_ext *src)
{
dprint(PINSTR, "fsub ");
src->sign = !src->sign;
return fp_fadd(dest, src);
}
struct fp_ext *fp_fcmp(struct fp_ext *dest, struct fp_ext *src)
{
dprint(PINSTR, "fcmp ");
FPDATA->temp[1] = *dest;
src->sign = !src->sign;
return fp_fadd(&FPDATA->temp[1], src);
}
struct fp_ext *fp_ftst(struct fp_ext *dest, struct fp_ext *src)
{
dprint(PINSTR, "ftst\n");
(void)dest;
return src;
}
struct fp_ext *fp_fmul(struct fp_ext *dest, struct fp_ext *src)
{
union fp_mant128 temp;
int exp;
dprint(PINSTR, "fmul\n");
fp_dyadic_check(dest, src);
/* calculate the correct sign now, as it's necessary for infinities */
dest->sign = src->sign ^ dest->sign;
/* Handle infinities */
if (IS_INF(dest)) {
if (IS_ZERO(src))
fp_set_nan(dest);
return dest;
}
if (IS_INF(src)) {
if (IS_ZERO(dest))
fp_set_nan(dest);
else
fp_copy_ext(dest, src);
return dest;
Annotation
- Immediate include surface: `fp_emu.h`, `multi_arith.h`, `fp_arith.h`.
- Detected declarations: `function fp_roundint`, `function denormalized`, `function fmod`, `function frem`.
- Atlas domain: Architecture Layer / arch/m68k.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.