<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 5/9/2018 9:54 AM, Tom Stellard
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:9ef21ddb-1cd4-381b-1b2a-de889c22e3f7@redhat.com">
      <pre wrap="">On 09/15/2017 10:55 AM, Friedman, Eli via llvm-dev wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 9/15/2017 5:49 AM, Jon Chesterfield via llvm-dev wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">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?
</pre>
        </blockquote>
        <pre wrap="">
Unchanged.

</pre>
        <blockquote type="cite">
          <pre wrap="">Should the two bits that would round the i6 up to a byte be preserved, zero, undefined?
</pre>
        </blockquote>
        <pre wrap="">
Zero.  Legalization will normally handle this for you, though, by transforming it to an i8 store.

</pre>
      </blockquote>
      <pre wrap="">
Why is this Zero?  The language ref says the value of those bits are
unspecified.
</pre>
    </blockquote>
    <br>
    Zero, because that makes it more convenient to lower the
    corresponding "load" instruction.  Note the corresponding language
    for loads: "<span style="color: rgb(0, 0, 0); font-family:
      "Lucida Grande", "Lucida Sans Unicode",
      Geneva, Verdana, sans-serif; font-size: 14px; font-style: normal;
      font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial; display: inline
      !important; float: none;">When loading a value of a type like<span> </span></span><tt
      class="docutils literal" style="font-family: Consolas, "Deja
      Vu Sans Mono", "Bitstream Vera Sans Mono",
      monospace; font-size: 0.95em; color: rgb(0, 0, 0); font-style:
      normal; font-variant-ligatures: normal; font-variant-caps: normal;
      font-weight: 400; letter-spacing: normal; orphans: 2; text-align:
      left; text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial;"><span class="pre"
        style="hyphens: none;">i20</span></tt><span style="color: rgb(0,
      0, 0); font-family: "Lucida Grande", "Lucida Sans
      Unicode", Geneva, Verdana, sans-serif; font-size: 14px;
      font-style: normal; font-variant-ligatures: normal;
      font-variant-caps: normal; font-weight: 400; letter-spacing:
      normal; orphans: 2; text-align: left; text-indent: 0px;
      text-transform: none; white-space: normal; widows: 2;
      word-spacing: 0px; -webkit-text-stroke-width: 0px;
      background-color: rgb(255, 255, 255); text-decoration-style:
      initial; text-decoration-color: initial; display: inline
      !important; float: none;"><span> </span>with a size that is not an
      integral number of bytes, the result is undefined if the value was
      not originally written using a store of the same type."<br>
      <br>
      Maybe we should fix the bits to zero instead, to match what
      happens in practice.<br>
    </span><br>
    -Eli<br>
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>