1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=amdgcn-unknown-amdhsa < %s | FileCheck %s
4 declare i32 @llvm.umin.i32(i32, i32)
5 declare i32 @llvm.umax.i32(i32, i32)
6 declare i32 @llvm.smin.i32(i32, i32)
7 declare i32 @llvm.smax.i32(i32, i32)
9 declare <4 x i32> @llvm.umin.v4i32(<4 x i32>, <4 x i32>)
10 declare <4 x i32> @llvm.umax.v4i32(<4 x i32>, <4 x i32>)
11 declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>)
12 declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>)
14 define i32 @test_umin_i32(i32 %a, i32 %b) {
15 ; CHECK-LABEL: test_umin_i32:
17 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18 ; CHECK-NEXT: v_min_u32_e32 v0, v0, v1
19 ; CHECK-NEXT: s_setpc_b64 s[30:31]
20 %r = call i32 @llvm.umin.i32(i32 %a, i32 %b)
24 define i32 @test_umax_i32(i32 %a, i32 %b) {
25 ; CHECK-LABEL: test_umax_i32:
27 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
28 ; CHECK-NEXT: v_max_u32_e32 v0, v0, v1
29 ; CHECK-NEXT: s_setpc_b64 s[30:31]
30 %r = call i32 @llvm.umax.i32(i32 %a, i32 %b)
34 define i32 @test_smin_i32(i32 %a, i32 %b) {
35 ; CHECK-LABEL: test_smin_i32:
37 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
38 ; CHECK-NEXT: v_min_i32_e32 v0, v0, v1
39 ; CHECK-NEXT: s_setpc_b64 s[30:31]
40 %r = call i32 @llvm.smin.i32(i32 %a, i32 %b)
44 define i32 @test_smax_i32(i32 %a, i32 %b) {
45 ; CHECK-LABEL: test_smax_i32:
47 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
48 ; CHECK-NEXT: v_max_i32_e32 v0, v0, v1
49 ; CHECK-NEXT: s_setpc_b64 s[30:31]
50 %r = call i32 @llvm.smax.i32(i32 %a, i32 %b)
54 define <4 x i32> @test_umin_v4i32(<4 x i32> %a, <4 x i32> %b) {
55 ; CHECK-LABEL: test_umin_v4i32:
57 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
58 ; CHECK-NEXT: v_min_u32_e32 v0, v0, v4
59 ; CHECK-NEXT: v_min_u32_e32 v1, v1, v5
60 ; CHECK-NEXT: v_min_u32_e32 v2, v2, v6
61 ; CHECK-NEXT: v_min_u32_e32 v3, v3, v7
62 ; CHECK-NEXT: s_setpc_b64 s[30:31]
63 %r = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %a, <4 x i32> %b)
67 define <4 x i32> @test_umax_v4i32(<4 x i32> %a, <4 x i32> %b) {
68 ; CHECK-LABEL: test_umax_v4i32:
70 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
71 ; CHECK-NEXT: v_max_u32_e32 v0, v0, v4
72 ; CHECK-NEXT: v_max_u32_e32 v1, v1, v5
73 ; CHECK-NEXT: v_max_u32_e32 v2, v2, v6
74 ; CHECK-NEXT: v_max_u32_e32 v3, v3, v7
75 ; CHECK-NEXT: s_setpc_b64 s[30:31]
76 %r = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %a, <4 x i32> %b)
80 define <4 x i32> @test_smin_v4i32(<4 x i32> %a, <4 x i32> %b) {
81 ; CHECK-LABEL: test_smin_v4i32:
83 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
84 ; CHECK-NEXT: v_min_i32_e32 v0, v0, v4
85 ; CHECK-NEXT: v_min_i32_e32 v1, v1, v5
86 ; CHECK-NEXT: v_min_i32_e32 v2, v2, v6
87 ; CHECK-NEXT: v_min_i32_e32 v3, v3, v7
88 ; CHECK-NEXT: s_setpc_b64 s[30:31]
89 %r = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %a, <4 x i32> %b)
93 define <4 x i32> @test_smax_v4i32(<4 x i32> %a, <4 x i32> %b) {
94 ; CHECK-LABEL: test_smax_v4i32:
96 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
97 ; CHECK-NEXT: v_max_i32_e32 v0, v0, v4
98 ; CHECK-NEXT: v_max_i32_e32 v1, v1, v5
99 ; CHECK-NEXT: v_max_i32_e32 v2, v2, v6
100 ; CHECK-NEXT: v_max_i32_e32 v3, v3, v7
101 ; CHECK-NEXT: s_setpc_b64 s[30:31]
102 %r = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %a, <4 x i32> %b)