<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Thank  you very much!<div>don’t know why I just overlooked the llvm_half_ty when I was reading the intrinsics.td</div><div><br></div><div>best</div><div><br></div><div>kevin<br><div><div>On Feb 12, 2015, at 1:31 PM, Ahmed Bougacha <<a href="mailto:ahmed.bougacha@gmail.com">ahmed.bougacha@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Thu, Feb 12, 2015 at 8:48 AM, kewuzhang <<a href="mailto:kewu.zhang@amd.com">kewu.zhang@amd.com</a>> wrote:<br><blockquote type="cite"><br>Hi Guys,<br><br>I am trying to promote half to float for my intrinsic math operations,<br>following class and pattern  are defined.<br><br>"<br>class  S_HF__HF< string asmstr> : Intrinsic<br>       <[llvm_float_ty  ],  [llvm_float_ty  ],<br>[IntrNoMem],<br>!strconcat(asmstr,    "_f16")>;<br><br>def :Pat<( f16 (int_my_math_f16 f16:$src)), (F2Hsr (FEXTsr f16:$src) )>;<br><br><br>“<br>where FEXTsr is implementing the fextend type profile,   F2Hsr is<br>implementing as the  float to half conversion .<br>“int_my_math_f16”  is implementing the “S_HF__HF” profile above.<br>I am just trying to<br>(1) convert the $src from f16 to f32 using FEXTsr.<br>(2) use the F2Hsr to convert the f32 back to f16.<br>for testing.<br>however, I always got the error<br>”<br>Type inference contradiction found, merging 'f32' into 'f16'<br>def :Pat<( f16 (int_my_math_f16 f16:$src)), (F_2_F16sr (FEXTsr f16:$src) )>;<br><br>“<br><br><br>Wondering what is the reason? I noticed that LLVM does not have the<br>intrinsic type “LLVM_f16_ty”, so I always use “LLVM_float_ty” for it as long<br>as it is a float or half.<br></blockquote><br>Hi Kevin,<br><br>In "llvm_float_ty", "float" means f32 (as in the IR language<br>reference, and as defined in include/llvm/IR/Intrinsics.td).  So in<br>your example, TableGen complains because you're feeding an f16 to an<br>intrinsic declared as taking an f32.<br><br>However, there's also "llvm_half_ty" in Intrinsics.td, corresponding<br>to f16; why not use that instead?<br><br>-Ahmed<br><br><blockquote type="cite">best<br><br>Kevin<br><br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span>        <a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></blockquote></div></blockquote></div><br></div></body></html>