<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/96490>96490</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
What is `${p}` clober in some instructions definition of ARMv8.1-M instruction tabelgen?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ChoKyuWon
</td>
</tr>
</table>
<pre>
I found that the new ARMv8.1-M ISA instructions table gen generates weird code.
For example, the PACG definitions is like this:
```
let hasSideEffects = 1 in {
class PACBTIAut<dag iops, string asm, bit b>
: V8_1MI<(outs), iops,
AddrModeNone, NoItinerary, asm, "$Ra, $Rn, $Rm", "", []> {
bits<4> Ra;
bits<4> Rn;
bits<4> Rm;
let Inst{31-20} = 0b111110110101;
let Inst{19-16} = Rn;
let Inst{15-12} = Ra;
let Inst{11-5} = 0b1111000;
let Inst{4} = b;
let Inst{3-0} = Rm;
}
}
def t2AUTG : PACBTIAut<(ins pred:$p, GPRnosp:$Ra, GPRnopc:$Rn, GPRnopc:$Rm),
"autg${p}", 0>;
```
And it omits the following emitter:
```C++
uint64_t ARMMCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
...
case ARM::t2AUTG:
case ARM::t2BXAUT: {
// op: Ra
op = getMachineOpValue(MI, MI.getOperand(2), Fixups, STI);
op &= UINT64_C(15);
op <<= 12;
Value |= op;
// op: Rn
op = getMachineOpValue(MI, MI.getOperand(3), Fixups, STI);
op &= UINT64_C(15);
op <<= 16;
Value |= op;
// op: Rm
op = getMachineOpValue(MI, MI.getOperand(4), Fixups, STI);
op &= UINT64_C(15);
Value |= op;
break;
}
```
So my question is: why do we need `${p}` for the first ins argument, and what are the first and second operands of MI?
Can we just remove all of {p} there and sort the operand order as normal instructions?
Here is the reference: https://developer.arm.com/documentation/ddi0553/latest/ and I cannot find any difference between `AUTG` and `MUL` in term of Instruction encoding, and want sure that is intended feature.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVt2O27gOfhrlhkhgy46TXOQi8Ux6jHPSFvPTnrtCtmhHrS15JXmm8_YLypn8dNpdYLuG40gkRfIjKYnCOdVoxDWbb9n8ZiIGfzB2nR_Mf1-Gz0ZPSiNf1gXUZtAS_EF48AcEjc-wuds_LWfxdA_F_QaUdt4OlVdGO_CibBEa1PRDKzw6eEZlJVRG4oxFNyza7IwF_C66vkXG86D24yZ_BxJrpdWoSDlo1TcEf1COJZtxIcui4xumLXo4CHevJN7WNVbeAUtuIAalgS22o1DVCudI__ah2AyeJbkUDSjTO7LtvFW6AeE6mpXKQ8mS23ElAEs28Gn5Jd4XLMkZX5rBO8ZXJHpU8Cp5ejZS2r2R-N7oAO69KbyiSNgXmh4NMc4ZT-_EOE7v9OugC5yjwDgK6WHJ7RkSkKOOJXlK5DvBklfGFV2f6deM7oJBMSy082yxTeIpj9jiJgQxKmN6Inqj-OcL4tU0zl4XXJm7FJpPY34SEr8QiqdzkrkwHUXRz2XTIAijbPkLKNNolApGz3jZ4ubHQfhKrMHzzePDuzHpl-XC-FJpB71FSYXI057S8u7jnTauHyljIgOpr44k_ZbUjbXzpmauHsa5GHzDeMoW2578HOsgoro84bjeCBstQXkwnfIubKfatK15psrGTnmP9u0Wyhnf0huog9I-S7942tr7PDcSb8_rkk2Dfqu0sC_E2RlLUbaMLyujnYd9TnNgPNsXZ3j3nWjbT1h5Y4uub1mS7_Od-j70oZR5FsbXW-hV3f1QemEb9IWuDcnePxSMr4780zaYzWYXa4VD8n50eMzlCfTPBLb_3zw-UK4vttUY_x3jOzCUWqrXC5bpQz016PeiOiiNH_pPoh2Q8WVADvti1qD_0KMVWjK-5MfD4oQVRiTnoiWVPCOtj8X7hyz9QuUWz69kzrbz8N5AzH_gBjeALQKXXP8LSPq3ICV_C-mk9x_gyn4DV_dbuNJ_GdcvPS8tim9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