Skip to content

Commit 660bc69

Browse files
Shahab VahediMichielDerhaeg
authored andcommitted
arcv: Introduce riscv_is_micro_arch ()
ARC-V related optimisations must be guarded like: if (riscv_microarchitecture == <arch>) { ... } Introduce an inline function that encapsulates this: static inline bool riscv_is_micro_arch (<arch>) Use it to define __riscv_rhx whenever compiling for the RHX microarchitecture. Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
1 parent bb74c33 commit 660bc69

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

gcc/config/riscv/riscv-c.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
149149
builtin_define_with_int_value ("__riscv_th_v_intrinsic",
150150
riscv_ext_version_value (0, 11));
151151

152+
if (riscv_is_micro_arch (arcv_rhx100))
153+
builtin_define ("__riscv_rhx");
154+
152155
/* Define architecture extension test macros. */
153156
builtin_define_with_int_value ("__riscv_arch_test", 1);
154157

gcc/config/riscv/riscv-protos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,9 @@ extern unsigned int th_int_get_mask (unsigned int);
821821
extern unsigned int th_int_get_save_adjustment (void);
822822
extern rtx th_int_adjust_cfi_prologue (unsigned int);
823823
extern const char *th_asm_output_opcode (FILE *asm_out_file, const char *p);
824+
825+
extern bool riscv_is_micro_arch (enum riscv_microarchitecture_type);
826+
824827
#ifdef RTX_CODE
825828
extern const char*
826829
th_mempair_output_move (rtx[4], bool, machine_mode, RTX_CODE);

gcc/config/riscv/riscv.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,12 @@ typedef enum
898898

899899
typedef insn_code (*code_for_push_pop_t) (machine_mode);
900900

901+
bool
902+
riscv_is_micro_arch (enum riscv_microarchitecture_type arch)
903+
{
904+
return (riscv_microarchitecture == arch);
905+
}
906+
901907
void riscv_frame_info::reset(void)
902908
{
903909
total_size = 0;

0 commit comments

Comments
 (0)