[PATCH] D112774: [RISCV] Support k-ext clang intrinsics

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 15:00:04 PST 2022


craig.topper added a comment.

Any intrinsic that takes an immediate that needs to be in certain range, needs to have code added to SemaChecking.cpp to validate the range. Look for the other places we call SemaBuiltinConstantArgRange in Sema::CheckRISCVBuiltinFunctionCall



================
Comment at: clang/include/clang/Basic/BuiltinsRISCV.def:76
+TARGET_BUILTIN(__builtin_riscv_brev8, "ZiZi", "nc", "zbkb")
+TARGET_BUILTIN(__builtin_riscv_zip, "ZiZi", "nc", "zbkb")
+TARGET_BUILTIN(__builtin_riscv_unzip, "ZiZi", "nc", "zbkb")
----------------
Nothing is preventing __builtin_riscv_zip/unzip from being used on RV64 which will crash. We don't have a "32bit" feature flag so we can't fix it from here. You'll need to go into clang/lib/Sema/SemaChecking.cpp and implement something like where X86 emits err_32_bit_builtin_64_bit_tgt. Same is true for any other 32-bit only intrinsic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112774/new/

https://reviews.llvm.org/D112774



More information about the cfe-commits mailing list