<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56706>56706</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            MASKL(0)/MASKR(0) return -1 instead of 0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jeanPerier
      </td>
    </tr>
</table>

<pre>
    Repro:
```
  integer :: n
  n = 0
  ! Expects 0, gets -1
  print *, maskl(n)
  print *, maskr(n)
end
```

MASK intrinsic lowering was just implemented in https://github.com/llvm/llvm-project/commit/71ee3570f46cbbbaf08f98d4338ff0946e7dd2b8. The results in the zero case appears to be wrong.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUcuO1DAQ_BrnYm3k2GMnOfgQdtgLIKGFH7DjTuJZ5yHbYYCvpzPsgJDggGLFXV2l7uq2Xd03_QxbXInoCDsT1hHFXs8NUuqXDCNEeihER5d7fsHMmf6SEV7Rt1836HPCJH-kI2D0UN35LWIhVHUHN5v0EghvFsLbfwriHwJY3F8N_vx_6D69O5xijeR7GtYrYDjSq0n0sqdM_bwFmAFncaijU85bOibiT3hGn6fdlv06Iwjhy_16wMVccCKEyM3-COoKQMiaDSfVW2vNwJqhbdxJiGYYWHtSUDvHbVPSzxPQCGkPuAdsmRF-h7jS3iSgZtvAxETzSi3Qa1yXsSxAV0o2teRSicJp4VrRmiL7HEAfE77HjbBjI_zpgM-vELvkPS64bOyTMhhH14GyYo9B__egPqUdEgZS1UwVk264HUxvetUbxmUrW8dqwdtK2bqR0IsiGAshaSLfEM6HYJYRbyLPhdeccc5qLisuFBOlGngFfSulwc-5lpwYzMaH8vBQrnEsor7ZsfuYkAw-5fSbNCn5cQG4tcL6Zs_TGvUFzPIRnxticTOvb85_AC7J2yY">