1 ; RUN: llc -mtriple aarch64-none-linux-gnu -mattr=+dotprod < %s | FileCheck %s
2 ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=cortex-a65 < %s | FileCheck %s
3 ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=cortex-a65ae < %s | FileCheck %s
4 ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=neoverse-e1 < %s | FileCheck %s
5 ; RUN: llc -mtriple aarch64-none-linux-gnu -mcpu=neoverse-n1 < %s | FileCheck %s
7 declare <2 x i32> @llvm.aarch64.neon.udot.v2i32.v8i8(<2 x i32>, <8 x i8>, <8 x i8>)
8 declare <4 x i32> @llvm.aarch64.neon.udot.v4i32.v16i8(<4 x i32>, <16 x i8>, <16 x i8>)
9 declare <2 x i32> @llvm.aarch64.neon.sdot.v2i32.v8i8(<2 x i32>, <8 x i8>, <8 x i8>)
10 declare <4 x i32> @llvm.aarch64.neon.sdot.v4i32.v16i8(<4 x i32>, <16 x i8>, <16 x i8>)
12 define <2 x i32> @test_vdot_u32(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) #0 {
14 ; CHECK-LABEL: test_vdot_u32:
15 ; CHECK: udot v0.2s, v1.8b, v2.8b
16 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.udot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) #2
17 ret <2 x i32> %vdot1.i
20 define <4 x i32> @test_vdotq_u32(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) #0 {
22 ; CHECK-LABEL: test_vdotq_u32:
23 ; CHECK: udot v0.4s, v1.16b, v2.16b
24 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.udot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) #2
25 ret <4 x i32> %vdot1.i
28 define <2 x i32> @test_vdot_s32(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) #0 {
30 ; CHECK-LABEL: test_vdot_s32:
31 ; CHECK: sdot v0.2s, v1.8b, v2.8b
32 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.sdot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) #2
33 ret <2 x i32> %vdot1.i
36 define <4 x i32> @test_vdotq_s32(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) #0 {
38 ; CHECK-LABEL: test_vdotq_s32:
39 ; CHECK: sdot v0.4s, v1.16b, v2.16b
40 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.sdot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) #2
41 ret <4 x i32> %vdot1.i
44 define <2 x i32> @test_vdot_lane_u32(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) {
46 ; CHECK-LABEL: test_vdot_lane_u32:
47 ; CHECK: udot v0.2s, v1.8b, v2.4b[1]
48 %.cast = bitcast <8 x i8> %c to <2 x i32>
49 %shuffle = shufflevector <2 x i32> %.cast, <2 x i32> undef, <2 x i32> <i32 1, i32 1>
50 %.cast5 = bitcast <2 x i32> %shuffle to <8 x i8>
51 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.udot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %.cast5) #2
52 ret <2 x i32> %vdot1.i
55 define <4 x i32> @test_vdotq_lane_u32(<4 x i32> %a, <16 x i8> %b, <8 x i8> %c) {
57 ; CHECK-LABEL: test_vdotq_lane_u32:
58 ; CHECK: udot v0.4s, v1.16b, v2.4b[1]
59 %.cast = bitcast <8 x i8> %c to <2 x i32>
60 %shuffle = shufflevector <2 x i32> %.cast, <2 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
61 %.cast3 = bitcast <4 x i32> %shuffle to <16 x i8>
62 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.udot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %.cast3) #2
63 ret <4 x i32> %vdot1.i
66 define <2 x i32> @test_vdot_laneq_u32(<2 x i32> %a, <8 x i8> %b, <16 x i8> %c) {
68 ; CHECK-LABEL: test_vdot_laneq_u32:
69 ; CHECK: udot v0.2s, v1.8b, v2.4b[1]
70 %.cast = bitcast <16 x i8> %c to <4 x i32>
71 %shuffle = shufflevector <4 x i32> %.cast, <4 x i32> undef, <2 x i32> <i32 1, i32 1>
72 %.cast5 = bitcast <2 x i32> %shuffle to <8 x i8>
73 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.udot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %.cast5) #2
74 ret <2 x i32> %vdot1.i
77 define <4 x i32> @test_vdotq_laneq_u32(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) {
79 ; CHECK-LABEL: test_vdotq_laneq_u32:
80 ; CHECK: udot v0.4s, v1.16b, v2.4b[1]
81 %.cast = bitcast <16 x i8> %c to <4 x i32>
82 %shuffle = shufflevector <4 x i32> %.cast, <4 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
83 %.cast3 = bitcast <4 x i32> %shuffle to <16 x i8>
84 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.udot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %.cast3) #2
85 ret <4 x i32> %vdot1.i
88 define <2 x i32> @test_vdot_lane_s32(<2 x i32> %a, <8 x i8> %b, <8 x i8> %c) {
90 ; CHECK-LABEL: test_vdot_lane_s32:
91 ; CHECK: sdot v0.2s, v1.8b, v2.4b[1]
92 %.cast = bitcast <8 x i8> %c to <2 x i32>
93 %shuffle = shufflevector <2 x i32> %.cast, <2 x i32> undef, <2 x i32> <i32 1, i32 1>
94 %.cast5 = bitcast <2 x i32> %shuffle to <8 x i8>
95 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.sdot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %.cast5) #2
96 ret <2 x i32> %vdot1.i
99 define <4 x i32> @test_vdotq_lane_s32(<4 x i32> %a, <16 x i8> %b, <8 x i8> %c) {
101 ; CHECK-LABEL: test_vdotq_lane_s32:
102 ; CHECK: sdot v0.4s, v1.16b, v2.4b[1]
103 %.cast = bitcast <8 x i8> %c to <2 x i32>
104 %shuffle = shufflevector <2 x i32> %.cast, <2 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
105 %.cast3 = bitcast <4 x i32> %shuffle to <16 x i8>
106 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.sdot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %.cast3) #2
107 ret <4 x i32> %vdot1.i
110 define <2 x i32> @test_vdot_laneq_s32(<2 x i32> %a, <8 x i8> %b, <16 x i8> %c) {
112 ; CHECK-LABEL: test_vdot_laneq_s32:
113 ; CHECK: sdot v0.2s, v1.8b, v2.4b[1]
114 %.cast = bitcast <16 x i8> %c to <4 x i32>
115 %shuffle = shufflevector <4 x i32> %.cast, <4 x i32> undef, <2 x i32> <i32 1, i32 1>
116 %.cast5 = bitcast <2 x i32> %shuffle to <8 x i8>
117 %vdot1.i = call <2 x i32> @llvm.aarch64.neon.sdot.v2i32.v8i8(<2 x i32> %a, <8 x i8> %b, <8 x i8> %.cast5) #2
118 ret <2 x i32> %vdot1.i
121 define <4 x i32> @test_vdotq_laneq_s32(<4 x i32> %a, <16 x i8> %b, <16 x i8> %c) {
123 ; CHECK-LABEL: test_vdotq_laneq_s32:
124 ; CHECK: sdot v0.4s, v1.16b, v2.4b[1]
125 %.cast = bitcast <16 x i8> %c to <4 x i32>
126 %shuffle = shufflevector <4 x i32> %.cast, <4 x i32> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
127 %.cast3 = bitcast <4 x i32> %shuffle to <16 x i8>
128 %vdot1.i = call <4 x i32> @llvm.aarch64.neon.sdot.v4i32.v16i8(<4 x i32> %a, <16 x i8> %b, <16 x i8> %.cast3) #2
129 ret <4 x i32> %vdot1.i