[v2,1/4] riscv: Use builtins for the fmaximum and fminimum
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
Enable the fmax and fmin builtins for the fmaximum{_num} and fminimum{_num}.
The generic fmaximum{_num} and fminimum{_num} use them for ordered operands,
on rv64gc the double-precision functions drop from 21, 26, 23 and
29 instructions to 8, 8, 14 and 14.
fmax and fmin keep their own implementations, which need a signaling NaN
check because the instruction returns the number where C requires a
quiet NaN. The headers live in rvd because without floating-point
registers GCC lowers the builtins to a call, which would recurse.
Signed-off-by: Julian Zhu <jz531210@gmail.com>
---
sysdeps/riscv/rvd/math-use-builtins-fmax.h | 15 +++++++++++++++
sysdeps/riscv/rvd/math-use-builtins-fmin.h | 15 +++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 sysdeps/riscv/rvd/math-use-builtins-fmax.h
create mode 100644 sysdeps/riscv/rvd/math-use-builtins-fmin.h
new file mode 100644
@@ -0,0 +1,15 @@
+/* This does not affect fmax and fmaxf, which have their own
+ implementations in rvd and rvf: the instruction returns the number for
+ a signaling NaN operand where C requires a quiet NaN, so they need an
+ explicit check. Only the fmaximum and fminimum families and hypot use
+ these builtins. */
+#if __GNUC_PREREQ (13, 0)
+# define USE_FMAX_BUILTIN 1
+# define USE_FMAXF_BUILTIN 1
+#else
+# define USE_FMAX_BUILTIN 0
+# define USE_FMAXF_BUILTIN 0
+#endif
+
+#define USE_FMAXL_BUILTIN 0
+#define USE_FMAXF128_BUILTIN 0
new file mode 100644
@@ -0,0 +1,15 @@
+/* This does not affect fmin and fminf, which have their own
+ implementations in rvd and rvf: the instruction returns the number for
+ a signaling NaN operand where C requires a quiet NaN, so they need an
+ explicit check. Only the fmaximum and fminimum families and hypot use
+ these builtins. */
+#if __GNUC_PREREQ (13, 0)
+# define USE_FMIN_BUILTIN 1
+# define USE_FMINF_BUILTIN 1
+#else
+# define USE_FMIN_BUILTIN 0
+# define USE_FMINF_BUILTIN 0
+#endif
+
+#define USE_FMINL_BUILTIN 0
+#define USE_FMINF128_BUILTIN 0