[LLVMdev] LangRef description of 'add nsw' doesn't match reality
Dan Gohman
gohman at apple.com
Wed Sep 2 10:32:26 PDT 2009
On Sep 2, 2009, at 7:31 AM, Paul Melis wrote:
> The langref says for the 'add' instruction:
>
> Syntax:
>
> <result> = add <ty> <op1>, <op2> ; yields {ty}:result
> <result> = nuw add <ty> <op1>, <op2> ; yields {ty}:result
> <result> = nsw add <ty> <op1>, <op2> ; yields {ty}:result
> <result> = nuw nsw add <ty> <op1>, <op2> ; yields {ty}:result
>
> But llvm-as does not accept that sequence, only ... = add nsw ...
> (which
> is also what llvm-gcc generates). E.g.
>
> 16:29|melis at juggle2:~> cat add.ll | grep nsw
> %2 = nsw add i32 %1, 1 ; <i32> [#uses=1]
> 16:29|melis at juggle2:~> llvm-as add.ll
> llvm-as: add.ll:14:8: error: expected instruction opcode
> %2 = nsw add i32 %1, 1 ; <i32> [#uses=1]
> ^
> 16:29|melis at juggle2:~> cat add2.ll | grep nsw
> %2 = add nsw i32 %1, 1 ; <i32> [#uses=1]
> 16:29|melis at juggle2:~> llvm-as add2.ll
> 16:29|melis at juggle2:~>
>
> It seems the other variants of add (and sub) described also should
> list
> the opcode first, followed by the wrap flag.
Thanks for spotting this; I just committed a documentation fix for this.
Thanks,
Dan
More information about the llvm-dev
mailing list