From: Bill Zorn Date: Mon, 6 Aug 2018 23:21:21 +0000 (-0700) Subject: rename fused multiply add-like operations: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1dddba004c9573f3b9e2f1b914fea8af76eba1e1;p=sfpy.git rename fused multiply add-like operations: * fused multiply add -> fma (a * b + c) * fused add multiply -> fam (a + b * c) * quire add multiply -> qam (q + a * b), like fam * quire subtract multiply -> qsm (q - a * b) --- diff --git a/sfpy/float.pyx b/sfpy/float.pyx index 261226c..d25a6da 100644 --- a/sfpy/float.pyx +++ b/sfpy/float.pyx @@ -224,7 +224,7 @@ cdef class Float16: cdef cfloat.float16_t f = cfloat.f16_mulAdd(self._c_float, a2._c_float, a3._c_float) return Float16.from_c_float(f) - cpdef Float16 qma(self, Float16 a1, Float16 a2): + cpdef Float16 fam(self, Float16 a1, Float16 a2): cdef cfloat.float16_t f = cfloat.f16_mulAdd(a1._c_float, a2._c_float, self._c_float) return Float16.from_c_float(f) @@ -275,7 +275,7 @@ cdef class Float16: cpdef void ifma(self, Float16 a2, Float16 a3): self._c_float = cfloat.f16_mulAdd(self._c_float, a2._c_float, a3._c_float) - cpdef void iqma(self, Float16 a1, Float16 a2): + cpdef void ifam(self, Float16 a1, Float16 a2): self._c_float = cfloat.f16_mulAdd(a1._c_float, a2._c_float, self._c_float) cpdef void idiv(self, Float16 other): @@ -357,7 +357,7 @@ cpdef Float16 f16_fma(Float16 a1, Float16 a2, Float16 a3): cdef cfloat.float16_t f = cfloat.f16_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float16.from_c_float(f) -cpdef Float16 f16_qma(Float16 a3, Float16 a1, Float16 a2): +cpdef Float16 f16_fam(Float16 a3, Float16 a1, Float16 a2): cdef cfloat.float16_t f = cfloat.f16_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float16.from_c_float(f) @@ -505,7 +505,7 @@ cdef class Float32: cdef cfloat.float32_t f = cfloat.f32_mulAdd(self._c_float, a2._c_float, a3._c_float) return Float32.from_c_float(f) - cpdef Float32 qma(self, Float32 a1, Float32 a2): + cpdef Float32 fam(self, Float32 a1, Float32 a2): cdef cfloat.float32_t f = cfloat.f32_mulAdd(a1._c_float, a2._c_float, self._c_float) return Float32.from_c_float(f) @@ -556,7 +556,7 @@ cdef class Float32: cpdef void ifma(self, Float32 a2, Float32 a3): self._c_float = cfloat.f32_mulAdd(self._c_float, a2._c_float, a3._c_float) - cpdef void iqma(self, Float32 a1, Float32 a2): + cpdef void ifam(self, Float32 a1, Float32 a2): self._c_float = cfloat.f32_mulAdd(a1._c_float, a2._c_float, self._c_float) cpdef void idiv(self, Float32 other): @@ -638,7 +638,7 @@ cpdef Float32 f32_fma(Float32 a1, Float32 a2, Float32 a3): cdef cfloat.float32_t f = cfloat.f32_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float32.from_c_float(f) -cpdef Float32 f32_qma(Float32 a3, Float32 a1, Float32 a2): +cpdef Float32 f32_fam(Float32 a3, Float32 a1, Float32 a2): cdef cfloat.float32_t f = cfloat.f32_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float32.from_c_float(f) @@ -784,7 +784,7 @@ cdef class Float64: cdef cfloat.float64_t f = cfloat.f64_mulAdd(self._c_float, a2._c_float, a3._c_float) return Float64.from_c_float(f) - cpdef Float64 qma(self, Float64 a1, Float64 a2): + cpdef Float64 fam(self, Float64 a1, Float64 a2): cdef cfloat.float64_t f = cfloat.f64_mulAdd(a1._c_float, a2._c_float, self._c_float) return Float64.from_c_float(f) @@ -835,7 +835,7 @@ cdef class Float64: cpdef void ifma(self, Float64 a2, Float64 a3): self._c_float = cfloat.f64_mulAdd(self._c_float, a2._c_float, a3._c_float) - cpdef void iqma(self, Float64 a1, Float64 a2): + cpdef void ifam(self, Float64 a1, Float64 a2): self._c_float = cfloat.f64_mulAdd(a1._c_float, a2._c_float, self._c_float) cpdef void idiv(self, Float64 other): @@ -917,7 +917,7 @@ cpdef Float64 f64_fma(Float64 a1, Float64 a2, Float64 a3): cdef cfloat.float64_t f = cfloat.f64_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float64.from_c_float(f) -cpdef Float64 f64_qma(Float64 a3, Float64 a1, Float64 a2): +cpdef Float64 f64_fam(Float64 a3, Float64 a1, Float64 a2): cdef cfloat.float64_t f = cfloat.f64_mulAdd(a1._c_float, a2._c_float, a3._c_float) return Float64.from_c_float(f) diff --git a/sfpy/posit.pyx b/sfpy/posit.pyx index d09b603..4fb76aa 100644 --- a/sfpy/posit.pyx +++ b/sfpy/posit.pyx @@ -100,7 +100,7 @@ cdef class Posit8: cdef cposit.posit8_t f = cposit.p8_mulAdd(self._c_posit, a2._c_posit, a3._c_posit) return Posit8.from_c_posit(f) - cpdef Posit8 qma(self, Posit8 a1, Posit8 a2): + cpdef Posit8 fam(self, Posit8 a1, Posit8 a2): cdef cposit.posit8_t f = cposit.p8_mulAdd(a1._c_posit, a2._c_posit, self._c_posit) return Posit8.from_c_posit(f) @@ -144,7 +144,7 @@ cdef class Posit8: cpdef void ifma(self, Posit8 a2, Posit8 a3): self._c_posit = cposit.p8_mulAdd(self._c_posit, a2._c_posit, a3._c_posit) - cpdef void iqma(self, Posit8 a1, Posit8 a2): + cpdef void ifam(self, Posit8 a1, Posit8 a2): self._c_posit = cposit.p8_mulAdd(a1._c_posit, a2._c_posit, self._c_posit) cpdef void idiv(self, Posit8 other): @@ -252,18 +252,18 @@ cdef class Quire8: # arithmetic - cpdef Quire8 qma(self, Posit8 a1, Posit8 a2): + cpdef Quire8 qam(self, Posit8 a1, Posit8 a2): cdef cposit.quire8_t f = cposit.q8_fdp_add(self._c_quire, a1._c_posit, a2._c_posit) return Quire8.from_c_quire(f) - cpdef Quire8 qms(self, Posit8 a1, Posit8 a2): + cpdef Quire8 qsm(self, Posit8 a1, Posit8 a2): cdef cposit.quire8_t f = cposit.q8_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) return Quire8.from_c_quire(f) - cpdef void iqma(self, Posit8 a1, Posit8 a2): + cpdef void iqam(self, Posit8 a1, Posit8 a2): self._c_quire = cposit.q8_fdp_add(self._c_quire, a1._c_posit, a2._c_posit) - cpdef void iqms(self, Posit8 a1, Posit8 a2): + cpdef void iqsm(self, Posit8 a1, Posit8 a2): self._c_quire = cposit.q8_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) cpdef void iclr(self): @@ -298,7 +298,7 @@ cpdef Posit8 p8_fma(Posit8 a1, Posit8 a2, Posit8 a3): cdef cposit.posit8_t f = cposit.p8_mulAdd(a1._c_posit, a2._c_posit, a3._c_posit) return Posit8.from_c_posit(f) -cpdef Posit8 p8_qma(Posit8 a3, Posit8 a1, Posit8 a2): +cpdef Posit8 p8_fam(Posit8 a3, Posit8 a1, Posit8 a2): cdef cposit.posit8_t f = cposit.p8_mulAdd(a1._c_posit, a2._c_posit, a3._c_posit) return Posit8.from_c_posit(f) @@ -329,11 +329,11 @@ cpdef Quire8 p8_to_q8(Posit8 a1): f = cposit.q8_fdp_add(f, a1._c_posit, posit8_one) return Quire8.from_c_quire(f) -cpdef Quire8 q8_qma(Quire8 a3, Posit8 a1, Posit8 a2): +cpdef Quire8 q8_qam(Quire8 a3, Posit8 a1, Posit8 a2): cdef cposit.quire8_t f = cposit.q8_fdp_add(a3._c_quire, a1._c_posit, a2._c_posit) return Quire8.from_c_quire(f) -cpdef Quire8 q8_qms(Quire8 a3, Posit8 a1, Posit8 a2): +cpdef Quire8 q8_qsm(Quire8 a3, Posit8 a1, Posit8 a2): cdef cposit.quire8_t f = cposit.q8_fdp_sub(a3._c_quire, a1._c_posit, a2._c_posit) return Quire8.from_c_quire(f) @@ -434,7 +434,7 @@ cdef class Posit16: cdef cposit.posit16_t f = cposit.p16_mulAdd(self._c_posit, a2._c_posit, a3._c_posit) return Posit16.from_c_posit(f) - cpdef Posit16 qma(self, Posit16 a1, Posit16 a2): + cpdef Posit16 fam(self, Posit16 a1, Posit16 a2): cdef cposit.posit16_t f = cposit.p16_mulAdd(a1._c_posit, a2._c_posit, self._c_posit) return Posit16.from_c_posit(f) @@ -478,7 +478,7 @@ cdef class Posit16: cpdef void ifma(self, Posit16 a2, Posit16 a3): self._c_posit = cposit.p16_mulAdd(self._c_posit, a2._c_posit, a3._c_posit) - cpdef void iqma(self, Posit16 a1, Posit16 a2): + cpdef void ifam(self, Posit16 a1, Posit16 a2): self._c_posit = cposit.p16_mulAdd(a1._c_posit, a2._c_posit, self._c_posit) cpdef void idiv(self, Posit16 other): @@ -604,18 +604,18 @@ cdef class Quire16: # arithmetic - cpdef Quire16 qma(self, Posit16 a1, Posit16 a2): + cpdef Quire16 qam(self, Posit16 a1, Posit16 a2): cdef cposit.quire16_t f = cposit.q16_fdp_add(self._c_quire, a1._c_posit, a2._c_posit) return Quire16.from_c_quire(f) - cpdef Quire16 qms(self, Posit16 a1, Posit16 a2): + cpdef Quire16 qsm(self, Posit16 a1, Posit16 a2): cdef cposit.quire16_t f = cposit.q16_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) return Quire16.from_c_quire(f) - cpdef void iqma(self, Posit16 a1, Posit16 a2): + cpdef void iqam(self, Posit16 a1, Posit16 a2): self._c_quire = cposit.q16_fdp_add(self._c_quire, a1._c_posit, a2._c_posit) - cpdef void iqms(self, Posit16 a1, Posit16 a2): + cpdef void iqsm(self, Posit16 a1, Posit16 a2): self._c_quire = cposit.q16_fdp_sub(self._c_quire, a1._c_posit, a2._c_posit) cpdef void iclr(self): @@ -650,7 +650,7 @@ cpdef Posit16 p16_fma(Posit16 a1, Posit16 a2, Posit16 a3): cdef cposit.posit16_t f = cposit.p16_mulAdd(a1._c_posit, a2._c_posit, a3._c_posit) return Posit16.from_c_posit(f) -cpdef Posit16 p16_qma(Posit16 a3, Posit16 a1, Posit16 a2): +cpdef Posit16 p16_fam(Posit16 a3, Posit16 a1, Posit16 a2): cdef cposit.posit16_t f = cposit.p16_mulAdd(a1._c_posit, a2._c_posit, a3._c_posit) return Posit16.from_c_posit(f) @@ -681,11 +681,11 @@ cpdef Quire16 p16_to_q16(Posit16 a1): f = cposit.q16_fdp_add(f, a1._c_posit, posit16_one) return Quire16.from_c_quire(f) -cpdef Quire16 q16_qma(Quire16 a3, Posit16 a1, Posit16 a2): +cpdef Quire16 q16_qam(Quire16 a3, Posit16 a1, Posit16 a2): cdef cposit.quire16_t f = cposit.q16_fdp_add(a3._c_quire, a1._c_posit, a2._c_posit) return Quire16.from_c_quire(f) -cpdef Quire16 q16_qms(Quire16 a3, Posit16 a1, Posit16 a2): +cpdef Quire16 q16_qsm(Quire16 a3, Posit16 a1, Posit16 a2): cdef cposit.quire16_t f = cposit.q16_fdp_sub(a3._c_quire, a1._c_posit, a2._c_posit) return Quire16.from_c_quire(f)