1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-ibm-aix-xcoff -vec-extabi -mcpu=pwr9 < %s | FileCheck %s -check-prefix=CHECK-64
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc-ibm-aix-xcoff -vec-extabi -mcpu=pwr9 < %s | FileCheck %s -check-prefix=CHECK-32
5 define zeroext i8 @test1(<16 x i8> %a, i32 signext %index) {
6 ; CHECK-64-LABEL: test1:
7 ; CHECK-64: # %bb.0: # %entry
8 ; CHECK-64-NEXT: clrldi 3, 3, 32
9 ; CHECK-64-NEXT: vextublx 3, 3, 2
10 ; CHECK-64-NEXT: clrldi 3, 3, 56
13 ; CHECK-32-LABEL: test1:
14 ; CHECK-32: # %bb.0: # %entry
15 ; CHECK-32-NEXT: addi 4, 1, -16
16 ; CHECK-32-NEXT: clrlwi 3, 3, 28
17 ; CHECK-32-NEXT: stxv 34, -16(1)
18 ; CHECK-32-NEXT: lbzx 3, 4, 3
21 %vecext = extractelement <16 x i8> %a, i32 %index
25 define signext i8 @test2(<16 x i8> %a, i32 signext %index) {
26 ; CHECK-64-LABEL: test2:
27 ; CHECK-64: # %bb.0: # %entry
28 ; CHECK-64-NEXT: clrldi 3, 3, 32
29 ; CHECK-64-NEXT: vextublx 3, 3, 2
30 ; CHECK-64-NEXT: extsb 3, 3
33 ; CHECK-32-LABEL: test2:
34 ; CHECK-32: # %bb.0: # %entry
35 ; CHECK-32-NEXT: addi 4, 1, -16
36 ; CHECK-32-NEXT: clrlwi 3, 3, 28
37 ; CHECK-32-NEXT: stxv 34, -16(1)
38 ; CHECK-32-NEXT: lbzx 3, 4, 3
39 ; CHECK-32-NEXT: extsb 3, 3
42 %vecext = extractelement <16 x i8> %a, i32 %index
46 define zeroext i16 @test3(<8 x i16> %a, i32 signext %index) {
47 ; CHECK-64-LABEL: test3:
48 ; CHECK-64: # %bb.0: # %entry
49 ; CHECK-64-NEXT: clrldi 3, 3, 32
50 ; CHECK-64-NEXT: rlwinm 3, 3, 1, 28, 30
51 ; CHECK-64-NEXT: vextuhlx 3, 3, 2
52 ; CHECK-64-NEXT: clrldi 3, 3, 48
55 ; CHECK-32-LABEL: test3:
56 ; CHECK-32: # %bb.0: # %entry
57 ; CHECK-32-NEXT: addi 4, 1, -16
58 ; CHECK-32-NEXT: rlwinm 3, 3, 1, 28, 30
59 ; CHECK-32-NEXT: stxv 34, -16(1)
60 ; CHECK-32-NEXT: lhzx 3, 4, 3
63 %vecext = extractelement <8 x i16> %a, i32 %index
67 define signext i16 @test4(<8 x i16> %a, i32 signext %index) {
68 ; CHECK-64-LABEL: test4:
69 ; CHECK-64: # %bb.0: # %entry
70 ; CHECK-64-NEXT: clrldi 3, 3, 32
71 ; CHECK-64-NEXT: rlwinm 3, 3, 1, 28, 30
72 ; CHECK-64-NEXT: vextuhlx 3, 3, 2
73 ; CHECK-64-NEXT: extsh 3, 3
76 ; CHECK-32-LABEL: test4:
77 ; CHECK-32: # %bb.0: # %entry
78 ; CHECK-32-NEXT: addi 4, 1, -16
79 ; CHECK-32-NEXT: rlwinm 3, 3, 1, 28, 30
80 ; CHECK-32-NEXT: stxv 34, -16(1)
81 ; CHECK-32-NEXT: lhax 3, 4, 3
84 %vecext = extractelement <8 x i16> %a, i32 %index
88 define zeroext i32 @test5(<4 x i32> %a, i32 signext %index) {
89 ; CHECK-64-LABEL: test5:
90 ; CHECK-64: # %bb.0: # %entry
91 ; CHECK-64-NEXT: clrldi 3, 3, 32
92 ; CHECK-64-NEXT: rlwinm 3, 3, 2, 28, 29
93 ; CHECK-64-NEXT: vextuwlx 3, 3, 2
96 ; CHECK-32-LABEL: test5:
97 ; CHECK-32: # %bb.0: # %entry
98 ; CHECK-32-NEXT: addi 4, 1, -16
99 ; CHECK-32-NEXT: rlwinm 3, 3, 2, 28, 29
100 ; CHECK-32-NEXT: stxv 34, -16(1)
101 ; CHECK-32-NEXT: lwzx 3, 4, 3
104 %vecext = extractelement <4 x i32> %a, i32 %index
108 define signext i32 @test6(<4 x i32> %a, i32 signext %index) {
109 ; CHECK-64-LABEL: test6:
110 ; CHECK-64: # %bb.0: # %entry
111 ; CHECK-64-NEXT: clrldi 3, 3, 32
112 ; CHECK-64-NEXT: rlwinm 3, 3, 2, 28, 29
113 ; CHECK-64-NEXT: vextuwlx 3, 3, 2
114 ; CHECK-64-NEXT: extsw 3, 3
117 ; CHECK-32-LABEL: test6:
118 ; CHECK-32: # %bb.0: # %entry
119 ; CHECK-32-NEXT: addi 4, 1, -16
120 ; CHECK-32-NEXT: rlwinm 3, 3, 2, 28, 29
121 ; CHECK-32-NEXT: stxv 34, -16(1)
122 ; CHECK-32-NEXT: lwzx 3, 4, 3
125 %vecext = extractelement <4 x i32> %a, i32 %index
129 ; Test with immediate index
130 define zeroext i8 @test7(<16 x i8> %a) {
131 ; CHECK-64-LABEL: test7:
132 ; CHECK-64: # %bb.0: # %entry
133 ; CHECK-64-NEXT: li 3, 1
134 ; CHECK-64-NEXT: vextublx 3, 3, 2
135 ; CHECK-64-NEXT: clrldi 3, 3, 56
138 ; CHECK-32-LABEL: test7:
139 ; CHECK-32: # %bb.0: # %entry
140 ; CHECK-32-NEXT: stxv 34, -16(1)
141 ; CHECK-32-NEXT: lbz 3, -15(1)
144 %vecext = extractelement <16 x i8> %a, i32 1
148 define zeroext i16 @test8(<8 x i16> %a) {
149 ; CHECK-64-LABEL: test8:
150 ; CHECK-64: # %bb.0: # %entry
151 ; CHECK-64-NEXT: li 3, 2
152 ; CHECK-64-NEXT: vextuhlx 3, 3, 2
153 ; CHECK-64-NEXT: clrldi 3, 3, 48
156 ; CHECK-32-LABEL: test8:
157 ; CHECK-32: # %bb.0: # %entry
158 ; CHECK-32-NEXT: stxv 34, -16(1)
159 ; CHECK-32-NEXT: lhz 3, -14(1)
162 %vecext = extractelement <8 x i16> %a, i32 1
166 define zeroext i32 @test9(<4 x i32> %a) {
167 ; CHECK-64-LABEL: test9:
169 ; CHECK-64-NEXT: li 3, 12
170 ; CHECK-64-NEXT: vextuwlx 3, 3, 2
173 ; CHECK-32-LABEL: test9:
175 ; CHECK-32-NEXT: stxv 34, -16(1)
176 ; CHECK-32-NEXT: lwz 3, -4(1)
178 %vecext = extractelement <4 x i32> %a, i32 3