<div dir="ltr">Hi,<div><br>In AMDGPU backend assembler, we have some instructions with optional operands (IsOptional=1 in AsmOperandClass). For example, all of the following instructions are valid:<br><blockquote style="margin:0 0 0 40px;border:none;padding:0px">v_add_f32 v1, v2, v3<br>v_add_f32 v1, v2, v3 clamp:0<br>v_add_f32 v1, v2, v3 mul:2<br>v_add_f32 v1, v2, v3 clamp:0 mul:2</blockquote><br>If operand is not specified, it is not added to OperandVector during parsing, but we want it to be added to final MCInst (usually with value 0). Currently, we have to create custom converters for instructions and add default values inside them. But having a lot of different instruction formats in AMDGPU backend number of converters began to increase immoderately. Most of these converters are similar and needed only to add default values. We would like to find a way to solve this task without need to add custom converters.<br><br>Perhaps AsmMatcher can handle this and add default values based on some field (DefaultValue=”0”). Or there can be a callback that returns default value (DefaultValueMethod=”getDefaultClampValue”). However, it is unclear if it can really be done in AsmMatcher.<br><br>Do you have any suggestion/comments on how to better solve this? What do other backends do?<br><br><div>Thanks,<div>Sam</div></div></div></div>