WebAssembly: implement getScalarShiftAmountTy so we can shift by amount, with type
authorJF Bastien <jfb@google.com>
Mon, 3 Aug 2015 00:00:11 +0000 (00:00 +0000)
committerJF Bastien <jfb@google.com>
Mon, 3 Aug 2015 00:00:11 +0000 (00:00 +0000)
commit5bcfe245f9d9c0624685571fdbd398a5e1e5118a
tree1d38b0145f79e256f39dfb5cbfd0a1e9772ca06c
parentdc8bd0ca41aa4bb0740797fea788d8de61afa3b2
WebAssembly: implement getScalarShiftAmountTy so we can shift by amount, with type

Summary: This currently sets the shift amount RHS to the same type as the LHS, and assumes that the LHS is a simple type. This isn't currently the case e.g. with weird integers sizes, but will eventually be true and will assert if not. That's what you get for having an experimental backend: break it and you get to keep both pieces. Most backends either set the RHS to MVT::i32 or MVT::i64, but WebAssembly is a virtual ISA and tries to have regular-looking binary operations where both operands are the same type (even if a 64-bit RHS shifter is slightly silly, hey it's free!).

Subscribers: llvm-commits, sunfish, jfb

Differential Revision: http://reviews.llvm.org/D11715

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243860 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
lib/Target/WebAssembly/WebAssemblyISelLowering.h
test/CodeGen/WebAssembly/integer64.ll