1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instcombine < %s | FileCheck %s
3
4define i35 @smax(i35 %x) {
5; CHECK-LABEL: @smax(
6; CHECK-NEXT:    [[R:%.*]] = call i35 @llvm.smax.i35(i35 [[X:%.*]], i35 42)
7; CHECK-NEXT:    ret i35 [[R]]
8;
9  %r = call i35 @llvm.smax.i35(i35 42, i35 %x)
10  ret i35 %r
11}
12
13define i5 @smin(i5 %x) {
14; CHECK-LABEL: @smin(
15; CHECK-NEXT:    [[R:%.*]] = call i5 @llvm.smin.i5(i5 [[X:%.*]], i5 10)
16; CHECK-NEXT:    ret i5 [[R]]
17;
18  %r = call i5 @llvm.smin.i5(i5 42, i5 %x)
19  ret i5 %r
20}
21
22define <2 x i35> @umax(<2 x i35> %x) {
23; CHECK-LABEL: @umax(
24; CHECK-NEXT:    [[R:%.*]] = call <2 x i35> @llvm.umax.v2i35(<2 x i35> [[X:%.*]], <2 x i35> <i35 42, i35 43>)
25; CHECK-NEXT:    ret <2 x i35> [[R]]
26;
27  %r = call <2 x i35> @llvm.umax.v2i35(<2 x i35> <i35 42, i35 43>, <2 x i35> %x)
28  ret <2 x i35> %r
29}
30
31define <3 x i35> @umin(<3 x i35> %x) {
32; CHECK-LABEL: @umin(
33; CHECK-NEXT:    [[R:%.*]] = call <3 x i35> @llvm.umin.v3i35(<3 x i35> [[X:%.*]], <3 x i35> <i35 undef, i35 42, i35 43>)
34; CHECK-NEXT:    ret <3 x i35> [[R]]
35;
36  %r = call <3 x i35> @llvm.umin.v3i35(<3 x i35> <i35 undef, i35 42, i35 43>, <3 x i35> %x)
37  ret <3 x i35> %r
38}
39
40define i35 @smul_fix(i35 %x) {
41; CHECK-LABEL: @smul_fix(
42; CHECK-NEXT:    [[R:%.*]] = call i35 @llvm.smul.fix.i35(i35 [[X:%.*]], i35 42, i32 2)
43; CHECK-NEXT:    ret i35 [[R]]
44;
45  %r = call i35 @llvm.smul.fix.i35(i35 42, i35 %x, i32 2)
46  ret i35 %r
47}
48
49define i5 @umul_fix(i5 %x) {
50; CHECK-LABEL: @umul_fix(
51; CHECK-NEXT:    [[R:%.*]] = call i5 @llvm.umul.fix.i5(i5 [[X:%.*]], i5 10, i32 3)
52; CHECK-NEXT:    ret i5 [[R]]
53;
54  %r = call i5 @llvm.umul.fix.i5(i5 42, i5 %x, i32 3)
55  ret i5 %r
56}
57
58define <2 x i35> @smul_fix_sat(<2 x i35> %x) {
59; CHECK-LABEL: @smul_fix_sat(
60; CHECK-NEXT:    [[R:%.*]] = call <2 x i35> @llvm.smul.fix.sat.v2i35(<2 x i35> [[X:%.*]], <2 x i35> <i35 42, i35 43>, i32 4)
61; CHECK-NEXT:    ret <2 x i35> [[R]]
62;
63  %r = call <2 x i35> @llvm.smul.fix.sat.v2i35(<2 x i35> <i35 42, i35 43>, <2 x i35> %x, i32 4)
64  ret <2 x i35> %r
65}
66
67define <3 x i35> @umul_fix_sat(<3 x i35> %x) {
68; CHECK-LABEL: @umul_fix_sat(
69; CHECK-NEXT:    [[R:%.*]] = call <3 x i35> @llvm.umul.fix.sat.v3i35(<3 x i35> [[X:%.*]], <3 x i35> <i35 undef, i35 42, i35 43>, i32 5)
70; CHECK-NEXT:    ret <3 x i35> [[R]]
71;
72  %r = call <3 x i35> @llvm.umul.fix.sat.v3i35(<3 x i35> <i35 undef, i35 42, i35 43>, <3 x i35> %x, i32 5)
73  ret <3 x i35> %r
74}
75
76declare i35 @llvm.smax.i35(i35, i35)
77declare i5 @llvm.smin.i5(i5, i5)
78declare <2 x i35> @llvm.umax.v2i35(<2 x i35>, <2 x i35>)
79declare <3 x i35> @llvm.umin.v3i35(<3 x i35>, <3 x i35>)
80declare i35 @llvm.smul.fix.i35(i35, i35, i32)
81declare i5 @llvm.umul.fix.i5(i5, i5, i32)
82declare <2 x i35> @llvm.smul.fix.sat.v2i35(<2 x i35>, <2 x i35>, i32)
83declare <3 x i35> @llvm.umul.fix.sat.v3i35(<3 x i35>, <3 x i35>, i32)
84