[PATCH] D101684: [WebAssembly] Add end-to-end codegen tests for wasm_simd128.h

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 2 17:59:36 PDT 2021


aheejin added a comment.

In D101684#2732551 <https://reviews.llvm.org/D101684#2732551>, @dblaikie wrote:

> In D101684#2732522 <https://reviews.llvm.org/D101684#2732522>, @aheejin wrote:
>
>> I think there's a clear upside on keeping this within clang/.
>>
>> 1. As @tlively said, there are many number of instructions to test and keeping "C function - LLVM intrinsic" and "LLVM intrinsic - Wasm instruction" tests in sync without autogeneration will be hard and error-prone.
>
> I don't necessarily see that they should be kept in sync - in the same way that we don't do this for other IR targets and other features, like ABIs - it's important they are lowered to specific instructions, but we don't generally validate that through end to end tests.

What I meant by keeping in sync was, because there are many instructions and some of them are added and deleted as we progress, so making sure the two tests test the same set of instructions without missing anything is different, without resorting to some kind of autogeneration tool.

>> 2. Also it is not always the case that we have 1-1-1 relationship of C intrinsic function - LLVM intrinsic - Wasm instruction. For some of these we don't have our own intrinsics but rather use LLVM's common intrinsics, and they don't always boil down to a single LLVM intrinsic. There are cases where a single C function call can be lowered to multiple instructions in the LLVM IR, which we try to pattern match and lower to a single Wasm instruction. This kind of relationship can't be tested easily so it will take significantly longer time to check if a single C function call will result in a single Wasm instruction.
>
> The lack of 1-to-1 is part of the reason I prefer these tests to be separate. If one C level intrinsic lowers to multiple IR operations - then it's good to test each of those IR operations separately from each other. So that all their uses can be validated. Then, knowing they are validated - the Clang C-to-IR test can test that suitable operations are generated, knowing that they're tested in LLVM to work as specified.

We have tests in LLVM too. But they can't check whether a single C function call boils down to a single Wasm instruction. And it is not always easy to look at those patterns and come up with the reverse mapping that created it. We match and optimize a lot of patterns, some of them generated from a single C function call but others not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101684



More information about the llvm-commits mailing list