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

Commit 09a7ac2

Browse files
linsinan1995sinan-lin
authored andcommitted
[Hook] Add TARGET_VECTOR_MODE_SUPPORTED_P implementation
1 parent 348ee28 commit 09a7ac2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

gcc/config/riscv/riscv.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5253,6 +5253,24 @@ riscv_new_address_profitable_p (rtx memref, rtx_insn *insn, rtx new_addr)
52535253
return new_cost <= old_cost;
52545254
}
52555255

5256+
bool
5257+
riscv_vector_mode_supported_p (enum machine_mode mode)
5258+
{
5259+
/* a few instructions(e.g. kdmabb) in RV64P also supports V2HI */
5260+
if (mode == V2HImode)
5261+
return TARGET_ZPN;
5262+
5263+
if (mode == V4QImode)
5264+
return TARGET_ZPN && !TARGET_64BIT;
5265+
5266+
if (mode == V8QImode
5267+
|| mode == V4HImode
5268+
|| mode == V2SImode)
5269+
return TARGET_ZPN && TARGET_64BIT;
5270+
5271+
return false;
5272+
}
5273+
52565274
/* Initialize the GCC target structure. */
52575275
#undef TARGET_ASM_ALIGNED_HI_OP
52585276
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -5436,6 +5454,10 @@ riscv_new_address_profitable_p (rtx memref, rtx_insn *insn, rtx new_addr)
54365454
#undef TARGET_NEW_ADDRESS_PROFITABLE_P
54375455
#define TARGET_NEW_ADDRESS_PROFITABLE_P riscv_new_address_profitable_p
54385456

5457+
/* rvp */
5458+
#undef TARGET_VECTOR_MODE_SUPPORTED_P
5459+
#define TARGET_VECTOR_MODE_SUPPORTED_P riscv_vector_mode_supported_p
5460+
54395461
struct gcc_target targetm = TARGET_INITIALIZER;
54405462

54415463
#include "gt-riscv.h"

0 commit comments

Comments
 (0)