[PATCH] D35998: [TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true

Alexandru Guduleasa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 07:42:48 PDT 2017


alexandru.guduleasa added a comment.

Unfortunately, the only in-tree target that uses IsOptional attribute is AMDGPU.

As far as I can tell, all these optional operands are placed at the end of the asm string.
e.g.

  class MIMG_NoSampler_Helper <bits<7> op, string asm,
                               RegisterClass dst_rc,
                               RegisterClass addr_rc,
                               string dns=""> : MIMG_Helper <
    (outs dst_rc:$vdata),
    (ins addr_rc:$vaddr, SReg_256:$srsrc,
         dmask:$dmask, unorm:$unorm, GLC:$glc, slc:$slc,
         r128:$r128, tfe:$tfe, lwe:$lwe, da:$da),
    asm#" $vdata, $vaddr, $srsrc$dmask$unorm$glc$slc$r128$tfe$lwe$da",
    dns>, MIMGe<op> {
    let ssamp = 0;
  }

where $dmask $unorm $glc $slc $r128 $tfe $lwe and $da are all optional.

Therefore, I don't think I can add a test for this.


https://reviews.llvm.org/D35998





More information about the llvm-commits mailing list