<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 11/19/2018 2:51 PM, Lei Zhang via
llvm-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:OFCFD816D3.8E5813F7-ON0025834A.007C526F-8525834A.007D96D8@notes.na.collabserv.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p><font size="2">Hi there,</font><br>
<br>
<font size="2">I have been trying to obtain a Constant from an
APInt using</font><br>
<font size="2">```</font><br>
<font size="2">auto maskConstant = llvm::ConstantInt::get(intTy,
maskPiece);</font><br>
<font size="2">```</font><br>
<font size="2">where `intTy` is a IntergerType pointer (64-bit)
and `maskPiece` is an APInt object. However, if `maskPiece`
has the a big value say </font><br>
<font size="2">18374686479671623680, which is
1111111100000000000000000000000000000000000000000000000000000000.
The constant will return a negative value -72057594037927936,
which looks it is always converted to a signed integer. How
can i keep it as unsigned?</font></p>
</blockquote>
<p>"i64 18374686479671623680" and "i64 -72057594037927936" are
actually the same value in LLVM IR. dump() prints the signed
version, but that's just for convenience (since "i64 -1" is easier
to read). Integer operations have separate signed and unsigned
versions where it's relevant (e.g. sdiv vs. udiv).<br>
</p>
<p>-Eli<br>
</p>
<pre class="moz-signature" cols="72">--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</body>
</html>