Sebastien Le Duc via llvm-dev
2019-Nov-28 16:51 UTC
[llvm-dev] Question on pattern matching extractelt
Hi, I have an issue with pattern matching. I have the following SelectionDAG: t13: i32 = extract_vector_elt t2, Constant:i64<1> That I am trying to match with the following pattern: def : Pat<(extractelt (v4i16 SingleReg:$v), 1), (SRADd1 SingleReg :$v, (i64 16))>; But for some reason the pattern does not match. 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. I tried specifying the result type in the pattern: def : Pat<(i32 (extractelt (v4i16 SingleReg:$v), 1)), (SRADd1 SingleReg :$v, (i64 16))>; But in that case I get a tblgen error: possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records). anonymous_1188: (extractelt:{ *:[] } SingleReg:{ *:[] }:$v, 0:{ *:[i64] }) Is there anyway to match such pattern? Thanks in advacne! regards, Sebastien -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191128/e5352925/attachment.html>
Craig Topper via llvm-dev
2019-Nov-28 17:41 UTC
[llvm-dev] Question on pattern matching extractelt
I think it’s disallowed by the SDTypeProfile in TargetSelectionDAG.td. You can use vector_extract instead of extractelt which is what some other targets like WebAssembly are doing for this issue. It's type profile is more relaxed on this. On Thu, Nov 28, 2019 at 8:51 AM Sebastien Le Duc via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > I have an issue with pattern matching. > > I have the following SelectionDAG: > > t13: i32 = extract_vector_elt t2, Constant:i64<1> > > That I am trying to match with the following pattern: > > def : Pat<(extractelt (v4i16 SingleReg:$v), 1), (SRADd1 SingleReg :$v, (i64 16))>; > > > But for some reason the pattern does not match. > 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. > > I tried specifying the result type in the pattern: > > def : Pat<(i32 (extractelt (v4i16 SingleReg:$v), 1)), (SRADd1 SingleReg :$v, (i64 16))>; > > > But in that case I get a tblgen error: > > possible type contradiction in the pattern below (use -print-records with > llvm-tblgen to see all expanded records). > anonymous_1188: (extractelt:{ *:[] } SingleReg:{ *:[] }:$v, 0:{ *:[i64] }) > > Is there anyway to match such pattern? > > Thanks in advacne! > regards, > Sebastien > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191128/3ec115ad/attachment.html>
Sebastien Le Duc via llvm-dev
2019-Dec-02 14:35 UTC
[llvm-dev] Question on pattern matching extractelt
It works, thanks a lot! Vector_extract / vector_insert have a comment that says they are deprecated. I think this should be updated to say that they can be used when the result’s type is larger than the element type. From: Craig Topper [mailto:craig.topper at gmail.com] Sent: Thursday, November 28, 2019 6:42 PM To: Sebastien Le Duc Cc: llvm-dev Subject: Re: [llvm-dev] Question on pattern matching extractelt I think it’s disallowed by the SDTypeProfile in TargetSelectionDAG.td. You can use vector_extract instead of extractelt which is what some other targets like WebAssembly are doing for this issue. It's type profile is more relaxed on this. On Thu, Nov 28, 2019 at 8:51 AM Sebastien Le Duc via llvm-dev <llvm-dev at lists.llvm.org> wrote: Hi, I have an issue with pattern matching. I have the following SelectionDAG: t13: i32 = extract_vector_elt t2, Constant:i64<1> That I am trying to match with the following pattern: def : Pat<(extractelt (v4i16 SingleReg:$v), 1), (SRADd1 SingleReg :$v, (i64 16))>; But for some reason the pattern does not match. 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. I tried specifying the result type in the pattern: def : Pat<(i32 (extractelt (v4i16 SingleReg:$v), 1)), (SRADd1 SingleReg :$v, (i64 16))>; But in that case I get a tblgen error: possible type contradiction in the pattern below (use -print-records with llvm-tblgen to see all expanded records). anonymous_1188: (extractelt:{ *:[] } SingleReg:{ *:[] }:$v, 0:{ *:[i64] }) Is there anyway to match such pattern? Thanks in advacne! regards, Sebastien _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191202/20f23d91/attachment.html>
Possibly Parallel Threads
- extract_vector_elt type mismatch?
- [LLVMdev] Types inference in tblgen: Multiple exceptions
- llvm-dev Digest, Vol 166, Issue 22
- [RFC][SDAG] Convert build_vector of ops on extractelts into ops on input vectors
- [RFC][SDAG] Convert build_vector of ops on extractelts into ops on input vectors