OSDN Git Service

[mips] Add a pattern for 64-bit GPR variant of the `rdhwr` instruction
authorSimon Atanasyan <simon@atanasyan.com>
Tue, 11 Sep 2018 09:57:25 +0000 (09:57 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Tue, 11 Sep 2018 09:57:25 +0000 (09:57 +0000)
commite2dd6e18121ef7032ae3587af77cda393879a228
tree14b68317b80a19e6f9bea0ca8a5170c8c42502e2
parent0b5496ca62504821155c17dd3063758b5493a5ff
[mips] Add a pattern for 64-bit GPR variant of the `rdhwr` instruction

MIPS ISAs start to support third operand for the `rdhwr` instruction
starting from Revision 6. But LLVM generates assembler code with
three-operands version of this instruction on any MIPS64 ISA. The third
operand is always zero, so in case of direct code generation we get
correct code.

This patch fixes the bug by adding an instruction alias. The same alias
already exists for 32-bit ISA.

Ideally, we also need to reject three-operands version of the `rdhwr`
instruction in an assembler code if ISA revision is less than 6. That is
a task for a separate patch.

This fixes PR38861 (https://bugs.llvm.org/show_bug.cgi?id=38861)

Differential revision: https://reviews.llvm.org/D51773

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341919 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/Mips/Mips64InstrInfo.td
test/CodeGen/Mips/tls.ll