Update the argument of the as-insn for the Zbb case to verify that
Zbb is supported not only by a compiler, but also by an assembler.

Also, check-extenstion(ext_name, "insn") helper macro is introduced
to check whether extension is supported by a compiler and an assembler.

Signed-off-by: Oleksii Kurochko <oleksii.kuroc...@gmail.com>
---
Changes in V3:
 - code style fixes: use "-" insteaf of "_" for names.
 - update the commit message.
---
Changes in V2:
 - introduce check_extenstion to abstract a check of if extenstion is
   supported or not.
 - update the commit message.
---
 xen/arch/riscv/arch.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 53f3575e7d..dd242c91d1 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -11,9 +11,14 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
 
-zbb := $(call as-insn,$(CC) $(riscv-generic-flags)_zbb,"",_zbb)
-zihintpause := $(call as-insn, \
-                      $(CC) 
$(riscv-generic-flags)_zihintpause,"pause",_zihintpause)
+# check-extension: Check whether extenstion is supported by a compiler and
+#                  an assembler.
+# Usage: $(call check-extension,extension_name,"instr")
+check-extension = $(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(2),_$(1))
+
+zbb-insn := "andn t0, t0, t0"
+zbb := $(call check-extension,zbb,$(zbb-insn))
+zihintpause := $(call check-extension,zihintpause,"pause")
 
 extensions := $(zbb) $(zihintpause)
 
-- 
2.44.0


Reply via email to