<html>
    <head>
      <base href="https://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 --- - [mc] New syntax for ds_swizzle_b32 offset"
   href="https://llvm.org/bugs/show_bug.cgi?id=28601">28601</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[mc] New syntax for ds_swizzle_b32 offset
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: AMDGPU
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>i.am.perminov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Swizzle pattern for ds_swizzle_b32 instruction is encoded in the offset field
of the instruction. It would be nice to have more friendly syntax then just hex
code. So new function swizzle() that construct a value is proposed.

syntax for quad permute mode:

swizzle(SWZL_QUAD_PERM, laneid0, laneid1, laneid2, laneid3)
where "laneid*" is integer from 0 to 3


syntax for bitmask mode:

swizzle(SWZL_BITMASK, mask)
where "mask" is 5 character sequence with allowed characters:
"0" - set to 0
"1" - set to 1
"p" - preserve
"i" - inverse


additional syntax for common cases of bitmask mode:

swizzle(SWZL_BCAST, gsize, laneid)
where gsize is (1|2|4|8|16|32) and laneid is integer from 0 to (gsize-1)

swizzle(SWZL_SWAP, gsize)
where gsize is (1|2|4|8|16)

swizzle(SWZL_MIRROR, gsize)
where gsize is (2|4|8|16|32)

examples:
swizzle(SWZL_QUAD_PERM, 2, 1, 3, 3) equals 0x80F6
swizzle(SWZL_BITMASK, pppii) equals 0x0C1F
swizzle(SWZL_MIRROR, 4) equals 0x0C1F
swizzle(SWZL_BITMASK, pippp) equals 0x401F
swizzle(SWZL_SWAP, 16) equals 0x401F</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>