pytorch/test/cpp
Bert Maher 74082f0d6f [te][llvm] Generate arithmetic vs logical right shift as appropriate (#51749)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51749

Following in the mode of C++, we probably want to distinguish when
it's appropriate to do arithmetic vs. logical right shift.

> For negative a, the value of a >> b is implementation-defined (in most
> implementations, this performs arithmetic right shift, so that the result
> remains negative).

If you look at what clang does, if `a` is unsigned, a logical shift is
generated; if signed, an arithmetic shift.  Let's do the same here.  This turns
out to be useful for, e.g., implementing transcendental function
approximations.
ghstack-source-id: 121366317

Test Plan:
Added Byte (unsigned) and Char (signed) right-shift tests to
test_llvm.

Reviewed By: asuhan

Differential Revision: D26245856

fbshipit-source-id: 260ee9bf4b032b9ce216f89acbc273cde0ed688c
2021-02-10 02:05:39 -08:00
..
api fix unflatten_dense_tensor when there is empty tensor inside (#50321) 2021-01-23 12:14:34 -08:00
common
dist_autograd Fix Windows build failure after DDP PR merged (#45335) 2020-09-25 12:37:50 -07:00
jit Enables backend preprocessing to take place outside of the backend interface (#51757) 2021-02-06 01:07:17 -08:00
rpc Support device map for distributed autograd while using TensorPipe. (#44859) 2021-01-27 13:01:44 -08:00
tensorexpr [te][llvm] Generate arithmetic vs logical right shift as appropriate (#51749) 2021-02-10 02:05:39 -08:00
__init__.py remediation of S205607 2020-07-17 17:19:47 -07:00