1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instcombine -mtriple=x86_64-unknown-unknown -S | FileCheck %s
8 define <8 x i16> @undef_pmulh_128(<8 x i16> %a0) {
9 ; CHECK-LABEL: @undef_pmulh_128(
10 ; CHECK-NEXT: ret <8 x i16> zeroinitializer
12 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %a0, <8 x i16> undef)
16 define <8 x i16> @undef_pmulh_128_commute(<8 x i16> %a0) {
17 ; CHECK-LABEL: @undef_pmulh_128_commute(
18 ; CHECK-NEXT: ret <8 x i16> zeroinitializer
20 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> undef, <8 x i16> %a0)
24 define <16 x i16> @undef_pmulh_256(<16 x i16> %a0) {
25 ; CHECK-LABEL: @undef_pmulh_256(
26 ; CHECK-NEXT: ret <16 x i16> zeroinitializer
28 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> %a0, <16 x i16> undef)
32 define <16 x i16> @undef_pmulh_256_commute(<16 x i16> %a0) {
33 ; CHECK-LABEL: @undef_pmulh_256_commute(
34 ; CHECK-NEXT: ret <16 x i16> zeroinitializer
36 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> undef, <16 x i16> %a0)
40 define <32 x i16> @undef_pmulh_512(<32 x i16> %a0) {
41 ; CHECK-LABEL: @undef_pmulh_512(
42 ; CHECK-NEXT: ret <32 x i16> zeroinitializer
44 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> %a0, <32 x i16> undef)
48 define <32 x i16> @undef_pmulh_512_commute(<32 x i16> %a0) {
49 ; CHECK-LABEL: @undef_pmulh_512_commute(
50 ; CHECK-NEXT: ret <32 x i16> zeroinitializer
52 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> undef, <32 x i16> %a0)
60 define <8 x i16> @zero_pmulh_128(<8 x i16> %a0) {
61 ; CHECK-LABEL: @zero_pmulh_128(
62 ; CHECK-NEXT: ret <8 x i16> zeroinitializer
64 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %a0, <8 x i16> zeroinitializer)
68 define <8 x i16> @zero_pmulh_128_commute(<8 x i16> %a0) {
69 ; CHECK-LABEL: @zero_pmulh_128_commute(
70 ; CHECK-NEXT: ret <8 x i16> zeroinitializer
72 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> zeroinitializer, <8 x i16> %a0)
76 define <16 x i16> @zero_pmulh_256(<16 x i16> %a0) {
77 ; CHECK-LABEL: @zero_pmulh_256(
78 ; CHECK-NEXT: ret <16 x i16> zeroinitializer
80 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> %a0, <16 x i16> zeroinitializer)
84 define <16 x i16> @zero_pmulh_256_commute(<16 x i16> %a0) {
85 ; CHECK-LABEL: @zero_pmulh_256_commute(
86 ; CHECK-NEXT: ret <16 x i16> zeroinitializer
88 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> zeroinitializer, <16 x i16> %a0)
92 define <32 x i16> @zero_pmulh_512(<32 x i16> %a0) {
93 ; CHECK-LABEL: @zero_pmulh_512(
94 ; CHECK-NEXT: ret <32 x i16> zeroinitializer
96 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> %a0, <32 x i16> zeroinitializer)
100 define <32 x i16> @zero_pmulh_512_commute(<32 x i16> %a0) {
101 ; CHECK-LABEL: @zero_pmulh_512_commute(
102 ; CHECK-NEXT: ret <32 x i16> zeroinitializer
104 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> zeroinitializer, <32 x i16> %a0)
112 define <8 x i16> @one_pmulh_128(<8 x i16> %a0) {
113 ; CHECK-LABEL: @one_pmulh_128(
114 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> [[A0:%.*]], <8 x i16> splat (i16 1))
115 ; CHECK-NEXT: ret <8 x i16> [[TMP1]]
117 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %a0, <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>)
121 define <8 x i16> @one_pmulh_128_commute(<8 x i16> %a0) {
122 ; CHECK-LABEL: @one_pmulh_128_commute(
123 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> splat (i16 1), <8 x i16> [[A0:%.*]])
124 ; CHECK-NEXT: ret <8 x i16> [[TMP1]]
126 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <8 x i16> %a0)
130 define <16 x i16> @one_pmulh_256(<16 x i16> %a0) {
131 ; CHECK-LABEL: @one_pmulh_256(
132 ; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> [[A0:%.*]], <16 x i16> splat (i16 1))
133 ; CHECK-NEXT: ret <16 x i16> [[TMP1]]
135 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> %a0, <16 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>)
139 define <16 x i16> @one_pmulh_256_commute(<16 x i16> %a0) {
140 ; CHECK-LABEL: @one_pmulh_256_commute(
141 ; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> splat (i16 1), <16 x i16> [[A0:%.*]])
142 ; CHECK-NEXT: ret <16 x i16> [[TMP1]]
144 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <16 x i16> %a0)
148 define <32 x i16> @one_pmulh_512(<32 x i16> %a0) {
149 ; CHECK-LABEL: @one_pmulh_512(
150 ; CHECK-NEXT: [[TMP1:%.*]] = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> [[A0:%.*]], <32 x i16> splat (i16 1))
151 ; CHECK-NEXT: ret <32 x i16> [[TMP1]]
153 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> %a0, <32 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>)
157 define <32 x i16> @one_pmulh_512_commute(<32 x i16> %a0) {
158 ; CHECK-LABEL: @one_pmulh_512_commute(
159 ; CHECK-NEXT: [[TMP1:%.*]] = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> splat (i16 1), <32 x i16> [[A0:%.*]])
160 ; CHECK-NEXT: ret <32 x i16> [[TMP1]]
162 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, <32 x i16> %a0)
170 define <8 x i16> @fold_pmulh_128() {
171 ; CHECK-LABEL: @fold_pmulh_128(
172 ; CHECK-NEXT: ret <8 x i16> <i16 0, i16 0, i16 -3, i16 -4, i16 0, i16 0, i16 -7, i16 -8>
174 %1 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> <i16 -1, i16 2, i16 3, i16 -4, i16 -5, i16 6, i16 7, i16 -8>, <8 x i16> <i16 -5, i16 7, i16 -32768, i16 32765, i16 -9, i16 -11, i16 -32763, i16 32761>)
178 define <16 x i16> @fold_pmulh_256() {
179 ; CHECK-LABEL: @fold_pmulh_256(
180 ; CHECK-NEXT: ret <16 x i16> <i16 0, i16 0, i16 -2, i16 3, i16 0, i16 0, i16 -6, i16 7, i16 0, i16 0, i16 10, i16 11, i16 0, i16 0, i16 14, i16 -15>
182 %1 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> <i16 0, i16 -1, i16 2, i16 3, i16 -4, i16 -5, i16 6, i16 7, i16 -8, i16 9, i16 -10, i16 11, i16 -12, i16 13, i16 -14, i16 -15>, <16 x i16> <i16 -5, i16 7, i16 -32768, i16 32766, i16 -9, i16 -11, i16 -32764, i16 32762, i16 13, i16 -15, i16 -32760, i16 32758, i16 17, i16 -19, i16 -32756, i16 32756>)
186 define <32 x i16> @fold_pmulh_512() {
187 ; CHECK-LABEL: @fold_pmulh_512(
188 ; CHECK-NEXT: ret <32 x i16> <i16 0, i16 0, i16 -2, i16 3, i16 0, i16 0, i16 -6, i16 7, i16 0, i16 0, i16 10, i16 11, i16 0, i16 0, i16 14, i16 -15, i16 0, i16 0, i16 -2, i16 3, i16 0, i16 0, i16 -6, i16 7, i16 0, i16 0, i16 10, i16 11, i16 0, i16 0, i16 14, i16 -15>
190 %1 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> <i16 0, i16 -1, i16 2, i16 3, i16 -4, i16 -5, i16 6, i16 7, i16 -8, i16 9, i16 -10, i16 11, i16 -12, i16 13, i16 -14, i16 -15, i16 -5, i16 7, i16 -32768, i16 32766, i16 -9, i16 -11, i16 -32764, i16 32762, i16 13, i16 -15, i16 -32760, i16 32758, i16 17, i16 -19, i16 -32756, i16 32756>, <32 x i16> <i16 -5, i16 7, i16 -32768, i16 32766, i16 -9, i16 -11, i16 -32764, i16 32762, i16 13, i16 -15, i16 -32760, i16 32758, i16 17, i16 -19, i16 -32756, i16 32756, i16 0, i16 -1, i16 2, i16 3, i16 -4, i16 -5, i16 6, i16 7, i16 -8, i16 9, i16 -10, i16 11, i16 -12, i16 13, i16 -14, i16 -15>)
198 define <8 x i16> @elts_pmulh_128(<8 x i16> %a0, <8 x i16> %a1) {
199 ; CHECK-LABEL: @elts_pmulh_128(
200 ; CHECK-NEXT: [[TMP1:%.*]] = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> [[A0:%.*]], <8 x i16> [[A1:%.*]])
201 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> poison, <8 x i32> zeroinitializer
202 ; CHECK-NEXT: ret <8 x i16> [[TMP2]]
204 %1 = shufflevector <8 x i16> %a0, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2>
205 %2 = shufflevector <8 x i16> %a1, <8 x i16> undef, <8 x i32> <i32 0, i32 1, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
206 %3 = call <8 x i16> @llvm.x86.ssse3.pmul.hr.sw.128(<8 x i16> %1, <8 x i16> %2)
207 %4 = shufflevector <8 x i16> %3, <8 x i16> poison, <8 x i32> zeroinitializer
211 define <16 x i16> @elts_pmulh_256(<16 x i16> %a0, <16 x i16> %a1) {
212 ; CHECK-LABEL: @elts_pmulh_256(
213 ; CHECK-NEXT: [[TMP1:%.*]] = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> [[A0:%.*]], <16 x i16> [[A1:%.*]])
214 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[TMP1]], <16 x i16> poison, <16 x i32> zeroinitializer
215 ; CHECK-NEXT: ret <16 x i16> [[TMP2]]
217 %1 = shufflevector <16 x i16> %a0, <16 x i16> undef, <16 x i32> <i32 0, i32 1, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
218 %2 = shufflevector <16 x i16> %a1, <16 x i16> undef, <16 x i32> <i32 0, i32 1, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
219 %3 = call <16 x i16> @llvm.x86.avx2.pmul.hr.sw(<16 x i16> %1, <16 x i16> %2)
220 %4 = shufflevector <16 x i16> %3, <16 x i16> poison, <16 x i32> zeroinitializer
224 define <32 x i16> @elts_pmulh_512(<32 x i16> %a0, <32 x i16> %a1) {
225 ; CHECK-LABEL: @elts_pmulh_512(
226 ; CHECK-NEXT: [[TMP1:%.*]] = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> [[A0:%.*]], <32 x i16> [[A1:%.*]])
227 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <32 x i16> [[TMP1]], <32 x i16> poison, <32 x i32> zeroinitializer
228 ; CHECK-NEXT: ret <32 x i16> [[TMP2]]
230 %1 = shufflevector <32 x i16> %a0, <32 x i16> undef, <32 x i32> <i32 0, i32 1, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
231 %2 = shufflevector <32 x i16> %a1, <32 x i16> undef, <32 x i32> <i32 0, i32 1, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
232 %3 = call <32 x i16> @llvm.x86.avx512.pmul.hr.sw.512(<32 x i16> %1, <32 x i16> %2)
233 %4 = shufflevector <32 x i16> %3, <32 x i16> poison, <32 x i32> zeroinitializer