1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc < %s -mtriple=arm64-eabi -global-isel=0 | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc < %s -mtriple=arm64-eabi -global-isel=1 -global-isel-abort=2 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 ; CHECK-GI: warning: Instruction selection used fallback path for test_v2p0
7 define <8 x i8> @test_vextd(<8 x i8> %tmp1, <8 x i8> %tmp2) {
8 ; CHECK-LABEL: test_vextd:
10 ; CHECK-NEXT: ext v0.8b, v0.8b, v1.8b, #3
12 %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10>
16 define <8 x i8> @test_vextRd(<8 x i8> %tmp1, <8 x i8> %tmp2) {
17 ; CHECK-LABEL: test_vextRd:
19 ; CHECK-NEXT: ext v0.8b, v1.8b, v0.8b, #5
21 %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 13, i32 14, i32 15, i32 0, i32 1, i32 2, i32 3, i32 4>
25 define <16 x i8> @test_vextq(<16 x i8> %tmp1, <16 x i8> %tmp2) {
26 ; CHECK-LABEL: test_vextq:
28 ; CHECK-NEXT: ext v0.16b, v0.16b, v1.16b, #3
30 %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> <i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18>
34 define <16 x i8> @test_vextRq(<16 x i8> %tmp1, <16 x i8> %tmp2) {
35 ; CHECK-LABEL: test_vextRq:
37 ; CHECK-NEXT: ext v0.16b, v1.16b, v0.16b, #7
39 %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> <i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6>
43 define <4 x i16> @test_vextd16(<4 x i16> %tmp1, <4 x i16> %tmp2) {
44 ; CHECK-LABEL: test_vextd16:
46 ; CHECK-NEXT: ext v0.8b, v0.8b, v1.8b, #6
48 %tmp3 = shufflevector <4 x i16> %tmp1, <4 x i16> %tmp2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
52 define <4 x i32> @test_vextq32(<4 x i32> %tmp1, <4 x i32> %tmp2) {
53 ; CHECK-LABEL: test_vextq32:
55 ; CHECK-NEXT: ext v0.16b, v0.16b, v1.16b, #12
57 %tmp3 = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
61 ; Undef shuffle indices should not prevent matching to VEXT:
63 define <8 x i8> @test_vextd_undef(<8 x i8> %tmp1, <8 x i8> %tmp2) {
64 ; CHECK-LABEL: test_vextd_undef:
66 ; CHECK-NEXT: ext v0.8b, v0.8b, v1.8b, #3
68 %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 3, i32 undef, i32 undef, i32 6, i32 7, i32 8, i32 9, i32 10>
72 define <8 x i8> @test_vextd_undef2(<8 x i8> %tmp1, <8 x i8> %tmp2) {
73 ; CHECK-LABEL: test_vextd_undef2:
75 ; CHECK-NEXT: ext v0.8b, v0.8b, v0.8b, #6
77 %tmp3 = shufflevector <8 x i8> %tmp1, <8 x i8> %tmp2, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 2, i32 3, i32 4, i32 5>
81 define <16 x i8> @test_vextRq_undef(<16 x i8> %tmp1, <16 x i8> %tmp2) {
82 ; CHECK-LABEL: test_vextRq_undef:
84 ; CHECK-NEXT: ext v0.16b, v1.16b, v0.16b, #7
86 %tmp3 = shufflevector <16 x i8> %tmp1, <16 x i8> %tmp2, <16 x i32> <i32 23, i32 24, i32 25, i32 26, i32 undef, i32 undef, i32 29, i32 30, i32 31, i32 0, i32 1, i32 2, i32 3, i32 4, i32 undef, i32 6>
90 define <8 x i16> @test_vextRq_undef2(<8 x i16> %tmp1) nounwind {
91 ; CHECK-LABEL: test_vextRq_undef2:
93 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #10
95 %vext = shufflevector <8 x i16> %tmp1, <8 x i16> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 1, i32 2, i32 3, i32 4>
99 ; Tests for ReconstructShuffle function. Indices have to be carefully
100 ; chosen to reach lowering phase as a BUILD_VECTOR.
102 ; An undef in the shuffle list should still be optimizable
103 define <4 x i16> @test_undef(<8 x i16> %tmp1, <8 x i16> %tmp2) {
104 ; CHECK-SD-LABEL: test_undef:
105 ; CHECK-SD: // %bb.0:
106 ; CHECK-SD-NEXT: ext v0.16b, v0.16b, v0.16b, #8
107 ; CHECK-SD-NEXT: zip1 v0.4h, v0.4h, v1.4h
110 ; CHECK-GI-LABEL: test_undef:
111 ; CHECK-GI: // %bb.0:
112 ; CHECK-GI-NEXT: adrp x8, .LCPI10_0
113 ; CHECK-GI-NEXT: // kill: def $q0 killed $q0 killed $q0_q1 def $q0_q1
114 ; CHECK-GI-NEXT: ldr q2, [x8, :lo12:.LCPI10_0]
115 ; CHECK-GI-NEXT: // kill: def $q1 killed $q1 killed $q0_q1 def $q0_q1
116 ; CHECK-GI-NEXT: tbl v0.16b, { v0.16b, v1.16b }, v2.16b
117 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
119 %tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <4 x i32> <i32 undef, i32 8, i32 5, i32 9>
123 define <2 x i64> @test_v2s64(<2 x i64> %a, <2 x i64> %b) {
124 ; CHECK-LABEL: test_v2s64:
126 ; CHECK-NEXT: ext v0.16b, v1.16b, v0.16b, #8
128 %s = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> <i32 3, i32 0>
132 define <2 x ptr> @test_v2p0(<2 x ptr> %a, <2 x ptr> %b) {
133 ; CHECK-LABEL: test_v2p0:
135 ; CHECK-NEXT: ext v0.16b, v1.16b, v0.16b, #8
137 %s = shufflevector <2 x ptr> %a, <2 x ptr> %b, <2 x i32> <i32 3, i32 0>