update detailsupdate branch of LLVMchange -march from rv64imaczca0p50 into rv64imaczce0p50How to compile with Zce compile switchs.Specify the arch/abi as rv64imac/lp64 when build gnu toolchain. because default is rv64imafdc/lp64dmotify c filesCompile a C file with Zce ext in LLVMIn this article, we try to compile a C program in LLVM using RISCV architecture and Zce Extension.The files mentioned in the article are in follow links MaterialsBuild GNU tool chainLooking riscv-gnu-toolchain repo for more informationgit clone https://github.com/riscv/riscv-gnu-toolchain cd riscv-gnu-toolchain ./configure --prefix=$HOME/opt/riscv --enable-multilib --with-arch=rv64imac --with-abi=lp64 make # NewlibExport the Env path for GNU tool chainexport PATH=$HOME/opt/riscv/bin:$PATHBuild LLVM# clone the source code of LLVM git clone -b riscv-zce-llvm14 https://github.com/plctlab/llvm-project.git cd llvm-project/ mkdir build cd build cmake -DLLVM_TARGETS_TO_BUILD="RISCV" -DLLVM_ENABLE_PROJECTS="clang;lld;libcxx;libcxxabi" -G "Unix Makefiles" ../llvm make -j-DCMAKE_BUILD_TYPE=type — Valid options for type are Debug, Release, RelWithDebInfo, and MinSizeRel. Default is Debug.Note: release builds are 2.2gb while debug builds are 15gbimport the PATHexport PATH=$HOME/llvm-project/build/bin:$PATHCompile C programWrite C fileWrite code into hello.cint test(){ int c = 63; int a = 6; int b = a * c * 30; return b; } #include<stdio.h> const int GLOAL_ZCE = 1; int fbm(int a, int b, int count){ int res = a * b; printf("a --> %d, b --> %d\n", a, b); printf("result is %d\n", res); if(count>1) return fbm(b,res,count-1); else return res; } int main(int argc, char const *argv[]) { char x=-1; printf("%d\n", x); int a = 1; int b = 2; int result = fbm(a,b,7) + test(); return 0; }CompileThan compile source code by following commandclang --target=riscv64 -march=rv64imaczce0p50 -menable-experimental-extensions --gcc-toolchain=$HOME/opt/riscv -o hello.o hello.c # or clang --target=riscv64 -march=rv64imaczce0p50 -menable-experimental-extensions --gcc-toolchain=$HOME/opt/riscv -fuse-ld=lld -mno-relax -o hello.o hello.cthe second command is use lld as linkersome instructions of Zce require M extWe use gnu tool chain here. The parameter --gcc-toolchain should be the path of GNU tool chain you have just build.Dump the Obj filellvm-objdump --mattr=+experimental-zce,+m,+c -d -r hello.oFor param --mattr, we'd better keep it same as which do we used in compiling.We can find the c.mul has been been used.Compile with switchswe also implement the compile switchs so that you can use only specific instructions of Zce Ext to compile or evaluate. e.g. compile with only MULI, use following commandclang --target=riscv64 -march=rv64imac -mzce-muli -gcc-toolchain=$HOME/opt/riscv -o hello.o hello.c # or clang --target=riscv64 -march=rv64imac -mzce-muli --gcc-toolchain=$HOME/opt/riscv -fuse-ld=lld -mno-relax -o hello.o hello.cThen Dump Obj file again, we find the muli while c.mul disappears.Run on QemuBuild Qemugit clone -b plct-zce-dev https://github.com/plctlab/plct-qemu.git cd plct-qemu ./configure --target-list=riscv64-linux-user makeimport the PATHexport PATH=$HOME/report/plct-qemu/build:$PATHRun on qemuqemu-riscv64 -cpu rv64,x-zce=true hello.oYou can comment below or email me if you have any issues.