Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
[Hook] Add TARGET_VECTOR_MODE_SUPPORTED_P implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
linsinan1995 committed May 31, 2021
1 parent 641d153 commit 1759d4c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions gcc/config/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -5253,6 +5253,24 @@ riscv_new_address_profitable_p (rtx memref, rtx_insn *insn, rtx new_addr)
return new_cost <= old_cost;
}

bool
riscv_vector_mode_supported_p (enum machine_mode mode)
{
/* a few instructions(e.g. kdmabb) in RV64P also supports V2HI */
if (mode == V2HImode)
return TARGET_ZPN;

if (mode == V4QImode)
return TARGET_ZPN && !TARGET_64BIT;

if (mode == V8QImode
|| mode == V4HImode
|| mode == V2SImode)
return TARGET_ZPN && TARGET_64BIT;

return false;
}

/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
Expand Down Expand Up @@ -5436,6 +5454,10 @@ riscv_new_address_profitable_p (rtx memref, rtx_insn *insn, rtx new_addr)
#undef TARGET_NEW_ADDRESS_PROFITABLE_P
#define TARGET_NEW_ADDRESS_PROFITABLE_P riscv_new_address_profitable_p

/* rvp */
#undef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P riscv_vector_mode_supported_p

struct gcc_target targetm = TARGET_INITIALIZER;

#include "gt-riscv.h"

0 comments on commit 1759d4c

Please sign in to comment.