1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -passes=instsimplify | FileCheck %s
4 declare i16 @llvm.smul.fix.i16(i16, i16, i32)
5 declare i16 @llvm.smul.fix.sat.i16(i16, i16, i32)
6 declare <2 x i16> @llvm.smul.fix.v2i16(<2 x i16>, <2 x i16>, i32)
7 declare <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16>, <2 x i16>, i32)
10 ;; llvm.smul.fix (scalar)
14 define i16 @smul_fix_0(i16 %arg) {
15 ; CHECK-LABEL: @smul_fix_0(
16 ; CHECK-NEXT: ret i16 0
18 %res = call i16 @llvm.smul.fix.i16(i16 %arg, i16 0, i32 15)
23 define i16 @smul_fix_1(i16 %arg) {
24 ; CHECK-LABEL: @smul_fix_1(
25 ; CHECK-NEXT: ret i16 0
27 %res = call i16 @llvm.smul.fix.i16(i16 0, i16 %arg, i32 15)
32 define i16 @smul_fix_2(i16 %arg) {
33 ; CHECK-LABEL: @smul_fix_2(
34 ; CHECK-NEXT: ret i16 0
36 %res = call i16 @llvm.smul.fix.i16(i16 %arg, i16 undef, i32 15)
41 define i16 @smul_fix_3(i16 %arg) {
42 ; CHECK-LABEL: @smul_fix_3(
43 ; CHECK-NEXT: ret i16 0
45 %res = call i16 @llvm.smul.fix.i16(i16 undef, i16 %arg, i32 15)
50 define i16 @smul_fix_4(i16 %arg) {
51 ; CHECK-LABEL: @smul_fix_4(
52 ; CHECK-NEXT: ret i16 [[ARG:%.*]]
54 %res = call i16 @llvm.smul.fix.i16(i16 %arg, i16 16384, i32 14)
59 define i16 @smul_fix_5(i16 %arg) {
60 ; CHECK-LABEL: @smul_fix_5(
61 ; CHECK-NEXT: ret i16 [[ARG:%.*]]
63 %res = call i16 @llvm.smul.fix.i16(i16 2, i16 %arg, i32 1)
68 ;; llvm.smul.fix.sat (scalar)
72 define i16 @smul_fix_sat_0(i16 %arg) {
73 ; CHECK-LABEL: @smul_fix_sat_0(
74 ; CHECK-NEXT: ret i16 0
76 %res = call i16 @llvm.smul.fix.sat.i16(i16 %arg, i16 0, i32 15)
81 define i16 @smul_fix_sat_1(i16 %arg) {
82 ; CHECK-LABEL: @smul_fix_sat_1(
83 ; CHECK-NEXT: ret i16 0
85 %res = call i16 @llvm.smul.fix.sat.i16(i16 0, i16 %arg, i32 15)
90 define i16 @smul_fix_sat_2(i16 %arg) {
91 ; CHECK-LABEL: @smul_fix_sat_2(
92 ; CHECK-NEXT: ret i16 0
94 %res = call i16 @llvm.smul.fix.sat.i16(i16 %arg, i16 undef, i32 15)
99 define i16 @smul_fix_sat_3(i16 %arg) {
100 ; CHECK-LABEL: @smul_fix_sat_3(
101 ; CHECK-NEXT: ret i16 0
103 %res = call i16 @llvm.smul.fix.sat.i16(i16 undef, i16 %arg, i32 15)
108 define i16 @smul_fix_sat_4(i16 %arg) {
109 ; CHECK-LABEL: @smul_fix_sat_4(
110 ; CHECK-NEXT: ret i16 [[ARG:%.*]]
112 %res = call i16 @llvm.smul.fix.sat.i16(i16 %arg, i16 16384, i32 14)
117 define i16 @smul_fix_sat_5(i16 %arg) {
118 ; CHECK-LABEL: @smul_fix_sat_5(
119 ; CHECK-NEXT: ret i16 [[ARG:%.*]]
121 %res = call i16 @llvm.smul.fix.sat.i16(i16 2, i16 %arg, i32 1)
126 ;; llvm.smul.fix (vector)
130 define <2 x i16> @smul_fix_vec_0(<2 x i16> %arg) {
131 ; CHECK-LABEL: @smul_fix_vec_0(
132 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
134 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> %arg, <2 x i16> zeroinitializer, i32 15)
139 define <2 x i16> @smul_fix_vec_1(<2 x i16> %arg) {
140 ; CHECK-LABEL: @smul_fix_vec_1(
141 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
143 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> zeroinitializer, <2 x i16> %arg, i32 15)
148 define <2 x i16> @smul_fix_vec_2(<2 x i16> %arg) {
149 ; CHECK-LABEL: @smul_fix_vec_2(
150 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
152 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> %arg, <2 x i16> undef, i32 15)
157 define <2 x i16> @smul_fix_vec_3(<2 x i16> %arg) {
158 ; CHECK-LABEL: @smul_fix_vec_3(
159 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
161 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> undef, <2 x i16> %arg, i32 15)
166 define <2 x i16> @smul_fix_vec_4(<2 x i16> %arg) {
167 ; CHECK-LABEL: @smul_fix_vec_4(
168 ; CHECK-NEXT: ret <2 x i16> [[ARG:%.*]]
170 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> %arg, <2 x i16> <i16 16384, i16 16384>, i32 14)
175 define <2 x i16> @smul_fix_vec_5(<2 x i16> %arg) {
176 ; CHECK-LABEL: @smul_fix_vec_5(
177 ; CHECK-NEXT: ret <2 x i16> [[ARG:%.*]]
179 %res = call <2 x i16> @llvm.smul.fix.v2i16(<2 x i16> <i16 2, i16 2>, <2 x i16> %arg, i32 1)
184 ;; llvm.smul.fix.sat (vector)
188 define <2 x i16> @smul_fix_sat_vec_0(<2 x i16> %arg) {
189 ; CHECK-LABEL: @smul_fix_sat_vec_0(
190 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
192 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> %arg, <2 x i16> zeroinitializer, i32 15)
197 define <2 x i16> @smul_fix_sat_vec_1(<2 x i16> %arg) {
198 ; CHECK-LABEL: @smul_fix_sat_vec_1(
199 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
201 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> zeroinitializer, <2 x i16> %arg, i32 15)
206 define <2 x i16> @smul_fix_sat_vec_2(<2 x i16> %arg) {
207 ; CHECK-LABEL: @smul_fix_sat_vec_2(
208 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
210 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> %arg, <2 x i16> undef, i32 15)
215 define <2 x i16> @smul_fix_sat_vec_3(<2 x i16> %arg) {
216 ; CHECK-LABEL: @smul_fix_sat_vec_3(
217 ; CHECK-NEXT: ret <2 x i16> zeroinitializer
219 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> undef, <2 x i16> %arg, i32 15)
224 define <2 x i16> @smul_fix_sat_vec_4(<2 x i16> %arg) {
225 ; CHECK-LABEL: @smul_fix_sat_vec_4(
226 ; CHECK-NEXT: ret <2 x i16> [[ARG:%.*]]
228 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> %arg, <2 x i16> <i16 16384, i16 16384>, i32 14)
233 define <2 x i16> @smul_fix_sat_vec_5(<2 x i16> %arg) {
234 ; CHECK-LABEL: @smul_fix_sat_vec_5(
235 ; CHECK-NEXT: ret <2 x i16> [[ARG:%.*]]
237 %res = call <2 x i16> @llvm.smul.fix.sat.v2i16(<2 x i16> <i16 2, i16 2>, <2 x i16> %arg, i32 1)