rem.ll
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=sparcv9 | FileCheck %s
define i64 @test1(i64 %X, i64 %Y) {
; CHECK-LABEL: test1:
; CHECK: .cfi_startproc
; CHECK-NEXT: ! %bb.0:
; CHECK-NEXT: sdivx %o0, %o1, %o2
; CHECK-NEXT: mulx %o2, %o1, %o1
; CHECK-NEXT: retl
; CHECK-NEXT: sub %o0, %o1, %o0
%tmp1 = srem i64 %X, %Y
ret i64 %tmp1
}
define i64 @test2(i64 %X, i64 %Y) {
; CHECK-LABEL: test2:
; CHECK: .cfi_startproc
; CHECK-NEXT: ! %bb.0:
; CHECK-NEXT: udivx %o0, %o1, %o2
; CHECK-NEXT: mulx %o2, %o1, %o1
; CHECK-NEXT: retl
; CHECK-NEXT: sub %o0, %o1, %o0
%tmp1 = urem i64 %X, %Y
ret i64 %tmp1
}
; PR18150
define i64 @test3(i64 %b) {
; CHECK-LABEL: test3:
; CHECK: .cfi_startproc
; CHECK-NEXT: ! %bb.0: ! %entry
; CHECK-NEXT: sethi 2545, %o1
; CHECK-NEXT: or %o1, 379, %o1
; CHECK-NEXT: mulx %o0, %o1, %o0
; CHECK-NEXT: udivx %o0, 1021, %o1
; CHECK-NEXT: mulx %o1, 1021, %o1
; CHECK-NEXT: retl
; CHECK-NEXT: sub %o0, %o1, %o0
entry:
%mul = mul i64 %b, 2606459
%rem = urem i64 %mul, 1021
ret i64 %rem
}