summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/CodeGenPrepare/NVPTX/bypass-slow-div.ll
blob: 4846d52f4d267f79863b3f4d2efdb9e7d5c7eb36 (plain)
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
; RUN: opt -S -codegenprepare < %s | FileCheck %s

target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda"

; We only use the div instruction -- the rem should be DCE'ed.
; CHECK-LABEL: @div_only
define void @div_only(i64 %a, i64 %b, i64* %retptr) {
  ; CHECK: udiv i32
  ; CHECK-NOT: urem
  ; CHECK: sdiv i64
  ; CHECK-NOT: rem
  %d = sdiv i64 %a, %b
  store i64 %d, i64* %retptr
  ret void
}

; We only use the rem instruction -- the div should be DCE'ed.
; CHECK-LABEL: @rem_only
define void @rem_only(i64 %a, i64 %b, i64* %retptr) {
  ; CHECK-NOT: div
  ; CHECK: urem i32
  ; CHECK-NOT: div
  ; CHECK: rem i64
  ; CHECK-NOT: div
  %d = srem i64 %a, %b
  store i64 %d, i64* %retptr
  ret void
}
OpenPOWER on IntegriCloud