Re: [PATCH 1/4] MIPS: Introduce isa-rev.h to define MIPS_ISA_REV

From: Maciej W. Rozycki
Date: Mon Feb 26 2018 - 15:08:48 EST


On Mon, 26 Feb 2018, Matt Redfearn wrote:

> +/* If the compiler has defined __mips_isa_rev, believe it. */
> +#ifdef __mips_isa_rev
> +#define MIPS_ISA_REV __mips_isa_rev
> +#else
> +/* The compiler hasn't defined the isa rev so assume it's MIPS I - V (0) */
> +#define MIPS_ISA_REV 0
> +#endif

FYI, GCC has this:

/* The ISA revision level. This is 0 for MIPS I to V and N for
MIPS{32,64}rN. */
int mips_isa_rev;

and this:

if (mips_isa < 32)
mips_isa_rev = 0;
else
mips_isa_rev = (mips_isa & 31) + 1;

and then:

if (mips_isa_rev > 0) \
builtin_define_with_int_value ("__mips_isa_rev", \
mips_isa_rev); \

so your proposal looks like the right approach to me. I think we should
have the various target macros documented in the GCC manual.

Reviewed-by: Maciej W. Rozycki <macro@xxxxxxxx>

Maciej