[LLVMdev] Tablegen question

Villmow, Micah Micah.Villmow at amd.com
Wed Apr 15 13:01:06 PDT 2009

I've reattached a test td file that shows this issue.

If I change LLVMMatchType<0> to LLVMMatchType<1> I get an assert as mentioned earlier in the thread.


-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Bill Wendling
Sent: Wednesday, April 15, 2009 11:33 AM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Tablegen question

On Wed, Apr 15, 2009 at 11:15 AM, Villmow, Micah <Micah.Villmow at amd.com> wrote:
> I still think there is a bug somewhere, but not sure where yet.
> This is what is generated in intrinsic.gen:
> case Intrinsic::opencl_math_fdistance:          //
> llvm.opencl.math.fdistance
>    ResultTy = Type::FloatTy;
>    ArgTys.push_back(Tys[0]);
>    ArgTys.push_back(Tys[0]);
>    break;
> This is the intrinsic definition:
> def int_opencl_math_fdistance_fast   : Intrinsic<[llvm_float_ty],
>                           [llvm_anyfloat_ty, LLVMMatchType<0>]>;
> The problem comes when I try to use the intrinsic. It gives me the
> following error:
> GPRV2F32:f32:$src1 MACRO_DISTANCE_FAST_v2f32:   (set GPRF32:f32:$dst,
> (intrinsic_w_chain:f32 84:iPTR, GPRV2F32:v2f32:$src0,
> GPRV2F32:f32:$src1))
> TableGen.exe: In MACRO_DISTANCE_FAST_v2f32: Type inference contradiction
> found in node!
> I'm using the following test td file.
> This is generated with putting it in include and running the command
> Tablegen.exe -dag-isel -I. test.td
> The pattern in question is:
> ILFormat<(outs Dst:$dst), (ins Src:$src0, Src:$src1),
>                  ",($dst),($src0, $src1)",
>                  [(set Dst:$dst, (OpNode Src:$src0, Src:$src1))]
> As the intrinsic specifies, the two source register classes should be
> the same, however, Tablegen is somehow interpreting that it should be
> f32 instead of v2f32.
The intrinsic definition says that the second source's type should
match the return value's type, which it is. Can you come up with a
small testcase .td file that shows how LLVMMatchType<1> fails here?


LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.td
Type: application/octet-stream
Size: 3062 bytes
Desc: test.td
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090415/1ae4b737/attachment.obj>

More information about the llvm-dev mailing list