[PATCH] D105755: [WebAssembly] Custom combines for f32x4.demote_zero_f64x2

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 10 21:00:19 PDT 2021


aheejin accepted this revision.
aheejin added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:192-193
 
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", "simd128")
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", "simd128")
-TARGET_BUILTIN(__builtin_wasm_demote_zero_f64x2_f32x4, "V4fV2d", "nc", "simd128")
----------------
If these share the same pattern, do we need these builtins?


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2367
+
+    if (!IsZeroSplat(N->getOperand(1)))
+      return SDValue();
----------------
Do we not need to check if `N->getOpernad(1)` is a specific type, such as `v2f32` or `v2i32`?


================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2410
 
-  auto *Splat = dyn_cast<BuildVectorSDNode>(N->getOperand(1));
-  APInt SplatValue, SplatUndef;
-  unsigned SplatBitSize;
-  bool HasAnyUndefs;
-  if (!Splat || !Splat->isConstantSplat(SplatValue, SplatUndef, SplatBitSize,
-                                        HasAnyUndefs))
+  if (!IsZeroSplat(Concat.getOperand(1)))
     return SDValue();
----------------
Same here; do we not need to check if `Concat.getOpernad(1)` is `v2f64`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105755



More information about the cfe-commits mailing list