Skip to content

tablegen intrinsic forcing wrong register type on final parameter #4366

@llvmbot

Description

@llvmbot
Bugzilla Link 3994
Resolution FIXED
Resolved on Apr 16, 2009 16:52
Version 2.5
OS Windows NT
Attachments td test case that shows this problem
Reporter LLVM Bugzilla Contributor

Extended Description

This is the "Tablegen question" thread.
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions