[LLVMdev] Simple question on sign
Eli Friedman
eli.friedman at gmail.com
Wed Feb 22 16:50:06 PST 2012
On Wed, Feb 22, 2012 at 4:28 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
On Wed, Feb 22, 2012 at 4:28 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> How do you determine if a shift is signed or not?
>
> ashr = always signed?
Essentially, yes.
> lshr = always unsigned?
Essentially, yes.
> shl = always signed?
Signed left shift and unsigned left shift are both shl.
http://llvm.org/docs/LangRef.html#i_shl describes the semantics of shifts.
> The CmpInst has the "isSigned()" function, but it appears that every other
> Instruction I've looked at doesn't seem to have this.
There isn't an isSigned() function because the query doesn't really
make sense. LLVM IR doesn't in general track whether a value is
signed or unsigned.
-Eli
More information about the llvm-dev
mailing list