[llvm-bugs] [Bug 26235] New: Poor VBROADCASTF128 / VBROADCASTI128 support

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 21 08:09:10 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26235

            Bug ID: 26235
           Summary: Poor VBROADCASTF128 / VBROADCASTI128 support
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: ahmed.bougacha at gmail.com, llvm-bugs at lists.llvm.org,
                    spatel+llvm at rotateright.com
    Classification: Unclassified

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160121/0be30d7d/attachment.html>


More information about the llvm-bugs mailing list