Duncan Sands
2008-May-15 19:14 UTC
[LLVMdev] Troubling promotion of return value to Integer ...
Hi Evan,> If you are using a non-C ABI, then you may not need to do the > promotion at all. However, if you do need to do the promotion, you > need to know the type of "int".how does this work for parameters. Suppose I have an i1 parameter. The AMD64 ABI says it is passed in one of %rsi, %rdx, %rcx, %r8 and %r9 registers. In the case of _Bool (i1) it says that the upper 63 bits will be zero. How does this work? I thought i1 would be legalized to i8 (which is legal, right?). Due to being marked zext, the upper 7 bits of the i8 will be zero. But where does it get extended to an i64 with upper 63 bits zero? Thanks, Duncan.
Evan Cheng
2008-May-16 16:50 UTC
[LLVMdev] Troubling promotion of return value to Integer ...
On May 15, 2008, at 12:14 PM, Duncan Sands wrote:> Hi Evan, > >> If you are using a non-C ABI, then you may not need to do the >> promotion at all. However, if you do need to do the promotion, you >> need to know the type of "int". > > how does this work for parameters. Suppose I have an i1 parameter. > The AMD64 ABI says it is passed in one of %rsi, %rdx, %rcx, %r8 and > %r9 registers. In the case of _Bool (i1) it says that the upper 63 > bits will be zero. How does this work? I thought i1 would be > legalized > to i8 (which is legal, right?). Due to being marked zext, the upper > 7 bits of the i8 will be zero. But where does it get extended to > an i64 with upper 63 bits zero?X86ISelLowering will promote the i8 parameters to i32. Evan> > > Thanks, > > Duncan.
Duncan Sands
2008-May-16 22:00 UTC
[LLVMdev] Troubling promotion of return value to Integer ...
> >> If you are using a non-C ABI, then you may not need to do the > >> promotion at all. However, if you do need to do the promotion, you > >> need to know the type of "int". > > > > how does this work for parameters. Suppose I have an i1 parameter. > > The AMD64 ABI says it is passed in one of %rsi, %rdx, %rcx, %r8 and > > %r9 registers. In the case of _Bool (i1) it says that the upper 63 > > bits will be zero. How does this work? I thought i1 would be > > legalized > > to i8 (which is legal, right?). Due to being marked zext, the upper > > 7 bits of the i8 will be zero. But where does it get extended to > > an i64 with upper 63 bits zero? > > X86ISelLowering will promote the i8 parameters to i32.OK, so why doesn't it work the same for return values? Ciao, Duncan.
Reasonably Related Threads
- [LLVMdev] Troubling promotion of return value to Integer ...
- [LLVMdev] Troubling promotion of return value to Integer ...
- [LLVMdev] Troubling promotion of return value to Integer ...
- [LLVMdev] Troubling promotion of return value to Integer ...
- [LLVMdev] Troubling promotion of return value to Integer ...