<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Team,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have the following question relate to how to associate multiple SchedWriteRes with the same schedule model to a particular instruction.  </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
For AArch64 target, at <a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L262" title="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L262">
line</a> <a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L262" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td%23L262&source=gmail&ust=1629999018423000&usg=AFQjCNGHZHLTGk4b6A9KxiDB9w0RGpUr_w"></a>,
 we have 
<div><br>
</div>
<div>
<table style="border-collapse:collapse;border-spacing:0px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">
<tbody style="box-sizing:border-box">
<tr style="box-sizing:border-box">
<td style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top">
<font face="times new roman, serif"><span style="font-family: Consolas, Courier, monospace;">def KryoWrite_3cyc_XY_noRSV_163ln :</span><br>
<span style="font-family: Consolas, Courier, monospace;">SchedWriteRes<[KryoUnitXY]> {
</span><br>
<span style="font-family: Consolas, Courier, monospace;">let <b>Latency = 3</b>; let NumMicroOps = 2;}</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">def : InstRW<[KryoWrite_3cyc_XY_</span><wbr><span style="font-family: Consolas, Courier, monospace;">noRSV_163ln],
</span><br>
<span style="font-family: Consolas, Courier, monospace;">(instregex "(S|U)QXTU?N(v16i8|v8i16|</span><wbr><span style="font-family: Consolas, Courier, monospace;">v4i32|v8i8|v4i16|v2i32)")>;</span></font><br>
</td>
</tr>
</tbody>
</table>
<br>
</div>
<div>Similarly, at <a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L2366" title="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L2366">
line</a><a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L2366" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td%23L2366&source=gmail&ust=1629999018423000&usg=AFQjCNEOMvacbUqYb4KPA8p3yGb9CFfUzg"></a>,</div>
<div><br>
</div>
<div><span style="font-family: Consolas, Courier, monospace;">def KryoWrite_1cyc_XY_noRSV_215ln :</span><br>
<span style="font-family: Consolas, Courier, monospace;">SchedWriteRes<[KryoUnitXY]> {</span><br>
<span style="font-family: Consolas, Courier, monospace;">let <b>Latency = 1</b>; let NumMicroOps = 2;</span><br>
<span style="font-family: Consolas, Courier, monospace;">}</span><br>
<span style="font-family: Consolas, Courier, monospace;">def : InstRW<[KryoWrite_1cyc_XY_</span><wbr><span style="font-family: Consolas, Courier, monospace;">noRSV_215ln],</span><br>
<span style="font-family: Consolas, Courier, monospace;">(instregex "XTNv.*")>;</span><br>
</div>
<div><br>
</div>
<div>Both the InstRW records can match instruction SQXTNv16i8 and both have SchedModel == KryoModel (because of
<a href="https://github.com/llvm/llvm-project/blob/2c062f2e89a9d48dde61dff835602bc3c5b5b0be/llvm/lib/Target/AArch64/AArch64SchedKryo.td#L59" title="https://github.com/llvm/llvm-project/blob/2c062f2e89a9d48dde61dff835602bc3c5b5b0be/llvm/lib/Target/AArch64/AArch64SchedKryo.td#L59">
this</a>). </div>
<div>However, the corresponding SchedWriteRes'es have different latencies. I am not sure which one of the two SchedWriteRes are going to be applied for the matched instruction.</div>
<div><br>
</div>
<div><br>
</div>
<div>Another similar situation: There are other cases like in lines <a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L1853" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td%23L1853&source=gmail&ust=1629999018423000&usg=AFQjCNHyr7Qb-T3efdTTCRgeaarWuanZMw">here</a> and
<a href="https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td#L1849" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://github.com/llvm/llvm-project/blob/11b7ee974a69cabb379b12ce62a808594a53ef95/llvm/lib/Target/AArch64/AArch64SchedKryoDetails.td%23L1849&source=gmail&ust=1629999018423000&usg=AFQjCNF7c0uJDGS3dNy02nMVWFyeEznjuQ">
here</a></div>
<div><br>
</div>
<div><font face="times new roman, serif"><span style="font-family: Consolas, Courier, monospace;">def KryoWrite_1cyc_LS_Y_XY_305ln :</span><br>
<span style="font-family: Consolas, Courier, monospace;">SchedWriteRes<[<b>KryoUnitLS, KryoUnitY, KryoUnitXY</b>]> {</span><br>
<span style="font-family: Consolas, Courier, monospace;">let Latency = 1; let NumMicroOps = 3;</span><br>
<span style="font-family: Consolas, Courier, monospace;">}</span><br>
<span style="font-family: Consolas, Courier, monospace;">def : InstRW<[WriteAdr, KryoWrite_1cyc_LS_Y_XY_305ln],</span><br>
<span style="font-family: Consolas, Courier, monospace;">(instregex "ST1(One(v16b|v8h|v4s|v2d)|</span><wbr><span style="font-family: Consolas, Courier, monospace;">Two(v8b|v4h|v2s|v1d))_POST$")></span><wbr><span style="font-family: Consolas, Courier, monospace;">;</span></font><br>
</div>
<div><font face="times new roman, serif"><br>
</font></div>
<div><font face="times new roman, serif"><br>
</font></div>
<div><font face="times new roman, serif"><span style="font-family: Consolas, Courier, monospace;">def KryoWrite_1cyc_LS_Y_X_301ln :</span><br>
<span style="font-family: Consolas, Courier, monospace;">SchedWriteRes<[<b>KryoUnitLS, KryoUnitY, KryoUnitX</b>]> {</span><br>
<span style="font-family: Consolas, Courier, monospace;">let Latency = 1; let NumMicroOps = 3;</span><br>
<span style="font-family: Consolas, Courier, monospace;">}</span><br>
<span style="font-family: Consolas, Courier, monospace;">def : InstRW<[WriteAdr, KryoWrite_1cyc_LS_Y_X_301ln],</span><br>
<span style="font-family: Consolas, Courier, monospace;">(instregex "ST1(One(v8b|v4h|v2s|v1d|v16b|</span><wbr><span style="font-family: Consolas, Courier, monospace;">v8h|v4s|v2d)|(i8|i16|i32|i64)|</span><wbr><span style="font-family: Consolas, Courier, monospace;">Two(v8b|v4h|v2s|v1d))_POST$")></span><wbr><span style="font-family: Consolas, Courier, monospace;">;</span><br>
</font></div>
<div><font face="times new roman, serif"><br>
</font></div>
Both match ST1Twov2s_POST <span style="background-color:rgb(255, 255, 255);display:inline !important">
both have SchedModel == KryoModel</span>, but the corresponding SchedSriteRes have different proc resources. Again, not sure which one to consider for the matched instruction.  <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Sandeep Dasgupta</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
</div>
</div>
</body>
</html>