1 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX2
2 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx512f,+avx512vl -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL
3 # RUN: llc -mtriple=x86_64-linux-gnu -mattr=+avx512f,+avx512vl,+avx512bw -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=AVX512BWVL
6 define <32 x i8> @test_add_v32i8(<32 x i8> %arg1, <32 x i8> %arg2) {
7 %ret = add <32 x i8> %arg1, %arg2
11 define <16 x i16> @test_add_v16i16(<16 x i16> %arg1, <16 x i16> %arg2) {
12 %ret = add <16 x i16> %arg1, %arg2
16 define <8 x i32> @test_add_v8i32(<8 x i32> %arg1, <8 x i32> %arg2) {
17 %ret = add <8 x i32> %arg1, %arg2
21 define <4 x i64> @test_add_v4i64(<4 x i64> %arg1, <4 x i64> %arg2) {
22 %ret = add <4 x i64> %arg1, %arg2
28 # ALL-LABEL: name: test_add_v32i8
33 # AVX2-NEXT: - { id: 0, class: vr256, preferred-register: '' }
34 # AVX2-NEXT: - { id: 1, class: vr256, preferred-register: '' }
35 # AVX2-NEXT: - { id: 2, class: vr256, preferred-register: '' }
37 # AVX512VL: registers:
38 # AVX512VL-NEXT: - { id: 0, class: vr256, preferred-register: '' }
39 # AVX512VL-NEXT: - { id: 1, class: vr256, preferred-register: '' }
40 # AVX512VL-NEXT: - { id: 2, class: vr256, preferred-register: '' }
42 # AVX512BWVL: registers:
43 # AVX512BWVL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
44 # AVX512BWVL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
45 # AVX512BWVL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
47 - { id: 0, class: vecr }
48 - { id: 1, class: vecr }
49 - { id: 2, class: vecr }
50 # AVX2: %2:vr256 = VPADDBYrr %0, %1
52 # AVX512VL: %2:vr256 = VPADDBYrr %0, %1
54 # AVX512BWVL: %2:vr256x = VPADDBZ256rr %0, %1
59 %0(<32 x s8>) = COPY $ymm0
60 %1(<32 x s8>) = COPY $ymm1
61 %2(<32 x s8>) = G_ADD %0, %1
62 $ymm0 = COPY %2(<32 x s8>)
68 # ALL-LABEL: name: test_add_v16i16
73 # AVX2-NEXT: - { id: 0, class: vr256, preferred-register: '' }
74 # AVX2-NEXT: - { id: 1, class: vr256, preferred-register: '' }
75 # AVX2-NEXT: - { id: 2, class: vr256, preferred-register: '' }
77 # AVX512VL: registers:
78 # AVX512VL-NEXT: - { id: 0, class: vr256, preferred-register: '' }
79 # AVX512VL-NEXT: - { id: 1, class: vr256, preferred-register: '' }
80 # AVX512VL-NEXT: - { id: 2, class: vr256, preferred-register: '' }
82 # AVX512BWVL: registers:
83 # AVX512BWVL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
84 # AVX512BWVL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
85 # AVX512BWVL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
87 - { id: 0, class: vecr }
88 - { id: 1, class: vecr }
89 - { id: 2, class: vecr }
90 # AVX2: %2:vr256 = VPADDWYrr %0, %1
92 # AVX512VL: %2:vr256 = VPADDWYrr %0, %1
94 # AVX512BWVL: %2:vr256x = VPADDWZ256rr %0, %1
99 %0(<16 x s16>) = COPY $ymm0
100 %1(<16 x s16>) = COPY $ymm1
101 %2(<16 x s16>) = G_ADD %0, %1
102 $ymm0 = COPY %2(<16 x s16>)
103 RET 0, implicit $ymm0
108 # ALL-LABEL: name: test_add_v8i32
111 regBankSelected: true
113 # AVX2-NEXT: - { id: 0, class: vr256, preferred-register: '' }
114 # AVX2-NEXT: - { id: 1, class: vr256, preferred-register: '' }
115 # AVX2-NEXT: - { id: 2, class: vr256, preferred-register: '' }
117 # AVX512VL: registers:
118 # AVX512VL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
119 # AVX512VL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
120 # AVX512VL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
122 # AVX512BWVL: registers:
123 # AVX512BWVL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
124 # AVX512BWVL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
125 # AVX512BWVL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
127 - { id: 0, class: vecr }
128 - { id: 1, class: vecr }
129 - { id: 2, class: vecr }
130 # AVX2: %2:vr256 = VPADDDYrr %0, %1
132 # AVX512VL: %2:vr256x = VPADDDZ256rr %0, %1
134 # AVX512BWVL: %2:vr256x = VPADDDZ256rr %0, %1
137 liveins: $ymm0, $ymm1
139 %0(<8 x s32>) = COPY $ymm0
140 %1(<8 x s32>) = COPY $ymm1
141 %2(<8 x s32>) = G_ADD %0, %1
142 $ymm0 = COPY %2(<8 x s32>)
143 RET 0, implicit $ymm0
148 # ALL-LABEL: name: test_add_v4i64
151 regBankSelected: true
153 # AVX2-NEXT: - { id: 0, class: vr256, preferred-register: '' }
154 # AVX2-NEXT: - { id: 1, class: vr256, preferred-register: '' }
155 # AVX2-NEXT: - { id: 2, class: vr256, preferred-register: '' }
157 # AVX512VL: registers:
158 # AVX512VL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
159 # AVX512VL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
160 # AVX512VL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
162 # AVX512BWVL: registers:
163 # AVX512BWVL-NEXT: - { id: 0, class: vr256x, preferred-register: '' }
164 # AVX512BWVL-NEXT: - { id: 1, class: vr256x, preferred-register: '' }
165 # AVX512BWVL-NEXT: - { id: 2, class: vr256x, preferred-register: '' }
167 - { id: 0, class: vecr }
168 - { id: 1, class: vecr }
169 - { id: 2, class: vecr }
170 # AVX2: %2:vr256 = VPADDQYrr %0, %1
172 # AVX512VL: %2:vr256x = VPADDQZ256rr %0, %1
174 # AVX512BWVL: %2:vr256x = VPADDQZ256rr %0, %1
177 liveins: $ymm0, $ymm1
179 %0(<4 x s64>) = COPY $ymm0
180 %1(<4 x s64>) = COPY $ymm1
181 %2(<4 x s64>) = G_ADD %0, %1
182 $ymm0 = COPY %2(<4 x s64>)
183 RET 0, implicit $ymm0