kewuzhang
2015-Mar-27 14:22 UTC
[LLVMdev] Does llvm intrinsic function allow "complicated" arguments?
Hi Guys, I see an intrinsic function call like this "call float @ir.sample_complex.f32(float a, int bitcast (i16 337203 to i32) , i32 1, <2 x float> %62, float %61) “, Then I got trouble to process the third operand "int bitcast (i16 337203 to i32)”, the second operand I got is “constant 337203”. I think something is messed up, but the getOperand(i) is llvm core function. So I suspect the above intrinsic call is legal or not? any suggestions? best kevin
kewuzhang
2015-Mar-27 14:24 UTC
[LLVMdev] Does llvm intrinsic function allow "complicated" arguments?---- correction for my previous msg
On Mar 27, 2015, at 10:22 AM, kewuzhang <kewu.zhang at amd.com> wrote:> Hi Guys, > > I see an intrinsic function call like this "call float @ir.sample_complex.f32(float a, int bitcast (i16 337203 to i32) , i32 1, <2 x float> %62, float %61) “, > Then I got trouble to process the third operand "int bitcast (i16 337203 to i32)”, the third operand I got is “constant 337203”. > > I think something is messed up, but the getOperand(i) is llvm core function. So I suspect the above intrinsic call is legal or not? > > any suggestions? > > best > kevin-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150327/4f9e6bb9/attachment.html>
Tim Northover
2015-Mar-27 14:48 UTC
[LLVMdev] Does llvm intrinsic function allow "complicated" arguments?
On 27 March 2015 at 07:22, kewuzhang <kewu.zhang at amd.com> wrote:> int bitcast (i16 337203 to i32)> I think something is messed up, but the getOperand(i) is llvm core function. So I suspect the above intrinsic call is legal or not?Bitcast only works between types of the same size. You shouldn't even have been able to create that expression. It's strongly recommended that you use a build of LLVM with assertions enabled for development, are you doing that? Either way, for i16 -> i32, your options are "zext" or "sext". Cheers. Tim.
kewuzhang
2015-Mar-27 15:15 UTC
[LLVMdev] Does llvm intrinsic function allow "complicated" arguments?
Thank you Tom, Sorry for the errors, obviously I made that example wrong. Here is the one with little bit name changes:> call float @ir.sample_image(%struct.image_t addrspace(1)* %tex_unit0, %struct.sampler_t addrspace(2)* inttoptr (i64 -9223372036854542193 to %struct.sampler_t addrspace(2)*), i32 1, <2 x float> %62, float %61)"%struct.sampler_t addrspace(2)* inttoptr (i64 -9223372036854542193 to %struct.sampler_t addrspace(2)*)” is the part give me problem, I got “constant “ for getOperand(3) call. best kevin> On 27 March 2015 at 07:22, kewuzhang <kewu.zhang at amd.com> wrote: >> int bitcast (i16 337203 to i32) > >> I think something is messed up, but the getOperand(i) is llvm core function. So I suspect the above intrinsic call is legal or not? > > Bitcast only works between types of the same size. You shouldn't even > have been able to create that expression. It's strongly recommended > that you use a build of LLVM with assertions enabled for development, > are you doing that? > > Either way, for i16 -> i32, your options are "zext" or "sext". > > Cheers. > > Tim.