1; RUN: llc -mattr=+avx < %s | FileCheck %s
2
3; Check that we properly upgrade the AVX vbroadcast intrinsics to IR.  The
4; expectation is that we should still get the original instruction back that
5; maps to the intrinsic.
6
7target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-apple-macosx10.9.0"
9
10; CHECK-LABEL: test_mm_broadcast_ss:
11define <4 x float> @test_mm_broadcast_ss(float* readonly %__a){
12entry:
13  %0 = bitcast float* %__a to i8*
14; CHECK: vbroadcastss (%{{.*}}), %xmm
15  %1 = tail call <4 x float> @llvm.x86.avx.vbroadcast.ss(i8* %0)
16  ret <4 x float> %1
17}
18
19; CHECK-LABEL: test_mm256_broadcast_sd:
20define <4 x double> @test_mm256_broadcast_sd(double* readonly %__a) {
21entry:
22  %0 = bitcast double* %__a to i8*
23; CHECK: vbroadcastsd (%{{.*}}), %ymm
24  %1 = tail call <4 x double> @llvm.x86.avx.vbroadcast.sd.256(i8* %0)
25  ret <4 x double> %1
26}
27
28; CHECK-LABEL: test_mm256_broadcast_ss:
29define <8 x float> @test_mm256_broadcast_ss(float* readonly %__a) {
30entry:
31  %0 = bitcast float* %__a to i8*
32; CHECK: vbroadcastss (%{{.*}}), %ymm
33  %1 = tail call <8 x float> @llvm.x86.avx.vbroadcast.ss.256(i8* %0)
34  ret <8 x float> %1
35}
36
37declare <8 x float> @llvm.x86.avx.vbroadcast.ss.256(i8*)
38
39declare <4 x double> @llvm.x86.avx.vbroadcast.sd.256(i8*)
40
41declare <4 x float> @llvm.x86.avx.vbroadcast.ss(i8*)
42