<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal">I need to figure it out. It is tablegen produced some C++ code, which in turn resulted in UB. At the moment I have just put the constant there to clear the testing, the actual expected behavior is still questionable. It was !shl($var, 11)
 and the $var was negative. So it is a shift of a negative value. I do not see any issue with the shl of a negative value in 2-complement off hand given the size is the same size.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Stas<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Arsenault, Matthew <Matthew.Arsenault@amd.com> <br>
<b>Sent:</b> Monday, June 15, 2020 17:28<br>
<b>To:</b> llvm-commits@lists.llvm.org; Mekhanoshin, Stanislav <Stanislav.Mekhanoshin@amd.com>; Stanislav Mekhanoshin <llvmlistbot@llvm.org><br>
<b>Subject:</b> Re: [llvm] 576fa5a - [AMDGPU] make ubsan happy with unsigned left shift<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:15.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#0078D7">[AMD Official Use Only - Internal Distribution Only]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">This was in the tabelgen shift? Tablegen should be fixed instead?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> llvm-commits <<a href="mailto:llvm-commits-bounces@lists.llvm.org">llvm-commits-bounces@lists.llvm.org</a>> on behalf of Stanislav Mekhanoshin via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
<b>Sent:</b> Monday, June 15, 2020 5:21 PM<br>
<b>To:</b> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>><br>
<b>Subject:</b> [llvm] 576fa5a - [AMDGPU] make ubsan happy with unsigned left shift</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <br>
<br>
Author: Stanislav Mekhanoshin<br>
Date: 2020-06-15T17:21:10-07:00<br>
New Revision: 576fa5a50c8509977835031d190f8906e1dbb075<br>
<br>
URL: <a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636882998969&amp;sdata=03WSLSu42FOTqFmGc%2FedlUjWr5X0QmQdPOb%2FDkmrULk%3D&amp;reserved=0">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636882998969&amp;sdata=03WSLSu42FOTqFmGc%2FedlUjWr5X0QmQdPOb%2FDkmrULk%3D&amp;reserved=0</a><br>
DIFF: <a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075.diff&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&amp;sdata=Y4UJC7EUNn1yiWrwNcXJ5idm1%2Bi%2B3BZRlzUULZ1wguE%3D&amp;reserved=0">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project%2Fcommit%2F576fa5a50c8509977835031d190f8906e1dbb075.diff&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&amp;sdata=Y4UJC7EUNn1yiWrwNcXJ5idm1%2Bi%2B3BZRlzUULZ1wguE%3D&amp;reserved=0</a><br>
<br>
LOG: [AMDGPU] make ubsan happy with unsigned left shift<br>
<br>
Fixes UBSAN error after rG9ee272f13d88f090817235ef4f91e56bb2a153d6<br>
A trivial signed/unsigned shift.<br>
<br>
Added:<br>
<br>
<br>
Modified:<br>
    llvm/lib/Target/AMDGPU/SMInstructions.td<br>
<br>
Removed:<br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/llvm/lib/Target/AMDGPU/SMInstructions.td b/llvm/lib/Target/AMDGPU/SMInstructions.td<br>
index 252f191a2f66..df21c864ccad 100644<br>
--- a/llvm/lib/Target/AMDGPU/SMInstructions.td<br>
+++ b/llvm/lib/Target/AMDGPU/SMInstructions.td<br>
@@ -860,7 +860,7 @@ let OtherPredicates = [HasNoSMemTimeInst] in {<br>
 def : GCNPat <<br>
   (i64 (readcyclecounter)),<br>
   (REG_SEQUENCE SReg_64,<br>
-    (S_GETREG_B32 getHwRegImm<HWREG.SHADER_CYCLES, 0, -12>.ret), sub0,<br>
+    (S_GETREG_B32 -26595), sub0,<br>
     (S_MOV_B32 (i32 0)), sub1)<br>
 >;<br>
 } // let OtherPredicates = [HasNoSMemTimeInst]<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&amp;sdata=K4JiBEwIXLcAuBoYnoMN%2BiJ3t29BioFc5%2BC%2FUeW%2BYjg%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&amp;data=02%7C01%7CMatthew.Arsenault%40amd.com%7C8347580ea9c14e02566d08d8118b3468%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637278636883008962&amp;sdata=K4JiBEwIXLcAuBoYnoMN%2BiJ3t29BioFc5%2BC%2FUeW%2BYjg%3D&amp;reserved=0</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>