aboutsummaryrefslogtreecommitdiff
path: root/gcc/machmode.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:09:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:09:41 +0000
commit857c7b46875bdcf9d889543baad54977034d57ef (patch)
tree60a693fba5c631712da730e6ce07a8deda2af759 /gcc/machmode.h
parentd16c828e7aa2a704d887b071864823fc1e39670f (diff)
downloadgcc-857c7b46875bdcf9d889543baad54977034d57ef.zip
gcc-857c7b46875bdcf9d889543baad54977034d57ef.tar.gz
gcc-857c7b46875bdcf9d889543baad54977034d57ef.tar.bz2
[11/77] Add a float_mode_for_size helper function
This provides a type-safe way to ask for a float mode and get it as a scalar_float_mode. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (opt_scalar_float_mode): New typedef. * machmode.h (float_mode_for_size): New function. * emit-rtl.c (double_mode): Delete. (init_emit_once): Use float_mode_for_size. * stor-layout.c (layout_type): Likewise. * gdbhooks.py (build_pretty_printer): Handle opt_scalar_float_mode. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251463
Diffstat (limited to 'gcc/machmode.h')
-rw-r--r--gcc/machmode.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 3b71b9d..aa931f5 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -520,7 +520,16 @@ extern const unsigned char mode_complex[NUM_MACHINE_MODES];
extern machine_mode mode_for_size (unsigned int, enum mode_class, int);
-/* Similar, but find the smallest mode for a given width. */
+/* Return the machine mode to use for a MODE_FLOAT of SIZE bits, if one
+ exists. */
+
+inline opt_scalar_float_mode
+float_mode_for_size (unsigned int size)
+{
+ return dyn_cast <scalar_float_mode> (mode_for_size (size, MODE_FLOAT, 0));
+}
+
+/* Similar to mode_for_size, but find the smallest mode for a given width. */
extern machine_mode smallest_mode_for_size (unsigned int,
enum mode_class);