<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div data-marker="__QUOTED_TEXT__"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;"><div>Hi,</div><div>I have an issue with pattern matching.</div><div> </div><div>I have the following SelectionDAG:</div><div><pre class="c-mrkdwn__pre" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; box-sizing: inherit; margin: 4px 0px; padding: 8px; text-align: left; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace !important;" data-mce-style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; box-sizing: inherit; margin: 4px 0px; padding: 8px; text-align: left; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace !important;">t13: i32 = extract_vector_elt t2, Constant:i64<1><br><br>That I am trying to match with the following pattern:<br><br></pre></div><pre class="c-mrkdwn__pre" data-stringify-type="pre" style="box-sizing: inherit; margin: 4px 0px; padding: 8px; --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); font-size: 12px; line-height: 1.50001; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace !important; border: 1px solid var(--saf-0); border-radius: 4px; background: rgba(var(--sk_foreground_min,29,28,29),0.04); counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: #1d1c1d; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="box-sizing: inherit; margin: 4px 0px; padding: 8px; --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); font-size: 12px; line-height: 1.50001; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace !important; border: 1px solid var(--saf-0); border-radius: 4px; background: rgba(var(--sk_foreground_min,29,28,29),0.04); counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: #1d1c1d; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">def : Pat<(extractelt (v4i16 SingleReg:$v), 1), (SRADd1 SingleReg :$v, (i64 16))>;</pre></div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;"><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">But for some reason the pattern does not match.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">It seems to be  due to the fact extract_vector_elt's result type is i32 (because i16 is not a legal type on our processor), but according to the comment in ISDOpcodes.h, it is allowed for EXTRACT_VECTOR_ELT to have a result type larger than the element type of the vector, so I would expect to be able to match such pattern.</div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;"><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">I tried specifying the result type in the pattern:</div><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;" data-mce-style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;"><pre class="c-mrkdwn__pre" data-stringify-type="pre" data-mce-style="box-sizing: inherit; margin: 4px 0px; padding: 8px; --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); font-size: 12px; line-height: 1.50001; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace !important; border: 1px solid var(--saf-0); border-radius: 4px; background: rgba(var(--sk_foreground_min,29,28,29),0.04); counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: #1d1c1d; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; box-sizing: inherit; margin: 4px 0px; padding: 8px; --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); font-size: 12px; line-height: 1.50001; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; border: 1px solid var(--saf-0); border-radius: 4px; background: rgba(var(--sk_foreground_min,29,28,29),0.04); counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; color: rgb(29, 28, 29); text-align: left; font-family: Monaco, Menlo, Consolas, "Courier New", monospace !important;">def : Pat<(i32 (extractelt (v4i16 SingleReg:$v), 1)), (SRADd1 SingleReg :$v, (i64 16))>;</pre> <br></div>But in that case I get a tblgen error:</div><div data-marker="__QUOTED_TEXT__"><br data-mce-bogus="1"></div><div data-marker="__QUOTED_TEXT__"><div class="c-message__content c-message__content--feature_sonic_inputs" data-qa="message_content" style="box-sizing: inherit; margin-right: 20px; min-width: 1px; margin-left: 64px; margin-top: -9px; color: #1d1c1d; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="box-sizing: inherit; margin-right: 20px; min-width: 1px; margin-left: 64px; margin-top: -9px; color: #1d1c1d; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><div class="c-message__message_blocks c-message__message_blocks--rich_text" style="box-sizing: inherit; max-width: none; overflow-wrap: break-word;" data-mce-style="box-sizing: inherit; max-width: none; overflow-wrap: break-word;"><div class="p-block_kit_renderer p-block_kit_renderer--absorb_margin" data-qa="block-kit-renderer" style="box-sizing: inherit; margin-top: 0px; width: 1616px;" data-mce-style="box-sizing: inherit; margin-top: 0px; width: 1616px;"><div class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first" style="box-sizing: inherit; display: flex;" data-mce-style="box-sizing: inherit; display: flex;"><div class="p-rich_text_block" dir="auto" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; width: 1616px; white-space: pre-wrap; user-select: text; text-align: left; font-size: 15px; line-height: 1.46668; margin: 8px 0px -4px;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; width: 1616px; white-space: pre-wrap; user-select: text; text-align: left; font-size: 15px; line-height: 1.46668; margin: 8px 0px -4px;"><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;">possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records).<br style="box-sizing: inherit;" data-mce-style="box-sizing: inherit;">anonymous_1188: (extractelt:{ *:[] } SingleReg:{ *:[] }:$v, 0:{ *:[i64] })</div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;"><br data-mce-bogus="1"></div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;">Is there anyway to match such pattern? </div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;"><br data-mce-bogus="1"></div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;">Thanks in advacne!</div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;">regards,</div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0;">Sebastien</div><div class="p-rich_text_section" style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; text-align: left;" data-mce-style="box-sizing: inherit; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; text-align: left;"><br data-mce-bogus="1"></div></div></div></div></div></div><div class="c-message_actions__container c-message__actions" role="group" aria-label="Actions sur les messages" style="box-sizing: inherit; position: absolute; top: -8px; right: 20px; display: block; z-index: 1; background: rgba(var(--sk_primary_background,255,255,255),1); --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); border: 0.0625rem solid var(--saf-0); border-radius: 0.375em; transition: border-color 50ms ease-in 0s, box-shadow; line-height: 1; color: #1d1c1d; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" data-mce-style="box-sizing: inherit; position: absolute; top: -8px; right: 20px; display: block; z-index: 1; background: rgba(var(--sk_primary_background,255,255,255),1); --saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); border: 0.0625rem solid var(--saf-0); border-radius: 0.375em; transition: border-color 50ms ease-in 0s, box-shadow; line-height: 1; color: #1d1c1d; font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"><button class="c-button-unstyled c-message_actions__button" type="button" aria-label="Ajouter une réaction" aria-haspopup="true" data-qa="add_reaction_action" delay="60" aria-describedby="slack-kit-tooltip" style="box-sizing: inherit; padding: 3px 7px; background: none; border-top: none; border-right: 1px solid rgba(var(--sk_foreground_low,29,28,29),0.13); border-bottom: none; border-left: none; cursor: pointer; font: inherit; border-image: initial; color: rgba(var(--sk_foreground_max_solid,97,96,97),1); margin: 0px; overflow: initial; text-align: initial; vertical-align: initial; transition: background 50ms ease-in 0s, border, opacity; border-top-left-radius: 0.375em; border-bottom-left-radius: 0.375em;" data-mce-style="box-sizing: inherit; padding: 3px 7px; background: none; border-top: none; border-right: 1px solid rgba(var(--sk_foreground_low,29,28,29),0.13); border-bottom: none; border-left: none; cursor: pointer; font: inherit; border-image: initial; color: rgba(var(--sk_foreground_max_solid,97,96,97),1); margin: 0px; overflow: initial; text-align: initial; vertical-align: initial; transition: background 50ms ease-in 0s, border, opacity; border-top-left-radius: 0.375em; border-bottom-left-radius: 0.375em;"><i class="c-icon c-icon--small-reaction" type="small-reaction" aria-hidden="true" style="box-sizing: inherit; position: relative; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center;" data-mce-style="box-sizing: inherit; position: relative; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center;"></i></button><br></div></div></div></body></html>