This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: [PATCH 1/3] [ARC] Add arithmetic and logic instructions for nps
- From: Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>
- To: Graham Markall <graham dot markall at embecosm dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 14 Jun 2016 07:53:06 +0000
- Subject: RE: [PATCH 1/3] [ARC] Add arithmetic and logic instructions for nps
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1465827288 dot git dot graham dot markall at embecosm dot com> <2c59857dfcfc0b31c69d0f3e2a91ca1ad6720a3b dot 1465827288 dot git dot graham dot markall at embecosm dot com>
Hi,
> +#define
> MAKE_1BASED_INSERT_EXTRACT_FUNCS(NAME,SHIFT,UPPER,BITS) \
> +static unsigned \
> +insert_nps_##NAME (unsigned insn ATTRIBUTE_UNUSED, \
> + int value ATTRIBUTE_UNUSED, \
> + const char **errmsg ATTRIBUTE_UNUSED) \
> +{ \
> + if (value < 0 || value > UPPER) \
> + *errmsg = _("Value must be in the range 0 to " #UPPER); \
> + if (value == UPPER) \
> + value = 0; \
> + return insn | (value << SHIFT); \
> +} \
> + \
> +static int \
> +extract_nps_##NAME (unsigned insn ATTRIBUTE_UNUSED, \
> + bfd_boolean * invalid ATTRIBUTE_UNUSED) \
> +{ \
> + int value = (insn >> SHIFT) & ((1 << BITS) - 1); \
> + if (value == 0) \
> + value = UPPER; \
> + return value; \
> +}
I am not sure if you need those two functions as the default behavior for insert and extract behaves similarly.
//Claudiu