1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s --check-prefixes=ALL,VSX
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx < %s | FileCheck %s --check-prefixes=ALL,NOVSX
5 ; Check VMX 128-bit integer operations
7 define <1 x i128> @out_of_bounds_insertelement(<1 x i128> %x, i128 %val) nounwind {
8 ; ALL-LABEL: out_of_bounds_insertelement:
11 %tmpvec = insertelement <1 x i128> <i128 0>, i128 %val, i32 1
12 %result = add <1 x i128> %x, %tmpvec
13 ret <1 x i128> %result
16 define <1 x i128> @test_add(<1 x i128> %x, <1 x i128> %y) nounwind {
17 ; ALL-LABEL: test_add:
19 ; ALL-NEXT: vadduqm 2, 2, 3
21 %result = add <1 x i128> %x, %y
22 ret <1 x i128> %result
25 define <1 x i128> @increment_by_one(<1 x i128> %x) nounwind {
26 ; VSX-LABEL: increment_by_one:
28 ; VSX-NEXT: addis 3, 2, .LCPI2_0@toc@ha
29 ; VSX-NEXT: addi 3, 3, .LCPI2_0@toc@l
30 ; VSX-NEXT: lxvd2x 35, 0, 3
31 ; VSX-NEXT: vadduqm 2, 2, 3
34 ; NOVSX-LABEL: increment_by_one:
36 ; NOVSX-NEXT: addis 3, 2, .LCPI2_0@toc@ha
37 ; NOVSX-NEXT: addi 3, 3, .LCPI2_0@toc@l
38 ; NOVSX-NEXT: lvx 3, 0, 3
39 ; NOVSX-NEXT: vadduqm 2, 2, 3
41 %result = add <1 x i128> %x, <i128 1>
42 ret <1 x i128> %result
45 define <1 x i128> @increment_by_val(<1 x i128> %x, i128 %val) nounwind {
46 ; VSX-LABEL: increment_by_val:
48 ; VSX-NEXT: mtfprd 0, 6
49 ; VSX-NEXT: mtfprd 1, 5
50 ; VSX-NEXT: xxmrghd 35, 1, 0
51 ; VSX-NEXT: vadduqm 2, 2, 3
54 ; NOVSX-LABEL: increment_by_val:
56 ; NOVSX-NEXT: addi 3, 1, -16
57 ; NOVSX-NEXT: std 6, -8(1)
58 ; NOVSX-NEXT: std 5, -16(1)
59 ; NOVSX-NEXT: lvx 3, 0, 3
60 ; NOVSX-NEXT: vadduqm 2, 2, 3
62 %tmpvec = insertelement <1 x i128> <i128 0>, i128 %val, i32 0
63 %result = add <1 x i128> %x, %tmpvec
64 ret <1 x i128> %result
67 define <1 x i128> @test_sub(<1 x i128> %x, <1 x i128> %y) nounwind {
68 ; ALL-LABEL: test_sub:
70 ; ALL-NEXT: vsubuqm 2, 2, 3
72 %result = sub <1 x i128> %x, %y
73 ret <1 x i128> %result
76 define <1 x i128> @decrement_by_one(<1 x i128> %x) nounwind {
77 ; VSX-LABEL: decrement_by_one:
79 ; VSX-NEXT: addis 3, 2, .LCPI5_0@toc@ha
80 ; VSX-NEXT: addi 3, 3, .LCPI5_0@toc@l
81 ; VSX-NEXT: lxvd2x 35, 0, 3
82 ; VSX-NEXT: vsubuqm 2, 2, 3
85 ; NOVSX-LABEL: decrement_by_one:
87 ; NOVSX-NEXT: addis 3, 2, .LCPI5_0@toc@ha
88 ; NOVSX-NEXT: addi 3, 3, .LCPI5_0@toc@l
89 ; NOVSX-NEXT: lvx 3, 0, 3
90 ; NOVSX-NEXT: vsubuqm 2, 2, 3
92 %result = sub <1 x i128> %x, <i128 1>
93 ret <1 x i128> %result
96 define <1 x i128> @decrement_by_val(<1 x i128> %x, i128 %val) nounwind {
97 ; VSX-LABEL: decrement_by_val:
99 ; VSX-NEXT: mtfprd 0, 6
100 ; VSX-NEXT: mtfprd 1, 5
101 ; VSX-NEXT: xxmrghd 35, 1, 0
102 ; VSX-NEXT: vsubuqm 2, 2, 3
105 ; NOVSX-LABEL: decrement_by_val:
107 ; NOVSX-NEXT: addi 3, 1, -16
108 ; NOVSX-NEXT: std 6, -8(1)
109 ; NOVSX-NEXT: std 5, -16(1)
110 ; NOVSX-NEXT: lvx 3, 0, 3
111 ; NOVSX-NEXT: vsubuqm 2, 2, 3
113 %tmpvec = insertelement <1 x i128> <i128 0>, i128 %val, i32 0
114 %result = sub <1 x i128> %x, %tmpvec
115 ret <1 x i128> %result
118 declare <1 x i128> @llvm.ppc.altivec.vaddeuqm(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind readnone
119 declare <1 x i128> @llvm.ppc.altivec.vaddcuq(<1 x i128> %x, <1 x i128> %y) nounwind readnone
120 declare <1 x i128> @llvm.ppc.altivec.vaddecuq(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind readnone
121 declare <1 x i128> @llvm.ppc.altivec.vsubeuqm(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind readnone
122 declare <1 x i128> @llvm.ppc.altivec.vsubcuq(<1 x i128> %x, <1 x i128> %y) nounwind readnone
123 declare <1 x i128> @llvm.ppc.altivec.vsubecuq(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind readnone
125 define <1 x i128> @test_vaddeuqm(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind {
126 ; ALL-LABEL: test_vaddeuqm:
128 ; ALL-NEXT: vaddeuqm 2, 2, 3, 4
130 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vaddeuqm(<1 x i128> %x,
136 define <1 x i128> @test_vaddcuq(<1 x i128> %x, <1 x i128> %y) nounwind {
137 ; ALL-LABEL: test_vaddcuq:
139 ; ALL-NEXT: vaddcuq 2, 2, 3
141 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vaddcuq(<1 x i128> %x,
146 define <1 x i128> @test_vaddecuq(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind {
147 ; ALL-LABEL: test_vaddecuq:
149 ; ALL-NEXT: vaddecuq 2, 2, 3, 4
151 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vaddecuq(<1 x i128> %x,
157 define <1 x i128> @test_vsubeuqm(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind {
158 ; ALL-LABEL: test_vsubeuqm:
160 ; ALL-NEXT: vsubeuqm 2, 2, 3, 4
162 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vsubeuqm(<1 x i128> %x,
168 define <1 x i128> @test_vsubcuq(<1 x i128> %x, <1 x i128> %y) nounwind {
169 ; ALL-LABEL: test_vsubcuq:
171 ; ALL-NEXT: vsubcuq 2, 2, 3
173 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vsubcuq(<1 x i128> %x,
178 define <1 x i128> @test_vsubecuq(<1 x i128> %x, <1 x i128> %y, <1 x i128> %z) nounwind {
179 ; ALL-LABEL: test_vsubecuq:
181 ; ALL-NEXT: vsubecuq 2, 2, 3, 4
183 %tmp = tail call <1 x i128> @llvm.ppc.altivec.vsubecuq(<1 x i128> %x,