[PATCH] D112186: [WebAssembly] Add prototype relaxed float to int trunc instructions

Thomas Lively via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 18:06:28 PDT 2021


tlively added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:18373-18374
+    llvm::Type *SrcT = Vec->getType();
+    llvm::Type *TruncT =
+        FixedVectorType::get(llvm::IntegerType::get(getLLVMContext(), 32), 4);
+    Function *Callee = CGM.getIntrinsic(IntNo, {TruncT, SrcT});
----------------
This can be `ConvertType(E->getType())` to calculate the LLVM type from the clang type for the call. However, it would be even better to not make these intrinsics polymorphic.


================
Comment at: llvm/include/llvm/IR/IntrinsicsWebAssembly.td:218-219
+def int_wasm_relaxed_trunc_signed:
+  Intrinsic<[llvm_anyvector_ty],
+            [llvm_anyvector_ty],
+            [IntrNoMem, IntrSpeculatable]>;
----------------
Since these intrinsics only need to work with a single set of types each, it would be simpler to specify those types rather than make the intrinsics polymorphic. See the definition of `int_wasm_q15mulr_sat_signed` for an example. That would allow you to drop the type arguments from `CGM.getIntrinsic()` in CGBuiltin.cpp.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112186



More information about the cfe-commits mailing list