Skip to content

Commit 9b97461

Browse files
committed
Addressing comments
1 parent c66c0a4 commit 9b97461

18 files changed

+287
-245
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4982,10 +4982,6 @@ def msave_restore : Flag<["-"], "msave-restore">, Group<m_riscv_Features_Group>,
49824982
def mno_save_restore : Flag<["-"], "mno-save-restore">, Group<m_riscv_Features_Group>,
49834983
HelpText<"Disable using library calls for save and restore">;
49844984
} // let Flags = [TargetSpecific]
4985-
def mload_store_pairs : Flag<["-"], "mload-store-pairs">, Group<m_riscv_Features_Group>;
4986-
def mno_load_store_pairs : Flag<["-"], "mno-load-store-pairs">, Group<m_riscv_Features_Group>;
4987-
def mccmov : Flag<["-"], "mccmov">, Group<m_riscv_Features_Group>;
4988-
def mno_ccmov : Flag<["-"], "mno-ccmov">, Group<m_riscv_Features_Group>;
49894985
let Flags = [TargetSpecific] in {
49904986
def menable_experimental_extensions : Flag<["-"], "menable-experimental-extensions">, Group<m_Group>,
49914987
HelpText<"Enable use of experimental RISC-V extensions.">;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,21 +2185,6 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args,
21852185
CmdArgs.push_back(A->getValue());
21862186
}
21872187

2188-
if (Arg *A = Args.getLastArg(options::OPT_mload_store_pairs,
2189-
options::OPT_mno_load_store_pairs)) {
2190-
if (A->getOption().matches(options::OPT_mload_store_pairs)) {
2191-
CmdArgs.push_back("-mllvm");
2192-
CmdArgs.push_back("-riscv-load-store-pairs=1");
2193-
}
2194-
}
2195-
2196-
if (Arg *A = Args.getLastArg(options::OPT_mccmov, options::OPT_mno_ccmov)) {
2197-
if (A->getOption().matches(options::OPT_mno_ccmov)) {
2198-
CmdArgs.push_back("-mllvm");
2199-
CmdArgs.push_back("-riscv-ccmov=0");
2200-
}
2201-
}
2202-
22032188
// Handle -mrvv-vector-bits=<bits>
22042189
if (Arg *A = Args.getLastArg(options::OPT_mrvv_vector_bits_EQ)) {
22052190
StringRef Val = A->getValue();

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,11 @@ DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
671671
"SiFive sf.cflush.d.l1 custom opcode table");
672672
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXSfcease, DecoderTableXSfcease32,
673673
"SiFive sf.cease custom opcode table");
674+
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorMIPSLoadStorePairs,
675+
DecoderTableXmipslsp32,
676+
"MIPS mips.lsp custom opcode table");
677+
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorMIPSCMove, DecoderTableXmipscomve32,
678+
"MIPS mips.ccmov custom opcode table");
674679
TRY_TO_DECODE_FEATURE(RISCV::FeatureVendorXCVbitmanip,
675680
DecoderTableXCVbitmanip32,
676681
"CORE-V Bit Manipulation custom opcode table");

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,19 +1431,6 @@ def NoConditionalMoveFusion : Predicate<"!Subtarget->hasConditionalMoveFusion()
14311431
def TuneMIPSP8700
14321432
: SubtargetFeature<"mips-p8700", "RISCVProcFamily", "MIPSP8700",
14331433
"MIPS p8700 processor">;
1434-
def FeatureVendorMIPSCMove : SubtargetFeature<"xmipscmove", "HasVendorMIPSCMove",
1435-
"true", "Using CCMov",
1436-
[Feature64Bit]>;
1437-
def HasVendorMIPSCMove
1438-
: Predicate<"Subtarget->useCCMovInsn()">,
1439-
AssemblerPredicate<(all_of FeatureVendorMIPSCMove), "'ccmov' instruction">;
1440-
def FeatureVendorMIPSLoadStorePairs
1441-
: SubtargetFeature<"xmipslsp", "HasMIPSLSP", "true",
1442-
"Optimize for hardware load-store bonding">;
1443-
def HasVendorMIPSLoadStorePairs
1444-
: Predicate<"Subtarget->useLoadStorePairs()">,
1445-
AssemblerPredicate<(all_of FeatureVendorMIPSLoadStorePairs),
1446-
"load and store pair instructions">;
14471434

14481435
def TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7",
14491436
"SiFive 7-Series processors">;
@@ -1469,3 +1456,18 @@ def FeatureTaggedGlobals : SubtargetFeature<"tagged-globals",
14691456
"AllowTaggedGlobals",
14701457
"true", "Use an instruction sequence for taking the address of a global "
14711458
"that allows a memory tag in the upper address bits">;
1459+
1460+
def FeatureVendorMIPSCMove : SubtargetFeature<"xmipscmove", "HasVendorMIPSCMove",
1461+
"true", "Using CCMov",
1462+
[Feature64Bit]>;
1463+
def HasVendorMIPSCMove
1464+
: Predicate<"Subtarget->useCCMovInsn()">,
1465+
AssemblerPredicate<(all_of FeatureVendorMIPSCMove),
1466+
"'Xmipscmove' ('mips.ccmov' instruction)">;
1467+
def FeatureVendorMIPSLoadStorePairs
1468+
: SubtargetFeature<"xmipslsp", "HasMIPSLSP", "true",
1469+
"Optimize for hardware load-store bonding">;
1470+
def HasVendorMIPSLoadStorePairs
1471+
: Predicate<"Subtarget->useLoadStorePairs()">,
1472+
AssemblerPredicate<(all_of FeatureVendorMIPSLoadStorePairs),
1473+
"'Xmipslsp' (load and store pair instructions)">;

llvm/lib/Target/RISCV/RISCVInstrFormats.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ class LDPFormat<dag outs, dag ins, string opcodestr, string argstr>
532532
let Inst{19-15} = rs1;
533533
let Inst{14-12} = 0b100;
534534
let Inst{11-7} = rd1;
535-
let Inst{6-0} = 0b0001011;
535+
let Inst{6-0} = OPC_CUSTOM_0.Value;
536536
}
537537

538538
// Load word pair format.
@@ -549,7 +549,7 @@ class LWPFormat<dag outs, dag ins, string opcodestr, string argstr>
549549
let Inst{19-15} = rs1;
550550
let Inst{14-12} = 0b100;
551551
let Inst{11-7} = rd1;
552-
let Inst{6-0} = 0b0001011;
552+
let Inst{6-0} = OPC_CUSTOM_0.Value;
553553
}
554554

555555
// Store double pair format.

llvm/lib/Target/RISCV/RISCVInstrInfo.td

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -262,146 +262,6 @@ def simm12 : RISCVSImmLeafOp<12> {
262262
}];
263263
}
264264

265-
// A 7-bit unsigned immediate where the least significant two bits are zero.
266-
def uimm7_lsb00 : RISCVOp,
267-
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 2>(Imm);}]> {
268-
let ParserMatchClass = UImmAsmOperand<7, "Lsb00">;
269-
let EncoderMethod = "getImmOpValue";
270-
let DecoderMethod = "decodeUImmOperand<7>";
271-
let OperandType = "OPERAND_UIMM7_LSB00";
272-
let MCOperandPredicate = [{
273-
int64_t Imm;
274-
if (!MCOp.evaluateAsConstantImm(Imm))
275-
return false;
276-
return isShiftedUInt<5, 2>(Imm);
277-
}];
278-
}
279-
280-
// A 7-bit unsigned immediate where the least significant three bits are zero.
281-
def uimm7_lsb000 : RISCVOp,
282-
ImmLeaf<XLenVT, [{return isShiftedUInt<4, 3>(Imm);}]> {
283-
let ParserMatchClass = UImmAsmOperand<7, "Lsb000">;
284-
let EncoderMethod = "getImmOpValue";
285-
let DecoderMethod = "decodeUImmOperand<7>";
286-
let OperandType = "OPERAND_UIMM7_LSB000";
287-
let MCOperandPredicate = [{
288-
int64_t Imm;
289-
if (!MCOp.evaluateAsConstantImm(Imm))
290-
return false;
291-
return isShiftedUInt<4, 3>(Imm);
292-
}];
293-
}
294-
295-
// A 8-bit unsigned immediate where the least significant two bits are zero.
296-
def uimm8_lsb00 : RISCVOp,
297-
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 2>(Imm);}]> {
298-
let ParserMatchClass = UImmAsmOperand<8, "Lsb00">;
299-
let EncoderMethod = "getImmOpValue";
300-
let DecoderMethod = "decodeUImmOperand<8>";
301-
let OperandType = "OPERAND_UIMM8_LSB00";
302-
let MCOperandPredicate = [{
303-
int64_t Imm;
304-
if (!MCOp.evaluateAsConstantImm(Imm))
305-
return false;
306-
return isShiftedUInt<6, 2>(Imm);
307-
}];
308-
}
309-
310-
// A 8-bit unsigned immediate where the least significant three bits are zero.
311-
def uimm8_lsb000 : RISCVOp,
312-
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 3>(Imm);}]> {
313-
let ParserMatchClass = UImmAsmOperand<8, "Lsb000">;
314-
let EncoderMethod = "getImmOpValue";
315-
let DecoderMethod = "decodeUImmOperand<8>";
316-
let OperandType = "OPERAND_UIMM8_LSB000";
317-
let MCOperandPredicate = [{
318-
int64_t Imm;
319-
if (!MCOp.evaluateAsConstantImm(Imm))
320-
return false;
321-
return isShiftedUInt<5, 3>(Imm);
322-
}];
323-
}
324-
325-
// A 9-bit signed immediate where the least significant bit is zero.
326-
def simm9_lsb0 : Operand<OtherVT>,
327-
ImmLeaf<XLenVT, [{return isShiftedInt<8, 1>(Imm);}]> {
328-
let ParserMatchClass = SImmAsmOperand<9, "Lsb0">;
329-
let PrintMethod = "printBranchOperand";
330-
let EncoderMethod = "getImmOpValueAsr1";
331-
let DecoderMethod = "decodeSImmOperandAndLsl1<9>";
332-
let MCOperandPredicate = [{
333-
int64_t Imm;
334-
if (MCOp.evaluateAsConstantImm(Imm))
335-
return isShiftedInt<8, 1>(Imm);
336-
return MCOp.isBareSymbolRef();
337-
}];
338-
let OperandType = "OPERAND_PCREL";
339-
}
340-
341-
// A 9-bit unsigned immediate where the least significant three bits are zero.
342-
def uimm9_lsb000 : RISCVOp,
343-
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 3>(Imm);}]> {
344-
let ParserMatchClass = UImmAsmOperand<9, "Lsb000">;
345-
let EncoderMethod = "getImmOpValue";
346-
let DecoderMethod = "decodeUImmOperand<9>";
347-
let OperandType = "OPERAND_UIMM9_LSB000";
348-
let MCOperandPredicate = [{
349-
int64_t Imm;
350-
if (!MCOp.evaluateAsConstantImm(Imm))
351-
return false;
352-
return isShiftedUInt<6, 3>(Imm);
353-
}];
354-
}
355-
356-
// A 10-bit unsigned immediate where the least significant two bits are zero
357-
// and the immediate can't be zero.
358-
def uimm10_lsb00nonzero : RISCVOp,
359-
ImmLeaf<XLenVT,
360-
[{return isShiftedUInt<8, 2>(Imm) && (Imm != 0);}]> {
361-
let ParserMatchClass = UImmAsmOperand<10, "Lsb00NonZero">;
362-
let EncoderMethod = "getImmOpValue";
363-
let DecoderMethod = "decodeUImmNonZeroOperand<10>";
364-
let OperandType = "OPERAND_UIMM10_LSB00_NONZERO";
365-
let MCOperandPredicate = [{
366-
int64_t Imm;
367-
if (!MCOp.evaluateAsConstantImm(Imm))
368-
return false;
369-
return isShiftedUInt<8, 2>(Imm) && (Imm != 0);
370-
}];
371-
}
372-
373-
// A 10-bit signed immediate where the least significant four bits are zero.
374-
def simm10_lsb0000nonzero : RISCVOp,
375-
ImmLeaf<XLenVT,
376-
[{return (Imm != 0) && isShiftedInt<6, 4>(Imm);}]> {
377-
let ParserMatchClass = SImmAsmOperand<10, "Lsb0000NonZero">;
378-
let EncoderMethod = "getImmOpValue";
379-
let DecoderMethod = "decodeSImmNonZeroOperand<10>";
380-
let OperandType = "OPERAND_SIMM10_LSB0000_NONZERO";
381-
let MCOperandPredicate = [{
382-
int64_t Imm;
383-
if (!MCOp.evaluateAsConstantImm(Imm))
384-
return false;
385-
return isShiftedInt<6, 4>(Imm) && (Imm != 0);
386-
}];
387-
}
388-
389-
// A 12-bit signed immediate where the least significant bit is zero.
390-
def simm12_lsb0 : Operand<XLenVT>,
391-
ImmLeaf<XLenVT, [{return isShiftedInt<11, 1>(Imm);}]> {
392-
let ParserMatchClass = SImmAsmOperand<12, "Lsb0">;
393-
let PrintMethod = "printBranchOperand";
394-
let EncoderMethod = "getImmOpValueAsr1";
395-
let DecoderMethod = "decodeSImmOperandAndLsl1<12>";
396-
let MCOperandPredicate = [{
397-
int64_t Imm;
398-
if (MCOp.evaluateAsConstantImm(Imm))
399-
return isShiftedInt<11, 1>(Imm);
400-
return MCOp.isBareSymbolRef();
401-
}];
402-
let OperandType = "OPERAND_PCREL";
403-
}
404-
405265
// A 12-bit signed immediate which cannot fit in 6-bit signed immediate,
406266
// but even negative value fit in 12-bit.
407267
def simm12_no6 : ImmLeaf<XLenVT, [{

llvm/lib/Target/RISCV/RISCVInstrInfoC.td

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,146 @@ def c_lui_imm : RISCVOp,
9494
}];
9595
}
9696

97+
// A 7-bit unsigned immediate where the least significant two bits are zero.
98+
def uimm7_lsb00 : RISCVOp,
99+
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 2>(Imm);}]> {
100+
let ParserMatchClass = UImmAsmOperand<7, "Lsb00">;
101+
let EncoderMethod = "getImmOpValue";
102+
let DecoderMethod = "decodeUImmOperand<7>";
103+
let OperandType = "OPERAND_UIMM7_LSB00";
104+
let MCOperandPredicate = [{
105+
int64_t Imm;
106+
if (!MCOp.evaluateAsConstantImm(Imm))
107+
return false;
108+
return isShiftedUInt<5, 2>(Imm);
109+
}];
110+
}
111+
112+
// A 7-bit unsigned immediate where the least significant three bits are zero.
113+
def uimm7_lsb000 : RISCVOp,
114+
ImmLeaf<XLenVT, [{return isShiftedUInt<4, 3>(Imm);}]> {
115+
let ParserMatchClass = UImmAsmOperand<7, "Lsb000">;
116+
let EncoderMethod = "getImmOpValue";
117+
let DecoderMethod = "decodeUImmOperand<7>";
118+
let OperandType = "OPERAND_UIMM7_LSB000";
119+
let MCOperandPredicate = [{
120+
int64_t Imm;
121+
if (!MCOp.evaluateAsConstantImm(Imm))
122+
return false;
123+
return isShiftedUInt<4, 3>(Imm);
124+
}];
125+
}
126+
127+
// A 8-bit unsigned immediate where the least significant two bits are zero.
128+
def uimm8_lsb00 : RISCVOp,
129+
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 2>(Imm);}]> {
130+
let ParserMatchClass = UImmAsmOperand<8, "Lsb00">;
131+
let EncoderMethod = "getImmOpValue";
132+
let DecoderMethod = "decodeUImmOperand<8>";
133+
let OperandType = "OPERAND_UIMM8_LSB00";
134+
let MCOperandPredicate = [{
135+
int64_t Imm;
136+
if (!MCOp.evaluateAsConstantImm(Imm))
137+
return false;
138+
return isShiftedUInt<6, 2>(Imm);
139+
}];
140+
}
141+
142+
// A 8-bit unsigned immediate where the least significant three bits are zero.
143+
def uimm8_lsb000 : RISCVOp,
144+
ImmLeaf<XLenVT, [{return isShiftedUInt<5, 3>(Imm);}]> {
145+
let ParserMatchClass = UImmAsmOperand<8, "Lsb000">;
146+
let EncoderMethod = "getImmOpValue";
147+
let DecoderMethod = "decodeUImmOperand<8>";
148+
let OperandType = "OPERAND_UIMM8_LSB000";
149+
let MCOperandPredicate = [{
150+
int64_t Imm;
151+
if (!MCOp.evaluateAsConstantImm(Imm))
152+
return false;
153+
return isShiftedUInt<5, 3>(Imm);
154+
}];
155+
}
156+
157+
// A 9-bit signed immediate where the least significant bit is zero.
158+
def simm9_lsb0 : Operand<OtherVT>,
159+
ImmLeaf<XLenVT, [{return isShiftedInt<8, 1>(Imm);}]> {
160+
let ParserMatchClass = SImmAsmOperand<9, "Lsb0">;
161+
let PrintMethod = "printBranchOperand";
162+
let EncoderMethod = "getImmOpValueAsr1";
163+
let DecoderMethod = "decodeSImmOperandAndLsl1<9>";
164+
let MCOperandPredicate = [{
165+
int64_t Imm;
166+
if (MCOp.evaluateAsConstantImm(Imm))
167+
return isShiftedInt<8, 1>(Imm);
168+
return MCOp.isBareSymbolRef();
169+
}];
170+
let OperandType = "OPERAND_PCREL";
171+
}
172+
173+
// A 9-bit unsigned immediate where the least significant three bits are zero.
174+
def uimm9_lsb000 : RISCVOp,
175+
ImmLeaf<XLenVT, [{return isShiftedUInt<6, 3>(Imm);}]> {
176+
let ParserMatchClass = UImmAsmOperand<9, "Lsb000">;
177+
let EncoderMethod = "getImmOpValue";
178+
let DecoderMethod = "decodeUImmOperand<9>";
179+
let OperandType = "OPERAND_UIMM9_LSB000";
180+
let MCOperandPredicate = [{
181+
int64_t Imm;
182+
if (!MCOp.evaluateAsConstantImm(Imm))
183+
return false;
184+
return isShiftedUInt<6, 3>(Imm);
185+
}];
186+
}
187+
188+
// A 10-bit unsigned immediate where the least significant two bits are zero
189+
// and the immediate can't be zero.
190+
def uimm10_lsb00nonzero : RISCVOp,
191+
ImmLeaf<XLenVT,
192+
[{return isShiftedUInt<8, 2>(Imm) && (Imm != 0);}]> {
193+
let ParserMatchClass = UImmAsmOperand<10, "Lsb00NonZero">;
194+
let EncoderMethod = "getImmOpValue";
195+
let DecoderMethod = "decodeUImmNonZeroOperand<10>";
196+
let OperandType = "OPERAND_UIMM10_LSB00_NONZERO";
197+
let MCOperandPredicate = [{
198+
int64_t Imm;
199+
if (!MCOp.evaluateAsConstantImm(Imm))
200+
return false;
201+
return isShiftedUInt<8, 2>(Imm) && (Imm != 0);
202+
}];
203+
}
204+
205+
// A 10-bit signed immediate where the least significant four bits are zero.
206+
def simm10_lsb0000nonzero : RISCVOp,
207+
ImmLeaf<XLenVT,
208+
[{return (Imm != 0) && isShiftedInt<6, 4>(Imm);}]> {
209+
let ParserMatchClass = SImmAsmOperand<10, "Lsb0000NonZero">;
210+
let EncoderMethod = "getImmOpValue";
211+
let DecoderMethod = "decodeSImmNonZeroOperand<10>";
212+
let OperandType = "OPERAND_SIMM10_LSB0000_NONZERO";
213+
let MCOperandPredicate = [{
214+
int64_t Imm;
215+
if (!MCOp.evaluateAsConstantImm(Imm))
216+
return false;
217+
return isShiftedInt<6, 4>(Imm) && (Imm != 0);
218+
}];
219+
}
220+
221+
// A 12-bit signed immediate where the least significant bit is zero.
222+
def simm12_lsb0 : Operand<XLenVT>,
223+
ImmLeaf<XLenVT, [{return isShiftedInt<11, 1>(Imm);}]> {
224+
let ParserMatchClass = SImmAsmOperand<12, "Lsb0">;
225+
let PrintMethod = "printBranchOperand";
226+
let EncoderMethod = "getImmOpValueAsr1";
227+
let DecoderMethod = "decodeSImmOperandAndLsl1<12>";
228+
let MCOperandPredicate = [{
229+
int64_t Imm;
230+
if (MCOp.evaluateAsConstantImm(Imm))
231+
return isShiftedInt<11, 1>(Imm);
232+
return MCOp.isBareSymbolRef();
233+
}];
234+
let OperandType = "OPERAND_PCREL";
235+
}
236+
97237
def InsnCDirectiveOpcode : AsmOperandClass {
98238
let Name = "InsnCDirectiveOpcode";
99239
let ParserMethod = "parseInsnCDirectiveOpcode";

0 commit comments

Comments
 (0)