Hi, All, I want to lower 64 Bits constant such as 'long' and 'double'. So I define them like this: def CONSTI64 : InstFOO<(outs GRWideRegs:$dst), (ins i64imm:$src), "const-long $dst, $src", [(set (i64 GRWideRegs:$dst), imm:$src)]>{ let isMoveImm = 1; } def CONSTF64 : InstFOO<(outs GRWideRegs:$dst), (ins f64imm:$src), "const-double $dst, $src", [(set (f64 GRWideRegs:$dst), fpimm:$src)]>{ let isMoveImm = 1; } GRWideRegs can be f64 and i64. However, the 'const-long' works while the 'const-double' doesn't work. From the -debug log, it seems "f64 ConstantFP" is replaced by "f64,ch = load" and this is where the error happens. Can anyone tell me why this happens and how to make this work? Any suggestion is appreciated. Regards, Xiangyang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/a35b8b98/attachment.html>
On 2 December 2015 at 10:30, Xiangyang Guo via llvm-dev <llvm-dev at lists.llvm.org> wrote:> GRWideRegs can be f64 and i64. However, the 'const-long' works while the > 'const-double' doesn't work. From the -debug log, it seems "f64 > ConstantFP" is replaced by "f64,ch = load" and this is where the error > happens. Can anyone tell me why this happens and how to make this work?It's probably being lowered to a litpool load by default. You need to call "setOperationAction(ISD::ConstantFP, MVT::f64, Legal)" in ISelLowering.cpp. Cheers. Tim.
On 12/2/2015 12:30 PM, Xiangyang Guo via llvm-dev wrote:> > GRWideRegs can be f64 and i64. However, the 'const-long' works while the > 'const-double' doesn't work. From the -debug log, it seems "f64 > ConstantFP" is replaced by "f64,ch = load" and this is where the error > happens. Can anyone tell me why this happens and how to make this work? > > Any suggestion is appreciated.Is f64 a valid type for GRWideRegs? -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Thanks, Tim. "setOperationAction(ISD::ConstantFP, MVT::f64, Legal)" and some modification of "LowerOperand" and "printOperand" make this lowering "double" works. Regards, Xiangyang 2015-12-02 13:36 GMT-05:00 Tim Northover <t.p.northover at gmail.com>:> On 2 December 2015 at 10:30, Xiangyang Guo via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > GRWideRegs can be f64 and i64. However, the 'const-long' works while the > > 'const-double' doesn't work. From the -debug log, it seems "f64 > > ConstantFP" is replaced by "f64,ch = load" and this is where the error > > happens. Can anyone tell me why this happens and how to make this work? > > It's probably being lowered to a litpool load by default. You need to > call "setOperationAction(ISD::ConstantFP, MVT::f64, Legal)" in > ISelLowering.cpp. > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/8af14179/attachment.html>
Thanks for your reply. Yes, f64 is valid type. "setOperationAction(ISD::ConstantFP, MVT::f64, Legal)" does the trick. Regards, Xiangyang 2015-12-02 13:36 GMT-05:00 Krzysztof Parzyszek via llvm-dev < llvm-dev at lists.llvm.org>:> On 12/2/2015 12:30 PM, Xiangyang Guo via llvm-dev wrote: > >> >> GRWideRegs can be f64 and i64. However, the 'const-long' works while the >> 'const-double' doesn't work. From the -debug log, it seems "f64 >> ConstantFP" is replaced by "f64,ch = load" and this is where the error >> happens. Can anyone tell me why this happens and how to make this work? >> >> Any suggestion is appreciated. >> > > Is f64 a valid type for GRWideRegs? > > -Krzysztof > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted > by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151202/ab8bc62d/attachment.html>
Possibly Parallel Threads
- need help for customized backend LowerFormalArguments
- TableGen customized node with mayStore attribute is deleted if there is no use
- [Job Ad] Compiler Engineer positions at Intel
- [LLVMdev] convert LLVM IR to another IR without SSA
- loop unrolling introduces conditional branch