From 1109648602f1f5bae0c216569a4eb7f9653597c0 Mon Sep 17 00:00:00 2001 From: bigmagic Date: Wed, 1 Nov 2023 18:44:17 +0800 Subject: [PATCH] application: enable zicond optimize for crc16 and crcu16 in coremark In order for zicond to be enabled and effective, GCC with optimized parameters is required. example usage for rv32imafdc_zba_zbb_zbc_zbs_zicond riscv arch. cd application/baremetal/benchmark/coremark/ make CORE=n900fd ARCH_EXT=_zba_zbb_zbc_zbs_zicond clean make CORE=n900fd ARCH_EXT=_zba_zbb_zbc_zbs_zicond all --- .../baremetal/benchmark/coremark/core_util.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/application/baremetal/benchmark/coremark/core_util.c b/application/baremetal/benchmark/coremark/core_util.c index 6727672d..a65b5774 100644 --- a/application/baremetal/benchmark/coremark/core_util.c +++ b/application/baremetal/benchmark/coremark/core_util.c @@ -170,22 +170,41 @@ ee_u16 crcu8(ee_u8 data, ee_u16 crc) } return crc; } + +#if (defined(__riscv_zicond) && !defined(__clang__)) +#pragma GCC push_options +#pragma GCC optimize("-fcode-hoisting") +#pragma GCC optimize("-ftree-vrp") +#endif ee_u16 crcu16(ee_u16 newval, ee_u16 crc) { crc = crcu8((ee_u8)(newval), crc); crc = crcu8((ee_u8)((newval) >> 8), crc); return crc; } +#if (defined(__riscv_zicond) && !defined(__clang__)) +#pragma GCC pop_options +#endif + ee_u16 crcu32(ee_u32 newval, ee_u16 crc) { crc = crc16((ee_s16) newval, crc); crc = crc16((ee_s16)(newval >> 16), crc); return crc; } + +#if (defined(__riscv_zicond) && !defined(__clang__)) +#pragma GCC push_options +#pragma GCC optimize("-fcode-hoisting") +#pragma GCC optimize("-ftree-vrp") +#endif ee_u16 crc16(ee_s16 newval, ee_u16 crc) { return crcu16((ee_u16)newval, crc); } +#if (defined(__riscv_zicond) && !defined(__clang__)) +#pragma GCC pop_options +#endif ee_u8 check_data_types() {