<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - NVPTX fails to generate loads/stores with literal offsets"
   href="http://llvm.org/bugs/show_bug.cgi?id=16333">16333</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>NVPTX fails to generate loads/stores with literal offsets
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fwinter@jlab.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10680" name="attach_10680" title="Repro">attachment 10680</a> <a href="attachment.cgi?id=10680&action=edit" title="Repro">[details]</a></span>
Repro

NVPTX seems to fail to generate loads/stores with literal offsets. Instead it
issues separate offset calculations. I attach a kernel cmplx_mul_ir_builder.ll
for which libnvvm produces the following code:

        shl.b32         %r12, %r4, 2;
        add.s32         %r13, %r3, %r12;
        add.s32         %r14, %r2, %r12;
        ld.global.f32   %f1, [%r14+16384];
        ld.global.f32   %f2, [%r13];
        mul.f32         %f3, %f1, %f2;
        ld.global.f32   %f4, [%r14];
        ld.global.f32   %f5, [%r13+16384];
        fma.rn.f32      %f6, %f4, %f5, %f3;
        mul.f32         %f7, %f1, %f5;
        mul.f32         %f8, %f4, %f2;
        sub.f32         %f9, %f8, %f7;
        add.s32         %r15, %r1, %r12;
        st.global.f32   [%r15], %f9;
        st.global.f32   [%r15+16384], %f6;
        ret;

whereas NVPTX stumbles to

        add.s32         %r6, %r1, 4096;
        mul.wide.s32    %rl4, %r1, 4;
        add.s64         %rl5, %rl2, %rl4;
        ld.f32  %f1, [%rl5];
        mul.wide.s32    %rl6, %r6, 4;
        add.s64         %rl7, %rl2, %rl6;
        ld.f32  %f2, [%rl7];
        add.s64         %rl8, %rl3, %rl4;
        ld.f32  %f3, [%rl8];
        add.s64         %rl9, %rl3, %rl6;
        ld.f32  %f4, [%rl9];
        mul.f32         %f5, %f4, %f1;
        fma.rn.f32      %f6, %f3, %f2, %f5;
        mul.f32         %f7, %f3, %f1;
        neg.f32         %f8, %f4;
        fma.rn.f32      %f9, %f8, %f2, %f7;
        add.s64         %rl10, %rl1, %rl4;
        st.f32  [%rl10], %f9;
        add.s64         %rl11, %rl1, %rl6;
        st.f32  [%rl11], %f6;
        ret;

I cannot tell if this is due to opt passes included in the closed source
version. However, this code compiles to a higher register usage in the final
code, thus a lower performance.

System: CUDA 5.5 (pre-release), sm_35</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>