1 ; RUN: llc -march=hexagon < %s | FileCheck %s
2 ; Check that extract-element is handled.
5 ; CHECK: r[[R000:[0-9]+]] = and(r0,#3)
6 ; CHECK: r[[R001:[0-9]+]] = vextract(v0,r0)
7 ; CHECK-DAG: r[[R002:[0-9]+]] = asl(r[[R000]],#3)
8 ; CHECK-DAG: r[[R003:[0-9]+]] = #8
9 ; CHECK: r0 = extractu(r[[R001]],r[[R003]]:[[R002]])
10 define i8 @ext_00(<64 x i8> %a0, i32 %a1) #0 {
12 %v3 = extractelement <64 x i8> %a0, i32 %a1
16 ; CHECK-LABEL: ext_10:
17 ; CHECK: r[[R100:[0-9]+]] = and(r0,#3)
18 ; CHECK: r[[R101:[0-9]+]] = vextract(v0,r0)
19 ; CHECK-DAG: r[[R102:[0-9]+]] = asl(r[[R100]],#3)
20 ; CHECK-DAG: r[[R103:[0-9]+]] = #8
21 ; CHECK: r0 = extractu(r[[R101]],r[[R103]]:[[R102]])
22 define i8 @ext_10(<128 x i8> %a0, i32 %a1) #1 {
24 %v3 = extractelement <128 x i8> %a0, i32 %a1
28 ; CHECK-LABEL: ext_01:
29 ; CHECK-DAG: r[[R010:[0-9]+]] = asl(r0,#1)
30 ; CHECK-DAG: r[[R011:[0-9]+]] = and(r0,#1)
31 ; CHECK-DAG: r[[R012:[0-9]+]] = #16
32 ; CHECK: r[[R013:[0-9]+]] = asl(r[[R011]],#4)
33 ; CHECK: r[[R014:[0-9]+]] = vextract(v0,r[[R010]])
34 ; CHECK: r0 = extractu(r[[R014]],r[[R012]]:[[R013]])
35 define i16 @ext_01(<32 x i16> %a0, i32 %a1) #0 {
37 %v3 = extractelement <32 x i16> %a0, i32 %a1
41 ; CHECK-LABEL: ext_11:
42 ; CHECK-DAG: r[[R110:[0-9]+]] = asl(r0,#1)
43 ; CHECK-DAG: r[[R111:[0-9]+]] = and(r0,#1)
44 ; CHECK-DAG: r[[R112:[0-9]+]] = #16
45 ; CHECK: r[[R113:[0-9]+]] = asl(r[[R111]],#4)
46 ; CHECK: r[[R114:[0-9]+]] = vextract(v0,r[[R110]])
47 ; CHECK: r0 = extractu(r[[R114]],r[[R112]]:[[R113]])
48 define i16 @ext_11(<64 x i16> %a0, i32 %a1) #1 {
50 %v3 = extractelement <64 x i16> %a0, i32 %a1
54 ; CHECK-LABEL: ext_02:
55 ; CHECK: [[R020:r[0-9]+]] = asl(r0,#2)
56 ; CHECK: r0 = vextract(v0,[[R020]])
57 define i32 @ext_02(<16 x i32> %a0, i32 %a1) #0 {
59 %v3 = extractelement <16 x i32> %a0, i32 %a1
63 ; CHECK-LABEL: ext_12:
64 ; CHECK: [[R120:r[0-9]+]] = asl(r0,#2)
65 ; CHECK: r0 = vextract(v0,[[R120]])
66 define i32 @ext_12(<32 x i32> %a0, i32 %a1) #1 {
68 %v3 = extractelement <32 x i32> %a0, i32 %a1
72 attributes #0 = { nounwind readnone "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" }
73 attributes #1 = { nounwind readnone "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length128b" }