[LLVMdev] Reference Manual Clarifications

Jon Sargeant delta17 at cox.net
Mon Mar 31 09:38:17 PDT 2008


Here are some clarifications for the reference manual.  Please verify 
that my assumptions are correct.  Shall I post a patch?

Floating-point Constants:  Add "The assembler requires the exact decimal 
value of a floating-point constant.  For example, the assembler accepts 
'1.25' but rejects '1.3' because '1.3' is a repeating decimal in binary."

Binary Operations: Add "of the same type" after "They require two operands".

Binary Operations: Replace "The result value of a binary operator is not 
necessarily the same type as its operands" with "The result value has 
the same type as its operands".

udiv/sdiv Instruction: Add "rounded towards zero" after "quotient of the 
two operands".

urem Instruction: Remove "regardless of whether the arguments are
unsigned or not" because it doesn't make sense.  Using urem instead of 
srem asserts that the arguments are unsigned.

urem/srem Instruction: Move remainder/modulo discussion from srem to 
urem since many readers will read the document from top to bottom.
In any case, both instructions should state "result has the same sign as 
the dividend".

frem Instruction: There are four ways to define frem based on the 
rounding mode.  The 8087 provides two of these: fprem and fprem1. 
Assuming the instruction uses the round-to-zero version of frem, add 
"calculated as <var1>-<var2>*floor(<var1>/<var2>)"

Bitwise Binary Operations: Add "of the same type" after "They require 
two operands"

Bitwise Binary Operations: Replace "The resulting value of the bitwise 
binary operators is always the same type as its first operand." with 
"The resulting value is the same type as its operands".

shl Instruction: Replace "var1 * 2^var2" with "var1 * 2^var2 mod 2^n, 
where n is width of result"

shl/lshr/ashr: Add "If var2 is negative, the result is undefined"

That's all for now.

Best Regards,
Jon



More information about the llvm-dev mailing list