1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < %s | FileCheck %s
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=+power8-vector -mattr=-vsx < %s | FileCheck %s -check-prefix=P7
4 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s -check-prefix=CHECK-VSX
6 @vsc = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5>, align 16
7 @vsc2 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5>, align 16
8 @vuc = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5>, align 16
9 @vuc2 = global <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 0, i8 1, i8 2, i8 3, i8 4, i8 5>, align 16
10 @res_vll = common global <2 x i64> zeroinitializer, align 16
11 @res_vull = common global <2 x i64> zeroinitializer, align 16
12 @res_vsc = common global <16 x i8> zeroinitializer, align 16
13 @res_vuc = common global <16 x i8> zeroinitializer, align 16
15 ; Function Attrs: nounwind
16 define void @test1() {
18 %0 = load <16 x i8>, ptr @vsc, align 16
19 %1 = load <16 x i8>, ptr @vsc2, align 16
20 %2 = call <2 x i64> @llvm.ppc.altivec.vbpermq(<16 x i8> %0, <16 x i8> %1)
21 store <2 x i64> %2, ptr @res_vll, align 16
24 ; CHECK: lvx [[REG1:[0-9]+]], 0, 3
25 ; CHECK: lvx [[REG2:[0-9]+]], 0, 3
26 ; CHECK: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
27 ; CHECK-VSX: vbpermq {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
28 ; P7: lvx [[REG1:[0-9]+]], 0, 3
29 ; P7: lvx [[REG2:[0-9]+]], 0, 4
30 ; P7: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
33 ; Function Attrs: nounwind
34 define void @test2() {
36 %0 = load <16 x i8>, ptr @vuc, align 16
37 %1 = load <16 x i8>, ptr @vuc2, align 16
38 %2 = call <2 x i64> @llvm.ppc.altivec.vbpermq(<16 x i8> %0, <16 x i8> %1)
39 store <2 x i64> %2, ptr @res_vull, align 16
42 ; CHECK: lvx [[REG1:[0-9]+]], 0, 3
43 ; CHECK: lvx [[REG2:[0-9]+]], 0, 3
44 ; CHECK: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
45 ; CHECK-VSX: vbpermq {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
46 ; P7: lvx [[REG1:[0-9]+]], 0, 3
47 ; P7: lvx [[REG2:[0-9]+]], 0, 4
48 ; P7: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
51 ; Function Attrs: nounwind
52 define void @test3() {
54 %0 = load <16 x i8>, ptr @vsc, align 16
55 %1 = call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %0)
56 store <16 x i8> %1, ptr @res_vsc, align 16
59 ; CHECK: lvx [[REG1:[0-9]+]],
60 ; CHECK: vgbbd {{[0-9]+}}, [[REG1]]
61 ; CHECK-VSX: vgbbd {{[0-9]+}}, {{[0-9]+}}
64 ; Function Attrs: nounwind
65 define void @test4() {
67 %0 = load <16 x i8>, ptr @vuc, align 16
68 %1 = call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %0)
69 store <16 x i8> %1, ptr @res_vuc, align 16
72 ; CHECK: lvx [[REG1:[0-9]+]],
73 ; CHECK: vgbbd {{[0-9]+}}, [[REG1]]
74 ; CHECK-VSX: vgbbd {{[0-9]+}}, {{[0-9]+}}
77 ; Function Attrs: nounwind readnone
78 declare <2 x i64> @llvm.ppc.altivec.vbpermq(<16 x i8>, <16 x i8>)
80 ; Function Attrs: nounwind readnone
81 declare <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8>)