[llvm-dev] Intrinsic pattern matching

Tom Stellard via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 1 10:16:08 PST 2018


On 02/01/2018 06:37 AM, Przemek Leśniak via llvm-dev wrote:
> Hello,
> 
> I have a problem with pattern matching on intrinsics.
> I have following code in IntrinsicsX86.td:
> 
> ```
> let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
>   def int_x86_mpx_bndmk:
>         Intrinsic<[llvm_x86bnd_ty], [llvm_ptr_ty, llvm_i64_ty], []>;
> }
> ```
> 
> And following instruction that is generated when @llvm.x86.mpx.bndmk is used in code:
> 
> 
> ```
> let isPseudo = 1 in 
> let usesCustomInserter = 1 in
>   def BNDMK64rm_Int: PseudoI<(outs BNDR:$dst), (ins i64mem:$src, GR64:$shift), 
>   [(set BNDR:$dst, (int_x86_mpx_bndmk addr:$src, i64:$shift))]>;
> ```
> 
> Everything works completely fine, intrinsic gets matched. But if I add "IntrNoMem" attribute to instrinsic like:
> 
> ```
> let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
>   def int_x86_mpx_bndmk:
>         Intrinsic<[llvm_x86bnd_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrNoMem]>;
> }
> ```
> 
> All of sudden pattern doesn't get matched. How should i redefine the pattern so it gets matched with this attribute?
> 

This happens when the machine instruction in the pattern is marked as
either mayLoad, mayStore, or hasSideEffects.  These properties can be
inferred, even if they aren't explicitly specified.  Take a look
at the generated X86InstrInfo.inc file to see what properties are
set for the BNDMK64rm_Int instruction.

-Tom

> 
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> 



More information about the llvm-dev mailing list