1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-gnu-linux -mcpu=pwr9 < %s | FileCheck %s -check-prefix=CHECK-LE
3 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-gnu-linux -mcpu=pwr9 < %s | FileCheck %s -check-prefix=CHECK-BE
5 define zeroext i8 @test1(<16 x i8> %a, i32 signext %index) {
6 ; CHECK-LE-LABEL: test1:
7 ; CHECK-LE: # %bb.0: # %entry
8 ; CHECK-LE-NEXT: vextubrx 3, 5, 2
9 ; CHECK-LE-NEXT: clrldi 3, 3, 56
12 ; CHECK-BE-LABEL: test1:
13 ; CHECK-BE: # %bb.0: # %entry
14 ; CHECK-BE-NEXT: vextublx 3, 5, 2
15 ; CHECK-BE-NEXT: clrldi 3, 3, 56
19 %vecext = extractelement <16 x i8> %a, i32 %index
23 define signext i8 @test2(<16 x i8> %a, i32 signext %index) {
24 ; CHECK-LE-LABEL: test2:
25 ; CHECK-LE: # %bb.0: # %entry
26 ; CHECK-LE-NEXT: vextubrx 3, 5, 2
27 ; CHECK-LE-NEXT: extsb 3, 3
30 ; CHECK-BE-LABEL: test2:
31 ; CHECK-BE: # %bb.0: # %entry
32 ; CHECK-BE-NEXT: vextublx 3, 5, 2
33 ; CHECK-BE-NEXT: extsb 3, 3
37 %vecext = extractelement <16 x i8> %a, i32 %index
41 define zeroext i16 @test3(<8 x i16> %a, i32 signext %index) {
42 ; CHECK-LE-LABEL: test3:
43 ; CHECK-LE: # %bb.0: # %entry
44 ; CHECK-LE-NEXT: rlwinm 3, 5, 1, 28, 30
45 ; CHECK-LE-NEXT: vextuhrx 3, 3, 2
46 ; CHECK-LE-NEXT: clrldi 3, 3, 48
49 ; CHECK-BE-LABEL: test3:
50 ; CHECK-BE: # %bb.0: # %entry
51 ; CHECK-BE-NEXT: rlwinm 3, 5, 1, 28, 30
52 ; CHECK-BE-NEXT: vextuhlx 3, 3, 2
53 ; CHECK-BE-NEXT: clrldi 3, 3, 48
57 %vecext = extractelement <8 x i16> %a, i32 %index
61 define signext i16 @test4(<8 x i16> %a, i32 signext %index) {
62 ; CHECK-LE-LABEL: test4:
63 ; CHECK-LE: # %bb.0: # %entry
64 ; CHECK-LE-NEXT: rlwinm 3, 5, 1, 28, 30
65 ; CHECK-LE-NEXT: vextuhrx 3, 3, 2
66 ; CHECK-LE-NEXT: extsh 3, 3
69 ; CHECK-BE-LABEL: test4:
70 ; CHECK-BE: # %bb.0: # %entry
71 ; CHECK-BE-NEXT: rlwinm 3, 5, 1, 28, 30
72 ; CHECK-BE-NEXT: vextuhlx 3, 3, 2
73 ; CHECK-BE-NEXT: extsh 3, 3
77 %vecext = extractelement <8 x i16> %a, i32 %index
81 define zeroext i32 @test5(<4 x i32> %a, i32 signext %index) {
82 ; CHECK-LE-LABEL: test5:
83 ; CHECK-LE: # %bb.0: # %entry
84 ; CHECK-LE-NEXT: rlwinm 3, 5, 2, 28, 29
85 ; CHECK-LE-NEXT: vextuwrx 3, 3, 2
88 ; CHECK-BE-LABEL: test5:
89 ; CHECK-BE: # %bb.0: # %entry
90 ; CHECK-BE-NEXT: rlwinm 3, 5, 2, 28, 29
91 ; CHECK-BE-NEXT: vextuwlx 3, 3, 2
95 %vecext = extractelement <4 x i32> %a, i32 %index
99 define signext i32 @test6(<4 x i32> %a, i32 signext %index) {
100 ; CHECK-LE-LABEL: test6:
101 ; CHECK-LE: # %bb.0: # %entry
102 ; CHECK-LE-NEXT: rlwinm 3, 5, 2, 28, 29
103 ; CHECK-LE-NEXT: vextuwrx 3, 3, 2
104 ; CHECK-LE-NEXT: extsw 3, 3
107 ; CHECK-BE-LABEL: test6:
108 ; CHECK-BE: # %bb.0: # %entry
109 ; CHECK-BE-NEXT: rlwinm 3, 5, 2, 28, 29
110 ; CHECK-BE-NEXT: vextuwlx 3, 3, 2
111 ; CHECK-BE-NEXT: extsw 3, 3
115 %vecext = extractelement <4 x i32> %a, i32 %index
119 ; Test with immediate index
120 define zeroext i8 @test7(<16 x i8> %a) {
121 ; CHECK-LE-LABEL: test7:
122 ; CHECK-LE: # %bb.0: # %entry
123 ; CHECK-LE-NEXT: li 3, 1
124 ; CHECK-LE-NEXT: vextubrx 3, 3, 2
125 ; CHECK-LE-NEXT: clrldi 3, 3, 56
128 ; CHECK-BE-LABEL: test7:
129 ; CHECK-BE: # %bb.0: # %entry
130 ; CHECK-BE-NEXT: li 3, 1
131 ; CHECK-BE-NEXT: vextublx 3, 3, 2
132 ; CHECK-BE-NEXT: clrldi 3, 3, 56
136 %vecext = extractelement <16 x i8> %a, i32 1
140 define zeroext i16 @test8(<8 x i16> %a) {
141 ; CHECK-LE-LABEL: test8:
142 ; CHECK-LE: # %bb.0: # %entry
143 ; CHECK-LE-NEXT: li 3, 2
144 ; CHECK-LE-NEXT: vextuhrx 3, 3, 2
145 ; CHECK-LE-NEXT: clrldi 3, 3, 48
148 ; CHECK-BE-LABEL: test8:
149 ; CHECK-BE: # %bb.0: # %entry
150 ; CHECK-BE-NEXT: li 3, 2
151 ; CHECK-BE-NEXT: vextuhlx 3, 3, 2
152 ; CHECK-BE-NEXT: clrldi 3, 3, 48
156 %vecext = extractelement <8 x i16> %a, i32 1
160 define zeroext i32 @test9(<4 x i32> %a) {
161 ; CHECK-LE-LABEL: test9:
162 ; CHECK-LE: # %bb.0: # %entry
163 ; CHECK-LE-NEXT: li 3, 12
164 ; CHECK-LE-NEXT: vextuwrx 3, 3, 2
167 ; CHECK-BE-LABEL: test9:
168 ; CHECK-BE: # %bb.0: # %entry
169 ; CHECK-BE-NEXT: li 3, 12
170 ; CHECK-BE-NEXT: vextuwlx 3, 3, 2
174 %vecext = extractelement <4 x i32> %a, i32 3
178 define double @test10(<4 x i32> %a, <4 x i32> %b) {
179 ; CHECK-LE-LABEL: test10:
180 ; CHECK-LE: # %bb.0: # %entry
181 ; CHECK-LE-NEXT: addis 3, 2, .LCPI9_0@toc@ha
182 ; CHECK-LE-NEXT: addi 3, 3, .LCPI9_0@toc@l
183 ; CHECK-LE-NEXT: lxv 36, 0(3)
184 ; CHECK-LE-NEXT: addis 3, 2, .LCPI9_1@toc@ha
185 ; CHECK-LE-NEXT: lfs 0, .LCPI9_1@toc@l(3)
186 ; CHECK-LE-NEXT: vperm 2, 3, 2, 4
187 ; CHECK-LE-NEXT: xsadddp 1, 34, 0
190 ; CHECK-BE-LABEL: test10:
191 ; CHECK-BE: # %bb.0: # %entry
192 ; CHECK-BE-NEXT: addis 3, 2, .LCPI9_0@toc@ha
193 ; CHECK-BE-NEXT: vmrghw 3, 3, 2
194 ; CHECK-BE-NEXT: lfs 0, .LCPI9_0@toc@l(3)
195 ; CHECK-BE-NEXT: vmrglw 2, 3, 2
196 ; CHECK-BE-NEXT: xsadddp 1, 34, 0
199 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 2, i32 3, i32 7>
200 %cast = bitcast <4 x i32> %shuffle to <2 x double>
201 %extract = extractelement <2 x double> %cast, i32 0
202 %add = fadd double %extract, 1.0000