llvm.org GIT mirror llvm / 6ef2902
Merging r341919: ------------------------------------------------------------------------ r341919 | atanasyan | 2018-09-11 02:57:25 -0700 (Tue, 11 Sep 2018) | 18 lines [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/branches/release_70@346739 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 1 year, 11 months ago
2 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
11381138 "sltu\t$rs, $rt, $imm">, GPR_64;
11391139 def : MipsInstAlias<"sltu\t$rs, $imm", (SLTUImm64 GPR64Opnd:$rs, GPR64Opnd:$rs,
11401140 imm64:$imm)>, GPR_64;
1141
1142 def : MipsInstAlias<"rdhwr $rt, $rs",
1143 (RDHWR64 GPR64Opnd:$rt, HWRegsOpnd:$rs, 0), 1>, GPR_64;
4747 ; STATIC32-LABEL: f1:
4848 ; STATIC32: lui $[[R0:[0-9]+]], %tprel_hi(t1)
4949 ; STATIC32: addiu $[[R1:[0-9]+]], $[[R0]], %tprel_lo(t1)
50 ; STATIC32: rdhwr $3, $29
50 ; STATIC32: rdhwr $3, $29{{$}}
5151 ; STATIC32: addu $[[R2:[0-9]+]], $3, $[[R1]]
5252 ; STATIC32: lw $2, 0($[[R2]])
5353
5454 ; STATIC64-LABEL: f1:
5555 ; STATIC64: lui $[[R0:[0-9]+]], %tprel_hi(t1)
5656 ; STATIC64: daddiu $[[R1:[0-9]+]], $[[R0]], %tprel_lo(t1)
57 ; STATIC64: rdhwr $3, $29, 0
57 ; STATIC64: rdhwr $3, $29{{$}}
5858 ; STATIC64: daddu $[[R2:[0-9]+]], $3, $[[R0]]
5959 ; STATIC64: lw $2, 0($[[R2]])
6060 }
100100 ; STATIC32-LABEL: f2:
101101 ; STATIC32: lui $[[R0:[0-9]+]], %hi(__gnu_local_gp)
102102 ; STATIC32: addiu $[[GP:[0-9]+]], $[[R0]], %lo(__gnu_local_gp)
103 ; STATIC32: rdhwr $3, $29
103 ; STATIC32: rdhwr $3, $29{{$}}
104104 ; STATIC32: lw $[[R0:[0-9]+]], %gottprel(t2)($[[GP]])
105105 ; STATIC32: addu $[[R1:[0-9]+]], $3, $[[R0]]
106106 ; STATIC32: lw $2, 0($[[R1]])
108108 ; STATIC64-LABEL: f2:
109109 ; STATIC64: lui $[[R0:[0-9]+]], %hi(%neg(%gp_rel(f2)))
110110 ; STATIC64: daddiu $[[GP:[0-9]+]], $[[R0]], %lo(%neg(%gp_rel(f2)))
111 ; STATIC64: rdhwr $3, $29
111 ; STATIC64: rdhwr $3, $29{{$}}
112112 ; STATIC64: ld $[[R0:[0-9]+]], %gottprel(t2)($[[GP]])
113113 ; STATIC64: daddu $[[R1:[0-9]+]], $3, $[[R0]]
114114 ; STATIC64: lw $2, 0($[[R1]])