This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Custom combines for f32x4.demote_zero_f64x2
ClosedPublic

Authored by tlively on Jul 9 2021, 6:51 PM.

Details

Summary

Replace the clang builtin function and LLVM intrinsic for
f32x4.demote_zero_f64x2 with combines from normal SDNodes. Also add missing
combines for i32x4.trunc_sat_zero_f64x2_{s,u}, which share the same pattern.

Diff Detail

Event Timeline

tlively created this revision.Jul 9 2021, 6:51 PM
tlively requested review of this revision.Jul 9 2021, 6:51 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 9 2021, 6:51 PM
aheejin accepted this revision.Jul 10 2021, 9:00 PM
aheejin added inline comments.
clang/include/clang/Basic/BuiltinsWebAssembly.def
192–193

If these share the same pattern, do we need these builtins?

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
2367

Do we not need to check if N->getOpernad(1) is a specific type, such as v2f32 or v2i32?

2411–2412

Same here; do we not need to check if Concat.getOpernad(1) is v2f64?

This revision is now accepted and ready to land.Jul 10 2021, 9:00 PM
tlively updated this revision to Diff 357983.Jul 12 2021, 10:25 AM
  • Check types of splats as well
clang/include/clang/Basic/BuiltinsWebAssembly.def
192–193

Hmm, good point. Maybe not. I'll investigate that in a follow up.

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
2367

I think that the concat_vectors node ensures that the two sides have the same type, but I'll explicitly check to be safe.

This revision was landed with ongoing or failed builds.Jul 12 2021, 10:32 AM
This revision was automatically updated to reflect the committed changes.
tlively added inline comments.Jul 12 2021, 11:37 AM
clang/include/clang/Basic/BuiltinsWebAssembly.def
192–193

Ah, the reason we can't remove these builtins is because there is no good target-independent way to represent the saturating behavior of the float-to-int conversion.