• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Check the vecpopcnt* instructions that were added in P8
2; In addition, check the conversions to/from the v2i64 VMX register that was also added in P8.
3; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
4; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < %s | FileCheck %s
5
6declare <16 x i8> @llvm.ctpop.v16i8(<16 x i8>) nounwind readnone
7declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>) nounwind readnone
8declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>) nounwind readnone
9declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) nounwind readnone
10
11define <16 x i8> @test_v16i8_v2i64(<2 x i64> %x) nounwind readnone {
12       %tmp  = bitcast <2 x i64> %x to <16 x i8>;
13       %vcnt = tail call <16 x i8> @llvm.ctpop.v16i8(<16 x i8> %tmp)
14       ret <16 x i8> %vcnt
15; CHECK: @test_v16i8_v2i64
16; CHECK: vpopcntb 2, 2
17; CHECK: blr
18}
19
20define <8 x i16> @test_v8i16_v2i64(<2 x i64> %x) nounwind readnone {
21       %tmp = bitcast <2 x i64> %x to <8 x i16>
22       %vcnt = tail call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %tmp)
23       ret <8 x i16> %vcnt
24; CHECK: @test_v8i16_v2i64
25; CHECK: vpopcnth 2, 2
26; CHECK: blr
27}
28
29define <4 x i32> @test_v4i32_v2i64(<2 x i64> %x) nounwind readnone {
30       %tmp = bitcast <2 x i64> %x to <4 x i32>
31       %vcnt = tail call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %tmp)
32       ret <4 x i32> %vcnt
33; CHECK: @test_v4i32_v2i64
34; CHECK: vpopcntw 2, 2
35; CHECK: blr
36}
37
38define <2 x i64> @test_v2i64_v2i64(<2 x i64> %x) nounwind readnone {
39       %vcnt = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %x)
40       ret <2 x i64> %vcnt
41; CHECK: @test_v2i64_v2i64
42; CHECK: vpopcntd 2, 2
43; CHECK: blr
44}
45
46define <2 x i64> @test_v2i64_v4i32(<4 x i32> %x) nounwind readnone {
47       %tmp = bitcast <4 x i32> %x to <2 x i64>
48       %vcnt = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %tmp)
49       ret <2 x i64> %vcnt
50; CHECK: @test_v2i64_v4i32
51; CHECK: vpopcntd 2, 2
52; CHECK: blr
53}
54
55
56define <2 x i64> @test_v2i64_v8i16(<8 x i16> %x) nounwind readnone {
57       %tmp = bitcast <8 x i16> %x to <2 x i64>
58       %vcnt = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %tmp)
59       ret <2 x i64> %vcnt
60; CHECK: @test_v2i64_v8i16
61; CHECK: vpopcntd 2, 2
62; CHECK: blr
63}
64
65define <2 x i64> @test_v2i64_v16i8(<16 x i8> %x) nounwind readnone {
66       %tmp = bitcast <16 x i8> %x to <2 x i64>
67       %vcnt = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %tmp)
68       ret <2 x i64> %vcnt
69; CHECK: @test_v2i64_v16i8
70; CHECK: vpopcntd 2, 2
71; CHECK: blr
72}
73