<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 --- - Poor VBROADCASTF128 / VBROADCASTI128 support"
   href="https://llvm.org/bugs/show_bug.cgi?id=26235">26235</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Poor VBROADCASTF128 / VBROADCASTI128 support
          </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>Windows NT
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ahmed.bougacha@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The use of the VBROADCASTF128 128-bit vector broadcast instruction is only
available through the __builtin_ia32_vbroadcastf128_ps256 /
__builtin_ia32_vbroadcastf128_pd256 intrinsics.

The VBROADCASTI128 128-bit vector broadcast instruction appears to be converted
to native IR but I haven't found a case that lowers to it.

This was mentioned in PR23886.

define <8 x i32> @broadcast_4i32(<4 x i32>* %p) {
  %v128 = load <4 x i32>, <4 x i32>* %p, align 16
  %v256 = shufflevector <4 x i32> %v128, <4 x i32> undef, <8 x i32> <i32 0, i32
1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  ret <8 x i32> %v256
}

define <4 x i64> @broadcast_2i64(<2 x i64>* %p) {
  %v128 = load <2 x i64>, <2 x i64>* %p, align 16
  %v256 = shufflevector <2 x i64> %v128, <2 x i64> undef, <4 x i32> <i32 0, i32
1, i32 0, i32 1>
  ret <4 x i64> %v256
}

define <8 x float> @broadcast_4f32(<4 x float>* %p) {
  %v128 = load <4 x float>, <4 x float>* %p, align 16
  %v256 = shufflevector <4 x float> %v128, <4 x float> undef, <8 x i32> <i32 0,
i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3>
  ret <8 x float> %v256
}

define <4 x double> @broadcast_2f64(<2 x double>* %p) {
  %v128 = load <2 x double>, <2 x double>* %p, align 16
  %v256 = shufflevector <2 x double> %v128, <2 x double> undef, <4 x i32> <i32
0, i32 1, i32 0, i32 1>
  ret <4 x double> %v256
}

(llc -mtriple=x86_64-unknown -mattr=+avx2):

broadcast_4i32:                         # @broadcast_4i32
    vmovaps    (%rdi), %xmm0
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq

broadcast_2i64:                         # @broadcast_2i64
    vmovaps    (%rdi), %xmm0
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq

broadcast_4f32:                         # @broadcast_4f32
    vmovaps    (%rdi), %xmm0
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq
broadcast_2f64:                         # @broadcast_2f64
    vmovaps    (%rdi), %xmm0
    vinsertf128    $1, %xmm0, %ymm0, %ymm0
    retq</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>