diff options
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/local.mk | 1 | ||||
| -rw-r--r-- | gnu/packages/maths.scm | 37 | ||||
| -rw-r--r-- | gnu/packages/patches/symfpu-fix-rounding-test-case.patch | 15 |
3 files changed, 51 insertions, 2 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 405a203cc3e..64c215fc31d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk | |||
| @@ -2198,6 +2198,7 @@ dist_patch_DATA = \ | |||
| 2198 | %D%/packages/patches/stk-5.0.1-fix-typo.patch \ | 2198 | %D%/packages/patches/stk-5.0.1-fix-typo.patch \ |
| 2199 | %D%/packages/patches/strace-readlink-tests.patch \ | 2199 | %D%/packages/patches/strace-readlink-tests.patch \ |
| 2200 | %D%/packages/patches/sunxi-tools-remove-sys-io.patch \ | 2200 | %D%/packages/patches/sunxi-tools-remove-sys-io.patch \ |
| 2201 | %D%/packages/patches/symfpu-fix-rounding-test-case.patch \ | ||
| 2201 | %D%/packages/patches/patch-hurd-path-max.patch \ | 2202 | %D%/packages/patches/patch-hurd-path-max.patch \ |
| 2202 | %D%/packages/patches/perl-5.14-autosplit-default-time.patch \ | 2203 | %D%/packages/patches/perl-5.14-autosplit-default-time.patch \ |
| 2203 | %D%/packages/patches/perl-5.14-module-pluggable-search.patch \ | 2204 | %D%/packages/patches/perl-5.14-module-pluggable-search.patch \ |
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 72a963db701..db6eceabeae 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm | |||
| @@ -8397,7 +8397,8 @@ s-expression-based format.") | |||
| 8397 | (commit (string-append "symfpu-" version "-dual-license")))) | 8397 | (commit (string-append "symfpu-" version "-dual-license")))) |
| 8398 | (file-name (git-file-name name version)) | 8398 | (file-name (git-file-name name version)) |
| 8399 | (sha256 | 8399 | (sha256 |
| 8400 | (base32 "13a9y0spyi6pggbhjgwi9g2qy822h1zakzhhwvm8qgk5c4njv3c6")))) | 8400 | (base32 "13a9y0spyi6pggbhjgwi9g2qy822h1zakzhhwvm8qgk5c4njv3c6")) |
| 8401 | (patches (search-patches "symfpu-fix-rounding-test-case.patch")))) | ||
| 8401 | (build-system copy-build-system) | 8402 | (build-system copy-build-system) |
| 8402 | (arguments | 8403 | (arguments |
| 8403 | (list | 8404 | (list |
| @@ -8407,6 +8408,38 @@ s-expression-based format.") | |||
| 8407 | ("utils" "include/symfpu/utils" #:exclude ("Makefile"))) | 8408 | ("utils" "include/symfpu/utils" #:exclude ("Makefile"))) |
| 8408 | #:phases | 8409 | #:phases |
| 8409 | #~(modify-phases %standard-phases | 8410 | #~(modify-phases %standard-phases |
| 8411 | ;; Make sure that the tests exit with a zero exit status by default. | ||
| 8412 | ;; Generated tests have assert(3) statements which exit with a | ||
| 8413 | ;; non-zero exit status on test failure. | ||
| 8414 | (add-after 'unpack 'fix-tests | ||
| 8415 | (lambda _ | ||
| 8416 | (substitute* "applications/test.cpp" | ||
| 8417 | (("return 1") "return 0")))) | ||
| 8418 | (add-before 'install 'check | ||
| 8419 | (lambda* (#:key tests? #:allow-other-keys) | ||
| 8420 | (when tests? | ||
| 8421 | ;; To ensure the test application builds prior to 'install, | ||
| 8422 | ;; set up a symlink and modify CXXFLAGS to find the headers. | ||
| 8423 | (symlink #$source "symfpu") | ||
| 8424 | (invoke "make" "CXXFLAGS=-I." "test") | ||
| 8425 | |||
| 8426 | ;; Run tests in their breadth (i.e., --allTests) but on a very | ||
| 8427 | ;; small value range as otherwise the tests run for a long time. | ||
| 8428 | (invoke "./test" | ||
| 8429 | "--allTests" | ||
| 8430 | "--printC" | ||
| 8431 | "--start=0" | ||
| 8432 | "--end=125" | ||
| 8433 | "--verbose") | ||
| 8434 | |||
| 8435 | ;; Test script generates C code which we then compile & execute. | ||
| 8436 | (for-each | ||
| 8437 | (lambda (file) | ||
| 8438 | (let ((case (string-drop-right file (string-length ".c")))) | ||
| 8439 | (format #t "Running test case ~a~%" case) | ||
| 8440 | (invoke "g++" "-std=gnu++11" "-o" case file) | ||
| 8441 | (invoke (string-append "./" case)))) | ||
| 8442 | (find-files "." "^testC..*\\.c$"))))) | ||
| 8410 | (add-before 'install 'build-pkgconfig | 8443 | (add-before 'install 'build-pkgconfig |
| 8411 | (lambda* (#:key outputs #:allow-other-keys) | 8444 | (lambda* (#:key outputs #:allow-other-keys) |
| 8412 | (with-output-to-file "symfpu.pc" | 8445 | (with-output-to-file "symfpu.pc" |
| @@ -8427,7 +8460,7 @@ s-expression-based format.") | |||
| 8427 | "Concrete and symbolic implementation of IEEE-754 floating-point numbers") | 8460 | "Concrete and symbolic implementation of IEEE-754 floating-point numbers") |
| 8428 | (description | 8461 | (description |
| 8429 | "SoftFPU is a C++ library implementing concrete and symbolic | 8462 | "SoftFPU is a C++ library implementing concrete and symbolic |
| 8430 | mantics for floating point numbers as defined in the IEEE-764 Standard | 8463 | mantics for floating point numbers as defined in the IEEE-754 Standard |
| 8431 | r Floating-Point Arithmetic. It is templated in terms of the | 8464 | r Floating-Point Arithmetic. It is templated in terms of the |
| 8432 | t-vectors, propositions, floating-point formats and rounding mode types | 8465 | t-vectors, propositions, floating-point formats and rounding mode types |
| 8433 | ed. This allow the same code to be executed as an arbitrary precision | 8466 | ed. This allow the same code to be executed as an arbitrary precision |
diff --git a/gnu/packages/patches/symfpu-fix-rounding-test-case.patch b/gnu/packages/patches/symfpu-fix-rounding-test-case.patch new file mode 100644 index 00000000000..120807653d3 --- /dev/null +++ b/gnu/packages/patches/symfpu-fix-rounding-test-case.patch | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | Taken from: https://github.com/martin-cs/symfpu/pull/13 | ||
| 2 | |||
| 3 | diff --git a/applications/test.cpp b/applications/test.cpp | ||
| 4 | index 2a92a40..4f6b157 100644 | ||
| 5 | --- a/applications/test.cpp | ||
| 6 | +++ b/applications/test.cpp | ||
| 7 | @@ -1186,7 +1186,7 @@ int main (int argc, char **argv) { | ||
| 8 | {0,0, "min", INST(binaryFunction, min), "fminf(f,g)", "(fp.min f g)"}, | ||
| 9 | {0,1, "sqrt", INST(unaryRoundedFunction, sqrt), "sqrtf(f)", "(fp.sqrt rm f)"}, | ||
| 10 | {0,1, "round_to_integral", INST(unaryRoundedFunction, rti), "(fegetround()==FE_TONEAREST) ? rintf(f) : (fegetround()==FE_UPWARD) ? ceilf(f) : (fegetround()==FE_DOWNWARD) ? floorf(f) : truncf(f)", "(fp.roundToIntegral rm f)"}, | ||
| 11 | - {0,1, "fma", INST(ternaryRoundedFunction, fma), "fmaf(f,g)", "(fp.fma rm f g h)"}, | ||
| 12 | + {0,1, "fma", INST(ternaryRoundedFunction, fma), "fmaf(f,g,h)", "(fp.fma rm f g h)"}, | ||
| 13 | {0,0, "remainder", INST(binaryFunction, rem), "remainderf(f,g)", "(fp.remainder f g)"}, | ||
| 14 | {0,0, NULL, NULL, NULL, NULL, NULL, NULL} | ||
| 15 | }; | ||
