1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-mesa3d < %s | FileCheck %s
4 define i1 @test_urem_odd(i13 %X) nounwind {
5 ; CHECK-LABEL: test_urem_odd:
7 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8 ; CHECK-NEXT: v_and_b32_e32 v0, 0x1fff, v0
9 ; CHECK-NEXT: s_movk_i32 s4, 0x667
10 ; CHECK-NEXT: v_mul_u32_u24_e32 v0, 0xccd, v0
11 ; CHECK-NEXT: v_and_b32_e32 v0, 0x1fff, v0
12 ; CHECK-NEXT: v_cmp_gt_u32_e32 vcc, s4, v0
13 ; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
14 ; CHECK-NEXT: s_setpc_b64 s[30:31]
15 %urem = urem i13 %X, 5
16 %cmp = icmp eq i13 %urem, 0
20 define i1 @test_urem_even(i27 %X) nounwind {
21 ; CHECK-LABEL: test_urem_even:
23 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
24 ; CHECK-NEXT: s_mov_b32 s4, 0x6db6db7
25 ; CHECK-NEXT: s_mov_b32 s5, 0x924925
26 ; CHECK-NEXT: v_mul_lo_u32 v0, v0, s4
27 ; CHECK-NEXT: v_lshlrev_b32_e32 v1, 26, v0
28 ; CHECK-NEXT: v_bfe_u32 v0, v0, 1, 26
29 ; CHECK-NEXT: v_or_b32_e32 v0, v0, v1
30 ; CHECK-NEXT: v_and_b32_e32 v0, 0x7ffffff, v0
31 ; CHECK-NEXT: v_cmp_gt_u32_e32 vcc, s5, v0
32 ; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
33 ; CHECK-NEXT: s_setpc_b64 s[30:31]
34 %urem = urem i27 %X, 14
35 %cmp = icmp eq i27 %urem, 0
39 define i1 @test_urem_odd_setne(i4 %X) nounwind {
40 ; CHECK-LABEL: test_urem_odd_setne:
42 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
43 ; CHECK-NEXT: v_and_b32_e32 v0, 15, v0
44 ; CHECK-NEXT: v_mul_u32_u24_e32 v0, 13, v0
45 ; CHECK-NEXT: v_and_b32_e32 v0, 15, v0
46 ; CHECK-NEXT: v_cmp_lt_u32_e32 vcc, 3, v0
47 ; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
48 ; CHECK-NEXT: s_setpc_b64 s[30:31]
50 %cmp = icmp ne i4 %urem, 0
54 define i1 @test_urem_negative_odd(i9 %X) nounwind {
55 ; CHECK-LABEL: test_urem_negative_odd:
57 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
58 ; CHECK-NEXT: v_and_b32_e32 v0, 0x1ff, v0
59 ; CHECK-NEXT: v_mul_u32_u24_e32 v0, 0x133, v0
60 ; CHECK-NEXT: v_and_b32_e32 v0, 0x1ff, v0
61 ; CHECK-NEXT: v_cmp_lt_u32_e32 vcc, 1, v0
62 ; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
63 ; CHECK-NEXT: s_setpc_b64 s[30:31]
64 %urem = urem i9 %X, -5
65 %cmp = icmp ne i9 %urem, 0
69 define <3 x i1> @test_urem_vec(<3 x i11> %X) nounwind {
70 ; CHECK-LABEL: test_urem_vec:
72 ; CHECK-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
73 ; CHECK-NEXT: v_and_b32_e32 v0, 0x7ff, v0
74 ; CHECK-NEXT: v_and_b32_e32 v1, 0x7ff, v1
75 ; CHECK-NEXT: v_and_b32_e32 v2, 0x7ff, v2
76 ; CHECK-NEXT: s_mov_b32 s4, 0x8311eb33
77 ; CHECK-NEXT: s_mov_b32 s5, 0x20140c
78 ; CHECK-NEXT: s_mov_b32 s6, 0xb6db6db7
79 ; CHECK-NEXT: s_mov_b32 s7, 0x24924924
80 ; CHECK-NEXT: s_mov_b32 s8, 0xaaaaaaab
81 ; CHECK-NEXT: s_mov_b32 s9, 0x2aaaaaaa
82 ; CHECK-NEXT: v_mul_lo_u32 v2, v2, s4
83 ; CHECK-NEXT: v_mul_lo_u32 v1, v1, s6
84 ; CHECK-NEXT: v_mul_lo_u32 v0, v0, s8
85 ; CHECK-NEXT: v_add_i32_e32 v2, vcc, 0xf9dc299a, v2
86 ; CHECK-NEXT: v_add_i32_e32 v1, vcc, 0x49249249, v1
87 ; CHECK-NEXT: v_alignbit_b32 v0, v0, v0, 1
88 ; CHECK-NEXT: v_cmp_lt_u32_e32 vcc, s9, v0
89 ; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc
90 ; CHECK-NEXT: v_cmp_lt_u32_e32 vcc, s7, v1
91 ; CHECK-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc
92 ; CHECK-NEXT: v_cmp_lt_u32_e32 vcc, s5, v2
93 ; CHECK-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc
94 ; CHECK-NEXT: s_setpc_b64 s[30:31]
95 %urem = urem <3 x i11> %X, <i11 6, i11 7, i11 -5>
96 %cmp = icmp ne <3 x i11> %urem, <i11 0, i11 1, i11 2>