Home | History | Annotate | Download | only in NVPTX
      1 ; RUN: llc < %s -march=nvptx -mcpu=sm_35 | FileCheck %s
      2 
      3 ; 64-bit divides and rems should be split into a fast and slow path where
      4 ; the fast path uses a 32-bit operation.
      5 
      6 define void @sdiv64(i64 %a, i64 %b, i64* %retptr) {
      7 ; CHECK-LABEL: sdiv64(
      8 ; CHECK:        div.s64
      9 ; CHECK:        div.u32
     10 ; CHECK:        ret
     11   %d = sdiv i64 %a, %b
     12   store i64 %d, i64* %retptr
     13   ret void
     14 }
     15 
     16 define void @udiv64(i64 %a, i64 %b, i64* %retptr) {
     17 ; CHECK-LABEL: udiv64(
     18 ; CHECK:        div.u64
     19 ; CHECK:        div.u32
     20 ; CHECK:        ret
     21   %d = udiv i64 %a, %b
     22   store i64 %d, i64* %retptr
     23   ret void
     24 }
     25 
     26 define void @srem64(i64 %a, i64 %b, i64* %retptr) {
     27 ; CHECK-LABEL: srem64(
     28 ; CHECK:        rem.s64
     29 ; CHECK:        rem.u32
     30 ; CHECK:        ret
     31   %d = srem i64 %a, %b
     32   store i64 %d, i64* %retptr
     33   ret void
     34 }
     35 
     36 define void @urem64(i64 %a, i64 %b, i64* %retptr) {
     37 ; CHECK-LABEL: urem64(
     38 ; CHECK:        rem.u64
     39 ; CHECK:        rem.u32
     40 ; CHECK:        ret
     41   %d = urem i64 %a, %b
     42   store i64 %d, i64* %retptr
     43   ret void
     44 }
     45 
     46 define void @sdiv32(i32 %a, i32 %b, i32* %retptr) {
     47 ; CHECK-LABEL: sdiv32(
     48 ; CHECK: div.s32
     49 ; CHECK-NOT: div.
     50   %d = sdiv i32 %a, %b
     51   store i32 %d, i32* %retptr
     52   ret void
     53 }
     54 
     55 define void @udiv32(i32 %a, i32 %b, i32* %retptr) {
     56 ; CHECK-LABEL: udiv32(
     57 ; CHECK: div.u32
     58 ; CHECK-NOT: div.
     59   %d = udiv i32 %a, %b
     60   store i32 %d, i32* %retptr
     61   ret void
     62 }
     63 
     64 define void @srem32(i32 %a, i32 %b, i32* %retptr) {
     65 ; CHECK-LABEL: srem32(
     66 ; CHECK: rem.s32
     67 ; CHECK-NOT: rem.
     68   %d = srem i32 %a, %b
     69   store i32 %d, i32* %retptr
     70   ret void
     71 }
     72 
     73 define void @urem32(i32 %a, i32 %b, i32* %retptr) {
     74 ; CHECK-LABEL: urem32(
     75 ; CHECK: rem.u32
     76 ; CHECK-NOT: rem.
     77   %d = urem i32 %a, %b
     78   store i32 %d, i32* %retptr
     79   ret void
     80 }
     81