Jon Chesterfield via llvm-dev
2017-Sep-15 12:49 UTC
[llvm-dev] What should a truncating store do?
For example, truncating store of an i32 to i6. My assumption was that this should write the low six bits of the i32 to somewhere in memory. Should the top 24 bits of a corresponding 32 bit region of memory be unchanged, zero, undefined? Should the two bits that would round the i6 up to a byte be preserved, zero, undefined? I can't write six bits directly so am trying to determine what set of bitwise ops to apply between a load and subsequent store to emulate the truncating store. Thanks! Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170915/5b458bec/attachment.html>
Friedman, Eli via llvm-dev
2017-Sep-15 17:55 UTC
[llvm-dev] What should a truncating store do?
On 9/15/2017 5:49 AM, Jon Chesterfield via llvm-dev wrote:> For example, truncating store of an i32 to i6. My assumption was that > this should write the low six bits of the i32 to somewhere in memory. > > Should the top 24 bits of a corresponding 32 bit region of memory be > unchanged, zero, undefined?Unchanged.> Should the two bits that would round the i6 up to a byte be preserved, > zero, undefined?Zero. Legalization will normally handle this for you, though, by transforming it to an i8 store. -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Tom Stellard via llvm-dev
2018-May-09 16:54 UTC
[llvm-dev] What should a truncating store do?
On 09/15/2017 10:55 AM, Friedman, Eli via llvm-dev wrote:> On 9/15/2017 5:49 AM, Jon Chesterfield via llvm-dev wrote: >> For example, truncating store of an i32 to i6. My assumption was that this should write the low six bits of the i32 to somewhere in memory. >> >> Should the top 24 bits of a corresponding 32 bit region of memory be unchanged, zero, undefined? > > Unchanged. > >> Should the two bits that would round the i6 up to a byte be preserved, zero, undefined? > > Zero. Legalization will normally handle this for you, though, by transforming it to an i8 store. >Why is this Zero? The language ref says the value of those bits are unspecified. -Tom> -Eli >