RISC-V: Check if zcd conflicts with zcmt and zcmp

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc
	(riscv_subset_list::check_conflict_ext): Check zcd conflicts
	with zcmt and zcmp.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/arch-29.c: New test.
	* gcc.target/riscv/arch-30.c: New test.
This commit is contained in:
Kito Cheng 2023-11-27 20:50:11 +08:00
parent 6e2e0ce679
commit f542df026c
3 changed files with 22 additions and 0 deletions

View file

@ -1231,6 +1231,14 @@ riscv_subset_list::check_conflict_ext ()
/* 'H' hypervisor extension requires base ISA with 32 registers. */
if (lookup ("e") && lookup ("h"))
error_at (m_loc, "%<-march=%s%>: h extension requires i extension", m_arch);
if (lookup ("zcd"))
{
if (lookup ("zcmt"))
error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmt", m_arch);
if (lookup ("zcmp"))
error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmp", m_arch);
}
}
/* Parsing function for multi-letter extensions.

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-march=rv64id_zcd_zcmt -mabi=lp64d" } */
int foo()
{
}
/* { dg-error "zcd conflicts with zcmt" "" { target *-*-* } 0 } */

View file

@ -0,0 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-march=rv64id_zcd_zcmp -mabi=lp64d" } */
int foo()
{
}
/* { dg-error "zcd conflicts with zcmp" "" { target *-*-* } 0 } */