<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Clang logs "hit!" when compiling sample code with smmintrin.h"
   href="https://bugs.llvm.org/show_bug.cgi?id=39079">39079</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang logs "hit!" when compiling sample code with smmintrin.h
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vmpstr@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Pardon me for the long example, I'm not too familiar with smmintrin. This is
coming from compiling Skia as a part of Chromium, I've tried to reduce the code
as much as I could. This is running on linux:

$ clang++ --version
clang version 8.0.0 (trunk 342523)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ clang++ -O2 -c test.cpp
hit!

$ cat test.cpp
#include <smmintrin.h>

class Sk2s {
public:
    Sk2s(const __m128& vec) : fVec(vec) {}

    Sk2s() {}
    Sk2s(float val) : fVec(_mm_set1_ps(val)) {}
    static Sk2s Load(const void* ptr) {
        return _mm_castsi128_ps(_mm_loadl_epi64((const __m128i*)ptr));
    }

    void store(void* ptr) const { _mm_storel_pi((__m64*)ptr, fVec); }

    Sk2s operator+(const Sk2s& o) const { return _mm_add_ps(fVec, o.fVec); }
    __m128 fVec;
};

struct SkPoint {
    float fX;
    float fY;
};

static inline SkPoint to_point(const Sk2s& x) {
    SkPoint point;
    x.store(&point);
    return point;
}

static inline Sk2s from_point(const SkPoint& point) { return
Sk2s::Load(&point); }

class SkConic {
public:
    void chop(SkConic* dst) const;
    SkPoint fPts[3];
};

void SkConic::chop(SkConic* dst) const {
    Sk2s p0 = from_point(fPts[0]);
    Sk2s p1 = from_point(fPts[1]);
    Sk2s p2 = from_point(fPts[2]);

    SkPoint mPt = to_point(p0);
    if (rand()) {
        mPt.fX = fPts[0].fX + fPts[1].fX + fPts[2].fX;
    }
    dst[0].fPts[0] = mPt;
    dst[0].fPts[1] = to_point(p0 + p1);
    dst[0].fPts[2] = mPt;
}


There seems to be "hit!" printed out to the console, which I don't think is
expected.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>