Skip to content

Commit

Permalink
gccrs: minor cleanup in langhook.type_for_mode
Browse files Browse the repository at this point in the history
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 <dkm@kataplop.net>
  • Loading branch information
dkm committed Feb 20, 2024
1 parent 5989e3d commit 84477fc
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions gcc/rust/rust-lang.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit 84477fc

Please sign in to comment.