1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s
2 ; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck %s -check-prefix=CHECK-LE
4 ; The build[csilf] functions simply test the scalar_to_vector handling with
5 ; direct moves. This corresponds to the "insertelement" instruction. Subsequent
6 ; to this, there will be a splat corresponding to the shufflevector.
8 ; Function Attrs: nounwind
9 define <16 x i8> @buildc(i8 zeroext %a) {
11 %a.addr = alloca i8, align 1
12 store i8 %a, i8* %a.addr, align 1
13 %0 = load i8, i8* %a.addr, align 1
14 %splat.splatinsert = insertelement <16 x i8> undef, i8 %0, i32 0
15 %splat.splat = shufflevector <16 x i8> %splat.splatinsert, <16 x i8> undef, <16 x i32> zeroinitializer
16 ret <16 x i8> %splat.splat
17 ; CHECK: sldi [[REG1:[0-9]+]], 3, 56
18 ; CHECK: mtvsrd {{[0-9]+}}, [[REG1]]
19 ; CHECK-LE: mtvsrd [[REG1:[0-9]+]], 3
20 ; CHECK-LE: xxswapd {{[0-9]+}}, [[REG1]]
23 ; Function Attrs: nounwind
24 define <8 x i16> @builds(i16 zeroext %a) {
26 %a.addr = alloca i16, align 2
27 store i16 %a, i16* %a.addr, align 2
28 %0 = load i16, i16* %a.addr, align 2
29 %splat.splatinsert = insertelement <8 x i16> undef, i16 %0, i32 0
30 %splat.splat = shufflevector <8 x i16> %splat.splatinsert, <8 x i16> undef, <8 x i32> zeroinitializer
31 ret <8 x i16> %splat.splat
32 ; CHECK: sldi [[REG1:[0-9]+]], 3, 48
33 ; CHECK: mtvsrd {{[0-9]+}}, [[REG1]]
34 ; CHECK-LE: mtvsrd [[REG1:[0-9]+]], 3
35 ; CHECK-LE: xxswapd {{[0-9]+}}, [[REG1]]
38 ; Function Attrs: nounwind
39 define <4 x i32> @buildi(i32 zeroext %a) {
41 %a.addr = alloca i32, align 4
42 store i32 %a, i32* %a.addr, align 4
43 %0 = load i32, i32* %a.addr, align 4
44 %splat.splatinsert = insertelement <4 x i32> undef, i32 %0, i32 0
45 %splat.splat = shufflevector <4 x i32> %splat.splatinsert, <4 x i32> undef, <4 x i32> zeroinitializer
46 ret <4 x i32> %splat.splat
47 ; CHECK: sldi [[REG1:[0-9]+]], 3, 32
48 ; CHECK: mtvsrd {{[0-9]+}}, [[REG1]]
49 ; CHECK-LE: mtvsrd [[REG1:[0-9]+]], 3
50 ; CHECK-LE: xxswapd {{[0-9]+}}, [[REG1]]
53 ; Function Attrs: nounwind
54 define <2 x i64> @buildl(i64 %a) {
56 %a.addr = alloca i64, align 8
57 store i64 %a, i64* %a.addr, align 8
58 %0 = load i64, i64* %a.addr, align 8
59 %splat.splatinsert = insertelement <2 x i64> undef, i64 %0, i32 0
60 %splat.splat = shufflevector <2 x i64> %splat.splatinsert, <2 x i64> undef, <2 x i32> zeroinitializer
61 ret <2 x i64> %splat.splat
62 ; FIXME-CHECK: mtvsrd {{[0-9]+}}, 3
63 ; FIXME-CHECK-LE: mtvsrd [[REG1:[0-9]+]], 3
64 ; FIXME-CHECK-LE: xxswapd {{[0-9]+}}, [[REG1]]
67 ; Function Attrs: nounwind
68 define <4 x float> @buildf(float %a) {
70 %a.addr = alloca float, align 4
71 store float %a, float* %a.addr, align 4
72 %0 = load float, float* %a.addr, align 4
73 %splat.splatinsert = insertelement <4 x float> undef, float %0, i32 0
74 %splat.splat = shufflevector <4 x float> %splat.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
75 ret <4 x float> %splat.splat
76 ; CHECK: xscvdpspn {{[0-9]+}}, 1
77 ; CHECK-LE: xscvdpspn [[REG1:[0-9]+]], 1
78 ; CHECK-LE: xxsldwi {{[0-9]+}}, [[REG1]], [[REG1]], 1