[LLVMdev] Reference Manual Clarifications

Jonathan S. Shapiro shap at eros-os.com
Mon Mar 31 10:08:21 PDT 2008

Concerning the shift instructions:

In C, the effect of shifting by any amount larger than the operand width
is undefined. In the design of the IR, either these operations need to
be explicitly stated as undefined or a well-defined value needs to be
established for them.

Concrete example:

What does a left shift of an i32 by 33 bits produce?

The risk of making these operations defined is that we may become
obligated to introduce conditional branches in the back end to check
that registerized shift amounts are not out of range w.r.t. what the
hardware can handle.



More information about the llvm-dev mailing list