blob: f3b0e8d93d41191bf807c9ee6b5495dbf561d832 [file] [log] [blame]
Ehsan Amiria538b0f2016-08-03 18:17:35 +00001; 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
4; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s -check-prefix=CHECK-VSX
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +00005
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
Geoff Berryc932f532016-06-02 18:02:50 +00007@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
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +00008@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
Geoff Berryc932f532016-06-02 18:02:50 +00009@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
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000010@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
14
15; Function Attrs: nounwind
16define void @test1() {
17entry:
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000018 %0 = load <16 x i8>, <16 x i8>* @vsc, align 16
Geoff Berryc932f532016-06-02 18:02:50 +000019 %1 = load <16 x i8>, <16 x i8>* @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, <2 x i64>* @res_vll, align 16
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000022 ret void
23; CHECK-LABEL: @test1
Geoff Berryc932f532016-06-02 18:02:50 +000024; CHECK: lvx [[REG1:[0-9]+]], 0, 3
25; CHECK: lvx [[REG2:[0-9]+]], 0, 4
26; CHECK: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000027; CHECK-VSX: vbpermq {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
28}
29
30; Function Attrs: nounwind
31define void @test2() {
32entry:
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000033 %0 = load <16 x i8>, <16 x i8>* @vuc, align 16
Geoff Berryc932f532016-06-02 18:02:50 +000034 %1 = load <16 x i8>, <16 x i8>* @vuc2, align 16
35 %2 = call <2 x i64> @llvm.ppc.altivec.vbpermq(<16 x i8> %0, <16 x i8> %1)
36 store <2 x i64> %2, <2 x i64>* @res_vull, align 16
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000037 ret void
38; CHECK-LABEL: @test2
Geoff Berryc932f532016-06-02 18:02:50 +000039; CHECK: lvx [[REG1:[0-9]+]], 0, 3
40; CHECK: lvx [[REG2:[0-9]+]], 0, 4
41; CHECK: vbpermq {{[0-9]+}}, [[REG1]], [[REG2]]
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000042; CHECK-VSX: vbpermq {{[0-9]+}}, {{[0-9]+}}, {{[0-9]+}}
43}
44
45; Function Attrs: nounwind
46define void @test3() {
47entry:
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000048 %0 = load <16 x i8>, <16 x i8>* @vsc, align 16
Geoff Berryc932f532016-06-02 18:02:50 +000049 %1 = call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %0)
50 store <16 x i8> %1, <16 x i8>* @res_vsc, align 16
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000051 ret void
52; CHECK-LABEL: @test3
53; CHECK: lvx [[REG1:[0-9]+]],
54; CHECK: vgbbd {{[0-9]+}}, [[REG1]]
55; CHECK-VSX: vgbbd {{[0-9]+}}, {{[0-9]+}}
56}
57
58; Function Attrs: nounwind
59define void @test4() {
60entry:
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000061 %0 = load <16 x i8>, <16 x i8>* @vuc, align 16
Geoff Berryc932f532016-06-02 18:02:50 +000062 %1 = call <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8> %0)
63 store <16 x i8> %1, <16 x i8>* @res_vuc, align 16
Nemanja Ivanovicea1db8a2015-06-11 06:21:25 +000064 ret void
65; CHECK-LABEL: @test4
66; CHECK: lvx [[REG1:[0-9]+]],
67; CHECK: vgbbd {{[0-9]+}}, [[REG1]]
68; CHECK-VSX: vgbbd {{[0-9]+}}, {{[0-9]+}}
69}
70
71; Function Attrs: nounwind readnone
72declare <2 x i64> @llvm.ppc.altivec.vbpermq(<16 x i8>, <16 x i8>)
73
74; Function Attrs: nounwind readnone
75declare <16 x i8> @llvm.ppc.altivec.vgbbd(<16 x i8>)