<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    This patch introduces a number of checks when the shift operator is
    used on OpenCL vectors:<br>
    <ol>
      <li>If LHS is a scalar, then RHS cannot be a vector.</li>
      <li>Operands must be of integer type.</li>
      <li>If both are vectors, then the number of elements must match.</li>
    </ol>
    Also, when LHS is a vector, a scalar RHS can simply be expanded into
    a vector; OpenCL does not require that its rank be lower than the
    LHS for "usual arithmetic conversions" defined in Section 6.2.6.
    This is because unlike other binary operators, the shift operators
    do not actually combine their operands. This is further supported by
    the fact that in OpenCL, the shift (RHS) is computed modulo the
    word-size of the LHS, and the effective shift value can always fit
    in a smaller type. For example, the following code is not an error
    even if the implicit type of the constant literal is "int":<br>
    <br>
        char2 foo(char2 v) { return v << 1; }<br>
        <br>
    The patch additionally consolidates existing tests under
    CodeGenOpenCL, and creates more tests under SemaOpenCL.<br>
    <br>
    Sameer.<br>
  </body>
</html>