Skip to content

Commit

Permalink
application: enable zicond optimize for crc16 and crcu16 in coremark
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bigmagic123 authored and fanghuaqi committed Nov 2, 2023
1 parent 9c59a35 commit 1109648
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions application/baremetal/benchmark/coremark/core_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 1109648

Please sign in to comment.