From: Richard Sandiford Date: Mon, 23 Oct 2017 09:36:12 +0000 (+0000) Subject: Use scalar_int/float_mode in brig_langhook_type_for_mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4603941edb719f00d15bae20045630905727bcaa;p=gcc.git Use scalar_int/float_mode in brig_langhook_type_for_mode This follows on from similar changes a couple of months ago and is needed when general modes have variable size. 2017-10-23 Richard Sandiford gcc/brig/ * brig-lang.c (brig_langhook_type_for_mode): Use scalar_int_mode and scalar_float_mode. From-SVN: r254000 --- diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog index fa7668486b2..01778599406 100644 --- a/gcc/brig/ChangeLog +++ b/gcc/brig/ChangeLog @@ -1,3 +1,8 @@ +2017-10-23 Richard Sandiford + + * brig-lang.c (brig_langhook_type_for_mode): Use scalar_int_mode + and scalar_float_mode. + 2017-10-09 Pekka Jääskeläinen * brigfrontend/brig-to-generic.cc: Support BRIG_KIND_NONE diff --git a/gcc/brig/brig-lang.c b/gcc/brig/brig-lang.c index 970214b3a3f..cff605541d0 100644 --- a/gcc/brig/brig-lang.c +++ b/gcc/brig/brig-lang.c @@ -278,10 +278,11 @@ brig_langhook_type_for_mode (machine_mode mode, int unsignedp) return NULL_TREE; } - enum mode_class mc = GET_MODE_CLASS (mode); - if (mc == MODE_FLOAT) + scalar_int_mode imode; + scalar_float_mode fmode; + if (is_int_mode (mode, &imode)) { - switch (GET_MODE_BITSIZE (mode)) + switch (GET_MODE_BITSIZE (imode)) { case 32: return float_type_node; @@ -290,15 +291,15 @@ brig_langhook_type_for_mode (machine_mode mode, int unsignedp) default: /* We have to check for long double in order to support i386 excess precision. */ - if (mode == TYPE_MODE (long_double_type_node)) + if (imode == TYPE_MODE (long_double_type_node)) return long_double_type_node; gcc_unreachable (); return NULL_TREE; } } - else if (mc == MODE_INT) - return brig_langhook_type_for_size(GET_MODE_BITSIZE(mode), unsignedp); + else if (is_float_mode (mode, &fmode)) + return brig_langhook_type_for_size (GET_MODE_BITSIZE (fmode), unsignedp); else { /* E.g., build_common_builtin_nodes () asks for modes/builtins