diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2015-04-03 18:27:38 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-07 19:10:31 -0400 |
commit | f1f3b7ebac08161761c352fd070cfa07b7b94c54 (patch) | |
tree | bd02705eb60a81da45d40827dcfec70dd31ab622 | |
parent | c491cfa2ca804e58f4e88386736c1608c82da08a (diff) |
MIPS: math-emu: Define IEEE 754-2008 feature control bits
Define IEEE 754-2008 feature control bits: FIR.HAS2008, FCSR.ABS2008 and
FCSR.NAN2008, and update the `_ieee754_csr' structure accordingly.
For completeness define FIR.UFRP too.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9709/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/include/asm/mipsregs.h | 9 | ||||
-rw-r--r-- | arch/mips/math-emu/cp1emu.c | 5 | ||||
-rw-r--r-- | arch/mips/math-emu/ieee754.h | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 120f2225ed3f..764e2756b54d 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -708,6 +708,8 @@ | |||
708 | #define MIPS_FPIR_W (_ULCAST_(1) << 20) | 708 | #define MIPS_FPIR_W (_ULCAST_(1) << 20) |
709 | #define MIPS_FPIR_L (_ULCAST_(1) << 21) | 709 | #define MIPS_FPIR_L (_ULCAST_(1) << 21) |
710 | #define MIPS_FPIR_F64 (_ULCAST_(1) << 22) | 710 | #define MIPS_FPIR_F64 (_ULCAST_(1) << 22) |
711 | #define MIPS_FPIR_HAS2008 (_ULCAST_(1) << 23) | ||
712 | #define MIPS_FPIR_UFRP (_ULCAST_(1) << 28) | ||
711 | #define MIPS_FPIR_FREP (_ULCAST_(1) << 29) | 713 | #define MIPS_FPIR_FREP (_ULCAST_(1) << 29) |
712 | 714 | ||
713 | /* | 715 | /* |
@@ -765,10 +767,13 @@ | |||
765 | #define FPU_CSR_COND7 (_ULCAST_(1) << FPU_CSR_COND7_S) | 767 | #define FPU_CSR_COND7 (_ULCAST_(1) << FPU_CSR_COND7_S) |
766 | 768 | ||
767 | /* | 769 | /* |
768 | * Bits 18 - 20 of the FPU Status Register will be read as 0, | 770 | * Bits 22:20 of the FPU Status Register will be read as 0, |
769 | * and should be written as zero. | 771 | * and should be written as zero. |
770 | */ | 772 | */ |
771 | #define FPU_CSR_RSVD 0x001c0000 | 773 | #define FPU_CSR_RSVD (_ULCAST_(7) << 20) |
774 | |||
775 | #define FPU_CSR_ABS2008 (_ULCAST_(1) << 19) | ||
776 | #define FPU_CSR_NAN2008 (_ULCAST_(1) << 18) | ||
772 | 777 | ||
773 | /* | 778 | /* |
774 | * X the exception cause indicator | 779 | * X the exception cause indicator |
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 8034ee4c3341..3a90170a6277 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -919,8 +919,9 @@ static inline void cop1_ctc(struct pt_regs *xcp, struct mips_fpu_struct *ctx, | |||
919 | pr_debug("%p gpr[%d]->csr=%08x\n", | 919 | pr_debug("%p gpr[%d]->csr=%08x\n", |
920 | (void *)xcp->cp0_epc, MIPSInst_RT(ir), value); | 920 | (void *)xcp->cp0_epc, MIPSInst_RT(ir), value); |
921 | 921 | ||
922 | /* Don't write reserved bits. */ | 922 | /* Don't write unsupported bits. */ |
923 | fcr31 = value & ~FPU_CSR_RSVD; | 923 | fcr31 = value & |
924 | ~(FPU_CSR_RSVD | FPU_CSR_ABS2008 | FPU_CSR_NAN2008); | ||
924 | break; | 925 | break; |
925 | 926 | ||
926 | case FPCREG_FENR: | 927 | case FPCREG_FENR: |
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h index 918334465212..a5ca108ce467 100644 --- a/arch/mips/math-emu/ieee754.h +++ b/arch/mips/math-emu/ieee754.h | |||
@@ -130,15 +130,17 @@ enum { | |||
130 | * The control status register | 130 | * The control status register |
131 | */ | 131 | */ |
132 | struct _ieee754_csr { | 132 | struct _ieee754_csr { |
133 | __BITFIELD_FIELD(unsigned pad0:7, | 133 | __BITFIELD_FIELD(unsigned fcc:7, /* condition[7:1] */ |
134 | __BITFIELD_FIELD(unsigned nod:1, /* set 1 for no denormalised numbers */ | 134 | __BITFIELD_FIELD(unsigned nod:1, /* set 1 for no denormals */ |
135 | __BITFIELD_FIELD(unsigned c:1, /* condition */ | 135 | __BITFIELD_FIELD(unsigned c:1, /* condition[0] */ |
136 | __BITFIELD_FIELD(unsigned pad1:5, | 136 | __BITFIELD_FIELD(unsigned pad0:3, |
137 | __BITFIELD_FIELD(unsigned abs2008:1, /* IEEE 754-2008 ABS/NEG.fmt */ | ||
138 | __BITFIELD_FIELD(unsigned nan2008:1, /* IEEE 754-2008 NaN mode */ | ||
137 | __BITFIELD_FIELD(unsigned cx:6, /* exceptions this operation */ | 139 | __BITFIELD_FIELD(unsigned cx:6, /* exceptions this operation */ |
138 | __BITFIELD_FIELD(unsigned mx:5, /* exception enable mask */ | 140 | __BITFIELD_FIELD(unsigned mx:5, /* exception enable mask */ |
139 | __BITFIELD_FIELD(unsigned sx:5, /* exceptions total */ | 141 | __BITFIELD_FIELD(unsigned sx:5, /* exceptions total */ |
140 | __BITFIELD_FIELD(unsigned rm:2, /* current rounding mode */ | 142 | __BITFIELD_FIELD(unsigned rm:2, /* current rounding mode */ |
141 | ;)))))))) | 143 | ;)))))))))) |
142 | }; | 144 | }; |
143 | #define ieee754_csr (*(struct _ieee754_csr *)(¤t->thread.fpu.fcr31)) | 145 | #define ieee754_csr (*(struct _ieee754_csr *)(¤t->thread.fpu.fcr31)) |
144 | 146 | ||