[LLVMdev] Tablegen question

Villmow, Micah Micah.Villmow at amd.com
Wed Apr 15 13:11:42 PDT 2009

If I force it to use v2f32 for my register class, it still fails with:
exe -gen
-dag-isel -I../../include/ test.td > output
GPRV2F32:v2f32:$src1 MACRO_DISTANCE_FAST_v2f32:         (set
GPRF32:f32:$dst, (i
ntrinsic_w_chain:f32 84:iPTR, GPRV2F32:v2f32:$src0,
TableGen.exe: In MACRO_DISTANCE_FAST_v2f32: Type inference contradiction
found i
n node!

So I'm not sure that is the problem. Also, my register classes only
accept one register type, so there is no valid way for a GPRV2F32 to
accept a F32 data type.


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

On Apr 15, 2009, at 11:15 AM, Villmow, Micah 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;

OK.  That looks right to me.

> 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!

Your "$src1" is f32 instead of v2f32.  I've run into some problems  
like this before and concluded that TableGen's type inference is  
awesome but still doesn't do everything one might want it to do.  In  
this case, I think you ought to just specify the types explicitly.   
You're specifying the register classes, but a register class can hold  
multiple types.  It looks like your GPRV2F32 register class must also  
allow f32 types -- or else something else weird is happening.

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

More information about the llvm-dev mailing list