[llvm] 131f7ba - [llvm-exegesis] Add unit test in preparation for DD109275

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 01:46:45 PDT 2021


Thank you!

On Tue, Sep 7, 2021 at 10:07 AM Clement Courbet via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Clement Courbet
> Date: 2021-09-07T09:06:49+02:00
> New Revision: 131f7bac63b8cc1700bbae908bdac60f438e69d1
>
> URL: https://github.com/llvm/llvm-project/commit/131f7bac63b8cc1700bbae908bdac60f438e69d1
> DIFF: https://github.com/llvm/llvm-project/commit/131f7bac63b8cc1700bbae908bdac60f438e69d1.diff
>
> LOG: [llvm-exegesis] Add unit test in preparation for DD109275
>
> Added:
>
>
> Modified:
>     llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
> index ce6fd821d2c02..2fd278de07bb7 100644
> --- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
> +++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp
> @@ -154,6 +154,29 @@ TEST_F(X86SerialSnippetGeneratorTest,
>    consumeError(std::move(Error));
>  }
>
> +TEST_F(X86SerialSnippetGeneratorTest,
> +       AvoidSerializingThroughImplicitRegisters) {
> +  // MULX32rr implicitly uses EDX. We should not select that register to avoid
> +  // serialization.
> +  const unsigned Opcode = X86::MULX32rr;
> +  randomGenerator().seed(0); // Initialize seed.
> +  const Instruction &Instr = State.getIC().getInstr(Opcode);
> +  // Forbid all registers but RDX/EDX/DX/DH/DL. The only option would be to
> +  // choose that register, but that would serialize the instruction, so we
> +  // should be returning an error.
> +  auto AllRegisters = State.getRATC().emptyRegisters();
> +  AllRegisters.flip();
> +  AllRegisters.reset(X86::RDX);
> +  AllRegisters.reset(X86::EDX);
> +  AllRegisters.reset(X86::DX);
> +  AllRegisters.reset(X86::DH);
> +  AllRegisters.reset(X86::DL);
> +  auto Error =
> +      Generator.generateCodeTemplates(&Instr, AllRegisters).takeError();
> +  // FIXME: EXPECT_TRUE + consumeError(std::move(Error)).
> +  EXPECT_FALSE((bool)Error);
> +}
> +
>  TEST_F(X86SerialSnippetGeneratorTest, DependencyThroughOtherOpcode) {
>    // - CMP64rr
>    // - Op0 Explicit Use RegClass(GR64)
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list