[NVPTX] Compute 'rem' using the result of 'div', if possible.
authorJustin Lebar <jlebar@google.com>
Fri, 28 Oct 2016 21:44:00 +0000 (21:44 +0000)
committerJustin Lebar <jlebar@google.com>
Fri, 28 Oct 2016 21:44:00 +0000 (21:44 +0000)
commitf0a80ba385b7e24e9f1cdb2a06fc6c77d7ddc062
treec136e45ab01eb1e17ee90ae5180bb5b966496cb7
parent0ede5fb1bbdd2b19f1209d8e164633d56bbc2d6a
[NVPTX] Compute 'rem' using the result of 'div', if possible.

Summary:
In isel, transform

  Num % Den

into

  Num - (Num / Den) * Den

if the result of Num / Den is already available.

Reviewers: tra

Subscribers: hfinkel, llvm-commits, jholewinski

Differential Revision: https://reviews.llvm.org/D26090

llvm-svn: 285461
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/test/CodeGen/NVPTX/divrem-combine.ll [new file with mode: 0644]