diff --git a/lib/libc/riscv/gen/fabs.S b/lib/libc/riscv/gen/fabs.S --- a/lib/libc/riscv/gen/fabs.S +++ b/lib/libc/riscv/gen/fabs.S @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2021 Alex Richardson * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -10,6 +11,9 @@ * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -35,9 +39,12 @@ #include __FBSDID("$FreeBSD$"); -#ifdef __riscv_float_abi_double ENTRY(fabs) +#ifdef __riscv_float_abi_double fabs.d fa0, fa0 +#else + slli a0,a0,1 + srli a0,a0,1 +#endif ret END(fabs) -#endif