<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 17, 2014, at 12:33 PM, Kevin Enderby <<a href="mailto:enderby@apple.com">enderby@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Tom,<br><br>If I remember my IEEE-754 standard correctly, NaN’s are not signed. So I suspect linux is wrong here. But someone with more current knowledge could check that out as I did floating point software over 30 years ago :)<br><br>Kev<br></blockquote><div><br></div><div>C99 says:</div><div><br></div><div>
<div class="page" title="Page 35">
<div class="layoutArea">
<div class="column">
<ol start="2" style="list-style-type: none">
<li><p><span style="font-size: 12.000000pt; font-family: 'Times'">An implementation may give zero and non-numeric values (such as infinities and NaNs) a
sign or may leave them unsigned. Wherever such values are unsigned, any requirement
in this International Standard to retrieve the sign shall produce an unspecified sign, and
any requirement to set the sign shall be ignored. </span></p>
</li>
</ol>
</div>
</div>
</div></div><div><br></div><div><br></div><br><blockquote type="cite"><br>On Mar 17, 2014, at 12:18 PM, Stellard, Thomas <<a href="mailto:Tom.Stellard@amd.com">Tom.Stellard@amd.com</a>> wrote:<br><br><blockquote type="cite">Hi Kevin,<br><br>I just saw your fix for this, I was about to do the same thing, so I've tested that change on my system and it works fine. I'm not sure why we get -nan on linux and nan on darwin.<br><br>-Tom<br>________________________________________<br>From: Kevin Enderby [<a href="mailto:enderby@apple.com">enderby@apple.com</a>]<br>Sent: Monday, March 17, 2014 2:30 PM<br>To: Stellard, Thomas<br>Cc: Kevin Enderby; <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>Subject: Re: [llvm] r204056 - R600/SI: Fix implementation of isInlineConstant() used by the verifier<br><br>Hi Tom,<br><br>We are seeing a build bot failure with CodeGen/R600/v_cndmask.ll in <a href="http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/13587/steps/run.llvm.tests/logs/stdio">http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/13587/steps/run.llvm.tests/logs/stdio</a><br><br>Could you please take a look?<br><br>The current build czar,<br>Kev<br><br><br>FAIL: LLVM :: CodeGen/R600/v_cndmask.ll (9845 of 17101)<br>******************** TEST 'LLVM :: CodeGen/R600/v_cndmask.ll' FAILED *************<br>*******<br>Script:<br>--<br>/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/Release+Asserts/bin/llc < /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/llvm/test/CodeGen/R600/v_cndmask.ll -march=r600 -mcpu=SI -verify-machineinstrs | /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/Release+Asserts/bin/FileCheck --check-prefix=SI /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/llvm/test/CodeGen/R600/v_cndmask.ll<br>--<br>Exit Code: 1<br><br>Command Output (stderr):<br>--<br>/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/llvm/test/CodeGen/R600/v_cndmask.ll:6:11: error: expected string not found in input<br>; SI-DAG: -nan<br> ^<br><stdin>:16:24: note: scanning from here<br>V_CNDMASK_B32_e64 v0, v0, nan, s[2:3], 0, 0, 0, 0<br> ^<br><stdin>:16:28: note: possible intended match here<br>V_CNDMASK_B32_e64 v0, v0, nan, s[2:3], 0, 0, 0, 0<br> ^<br><br>--<br>On Mar 17, 2014, at 10:03 AM, Tom Stellard <<a href="mailto:thomas.stellard@amd.com">thomas.stellard@amd.com</a>> wrote:<br><br><blockquote type="cite">Author: tstellar<br>Date: Mon Mar 17 12:03:52 2014<br>New Revision: 204056<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204056&view=rev">http://llvm.org/viewvc/llvm-project?rev=204056&view=rev</a><br>Log:<br>R600/SI: Fix implementation of isInlineConstant() used by the verifier<br><br>The type of the immediates should not matter as long as the encoding is<br>equivalent to the encoding of one of the legal inline constants.<br><br>Tested-by: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com">michel.daenzer@amd.com</a>><br><br>Added:<br> llvm/trunk/test/CodeGen/R600/v_cndmask.ll<br>Modified:<br> llvm/trunk/lib/Target/R600/SIInstrInfo.cpp<br><br>Modified: llvm/trunk/lib/Target/R600/SIInstrInfo.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstrInfo.cpp?rev=204056&r1=204055&r2=204056&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstrInfo.cpp?rev=204056&r1=204055&r2=204056&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Target/R600/SIInstrInfo.cpp (original)<br>+++ llvm/trunk/lib/Target/R600/SIInstrInfo.cpp Mon Mar 17 12:03:52 2014<br>@@ -349,21 +349,32 @@ bool SIInstrInfo::isSALUInstr(const Mach<br>}<br><br>bool SIInstrInfo::isInlineConstant(const MachineOperand &MO) const {<br>- if(MO.isImm()) {<br>- return MO.getImm() >= -16 && MO.getImm() <= 64;<br>- }<br>- if (MO.isFPImm()) {<br>- return MO.getFPImm()->isExactlyValue(0.0) ||<br>- MO.getFPImm()->isExactlyValue(0.5) ||<br>- MO.getFPImm()->isExactlyValue(-0.5) ||<br>- MO.getFPImm()->isExactlyValue(1.0) ||<br>- MO.getFPImm()->isExactlyValue(-1.0) ||<br>- MO.getFPImm()->isExactlyValue(2.0) ||<br>- MO.getFPImm()->isExactlyValue(-2.0) ||<br>- MO.getFPImm()->isExactlyValue(4.0) ||<br>- MO.getFPImm()->isExactlyValue(-4.0);<br>+<br>+ union {<br>+ int32_t I;<br>+ float F;<br>+ } Imm;<br>+<br>+ if (MO.isImm()) {<br>+ Imm.I = MO.getImm();<br>+ } else if (MO.isFPImm()) {<br>+ Imm.F = MO.getFPImm()->getValueAPF().convertToFloat();<br>+ } else {<br>+ return false;<br> }<br>- return false;<br>+<br>+ // The actual type of the operand does not seem to matter as long<br>+ // as the bits match one of the inline immediate values. For example:<br>+ //<br>+ // -nan has the hexadecimal encoding of 0xfffffffe which is -2 in decimal,<br>+ // so it is a legal inline immediate.<br>+ //<br>+ // 1065353216 has the hexadecimal encoding 0x3f800000 which is 1.0f in<br>+ // floating-point, so it is a legal inline immediate.<br>+ return (Imm.I >= -16 && Imm.I <= 64) ||<br>+ Imm.F == 0.0f || Imm.F == 0.5f || Imm.F == -0.5f || Imm.F == 1.0f ||<br>+ Imm.F == -1.0f || Imm.F == 2.0f || Imm.F == -2.0f || Imm.F == 4.0f ||<br>+ Imm.F == -4.0f;<br>}<br><br>bool SIInstrInfo::isLiteralConstant(const MachineOperand &MO) const {<br><br>Added: llvm/trunk/test/CodeGen/R600/v_cndmask.ll<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/v_cndmask.ll?rev=204056&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/R600/v_cndmask.ll?rev=204056&view=auto</a><br>==============================================================================<br>--- llvm/trunk/test/CodeGen/R600/v_cndmask.ll (added)<br>+++ llvm/trunk/test/CodeGen/R600/v_cndmask.ll Mon Mar 17 12:03:52 2014<br>@@ -0,0 +1,13 @@<br>+; RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=SI %s<br>+<br>+; SI: @v_cnd_nan<br>+; SI: V_CNDMASK_B32_e64 v{{[0-9]}},<br>+; SI-DAG: v{{[0-9]}}<br>+; SI-DAG: -nan<br>+define void @v_cnd_nan(float addrspace(1)* %out, i32 %c, float %f) {<br>+entry:<br>+ %0 = icmp ne i32 %c, 0<br>+ %1 = select i1 %0, float 0xFFFFFFFFE0000000, float %f<br>+ store float %1, float addrspace(1)* %out<br>+ ret void<br>+}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote><br><br><br></blockquote><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></body></html>