From 84477fc83223a883bbb53a31b4cbc08eee02af85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Mon, 19 Feb 2024 22:52:29 +0100 Subject: [PATCH] gccrs: minor cleanup in langhook.type_for_mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc/rust/ChangeLog: * rust-lang.cc (grs_langhook_type_for_mode): simplify code for xImode. Add missing long_double_type_node. Signed-off-by: Marc Poulhiès --- gcc/rust/rust-lang.cc | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index 99c4aa58dad6..258b5f3b61f3 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -172,38 +172,29 @@ static tree grs_langhook_type_for_mode (machine_mode mode, int unsignedp) { // TODO: change all this later to match rustc types - if (mode == TYPE_MODE (float_type_node)) - return float_type_node; - - if (mode == TYPE_MODE (double_type_node)) - return double_type_node; - - if (mode == TYPE_MODE (intQI_type_node)) // quarter integer mode - single byte - // treated as integer + if (mode == QImode) return unsignedp ? unsigned_intQI_type_node : intQI_type_node; - if (mode - == TYPE_MODE (intHI_type_node)) // half integer mode - two-byte integer + + if (mode == HImode) return unsignedp ? unsigned_intHI_type_node : intHI_type_node; - if (mode - == TYPE_MODE (intSI_type_node)) // single integer mode - four-byte integer + + if (mode == SImode) return unsignedp ? unsigned_intSI_type_node : intSI_type_node; - if (mode - == TYPE_MODE ( - intDI_type_node)) // double integer mode - eight-byte integer + + if (mode == DImode) return unsignedp ? unsigned_intDI_type_node : intDI_type_node; - if (mode - == TYPE_MODE (intTI_type_node)) // tetra integer mode - 16-byte integer + + if (mode == TYPE_MODE (intTI_type_node)) return unsignedp ? unsigned_intTI_type_node : intTI_type_node; - if (mode == TYPE_MODE (integer_type_node)) - return unsignedp ? unsigned_type_node : integer_type_node; + if (mode == TYPE_MODE (float_type_node)) + return float_type_node; - if (mode == TYPE_MODE (long_integer_type_node)) - return unsignedp ? long_unsigned_type_node : long_integer_type_node; + if (mode == TYPE_MODE (double_type_node)) + return double_type_node; - if (mode == TYPE_MODE (long_long_integer_type_node)) - return unsignedp ? long_long_unsigned_type_node - : long_long_integer_type_node; + if (mode == TYPE_MODE (long_double_type_node)) + return long_double_type_node; if (COMPLEX_MODE_P (mode)) {