[llvm] r354809 - AMDGPU: Correct definitions for bitset instructions
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 25 11:24:46 PST 2019
Author: arsenm
Date: Mon Feb 25 11:24:46 2019
New Revision: 354809
URL: http://llvm.org/viewvc/llvm-project?rev=354809&view=rev
Log:
AMDGPU: Correct definitions for bitset instructions
These really read and write the result register, so these need a tied
input.
Modified:
llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp
llvm/trunk/lib/Target/AMDGPU/SOPInstructions.td
Modified: llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp?rev=354809&r1=354808&r2=354809&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIShrinkInstructions.cpp Mon Feb 25 11:24:46 2019
@@ -276,7 +276,9 @@ static bool shrinkScalarLogicOp(const GC
if (Opc == AMDGPU::S_BITSET0_B32 ||
Opc == AMDGPU::S_BITSET1_B32) {
Src0->ChangeToImmediate(NewImm);
- MI.RemoveOperand(2);
+ // Remove the immediate and add the tied input.
+ MI.getOperand(2).ChangeToRegister(Dest->getReg(), false);
+ MI.tieOperands(0, 2);
} else {
SrcImm->setImm(NewImm);
}
Modified: llvm/trunk/lib/Target/AMDGPU/SOPInstructions.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SOPInstructions.td?rev=354809&r1=354808&r2=354809&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SOPInstructions.td (original)
+++ llvm/trunk/lib/Target/AMDGPU/SOPInstructions.td Mon Feb 25 11:24:46 2019
@@ -76,10 +76,13 @@ class SOP1_Real<bits<8> op, SOP1_Pseudo
let Inst{31-23} = 0x17d; //encoding;
}
-class SOP1_32 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
- opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0),
- "$sdst, $src0", pattern
->;
+class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
+ opName, (outs SReg_32:$sdst),
+ !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in),
+ (ins SSrc_b32:$src0)),
+ "$sdst, $src0", pattern> {
+ let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
+}
// 32-bit input, no output.
class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo <
@@ -106,10 +109,13 @@ class SOP1_32_64 <string opName, list<da
>;
// 32-bit input, 64-bit output.
-class SOP1_64_32 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
- opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0),
- "$sdst, $src0", pattern
->;
+class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo <
+ opName, (outs SReg_64:$sdst),
+ !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in),
+ (ins SSrc_b32:$src0)),
+ "$sdst, $src0", pattern> {
+ let Constraints = !if(tied_in, "$sdst = $sdst_in", "");
+}
// no input, 64-bit output.
class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo <
@@ -189,10 +195,10 @@ def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i3
[(set i32:$sdst, (sext_inreg i32:$src0, i16))]
>;
-def S_BITSET0_B32 : SOP1_32 <"s_bitset0_b32">;
-def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64">;
-def S_BITSET1_B32 : SOP1_32 <"s_bitset1_b32">;
-def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64">;
+def S_BITSET0_B32 : SOP1_32 <"s_bitset0_b32", [], 1>;
+def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>;
+def S_BITSET1_B32 : SOP1_32 <"s_bitset1_b32", [], 1>;
+def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>;
def S_GETPC_B64 : SOP1_64_0 <"s_getpc_b64",
[(set i64:$sdst, (int_amdgcn_s_getpc))]
>;
More information about the llvm-commits
mailing list