Home | History | Annotate | Download | only in SPARC
      1 ; RUN: llc < %s -march=sparcv9 | FileCheck %s
      2 
      3 ; CHECK-LABEL: test1:
      4 ; CHECK:        sdivx %o0, %o1, %o2
      5 ; CHECK-NEXT:   mulx %o2, %o1, %o1
      6 ; CHECK-NEXT:   retl
      7 ; CHECK-NEXT:   sub %o0, %o1, %o0
      8 
      9 define i64 @test1(i64 %X, i64 %Y) {
     10         %tmp1 = srem i64 %X, %Y
     11         ret i64 %tmp1
     12 }
     13 
     14 ; CHECK-LABEL: test2:
     15 ; CHECK:        udivx %o0, %o1, %o2
     16 ; CHECK-NEXT:   mulx %o2, %o1, %o1
     17 ; CHECK-NEXT:   retl
     18 ; CHECK-NEXT:   sub %o0, %o1, %o0
     19 
     20 define i64 @test2(i64 %X, i64 %Y) {
     21         %tmp1 = urem i64 %X, %Y
     22         ret i64 %tmp1
     23 }
     24 
     25 ; PR18150
     26 ; CHECK-LABEL: test3
     27 ; CHECK:       sethi 2545, [[R0:%[gilo][0-7]]]
     28 ; CHECK:       or    [[R0]], 379, [[R1:%[gilo][0-7]]]
     29 ; CHECK:       mulx  %o0, [[R1]], [[R2:%[gilo][0-7]]]
     30 ; CHECK:       udivx [[R2]], 1021, [[R3:%[gilo][0-7]]]
     31 ; CHECK:       mulx  [[R3]], 1021, [[R4:%[gilo][0-7]]]
     32 ; CHECK:       sub   [[R2]], [[R4]], %o0
     33 
     34 define i64 @test3(i64 %b) {
     35 entry:
     36   %mul = mul i64 %b, 2606459
     37   %rem = urem i64 %mul, 1021
     38   ret i64 %rem
     39 }
     40