[llvm-bugs] [Bug 39079] New: Clang logs "hit!" when compiling sample code with smmintrin.h

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 25 15:05:02 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39079

            Bug ID: 39079
           Summary: Clang logs "hit!" when compiling sample code with
                    smmintrin.h
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vmpstr at chromium.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180925/aabce3d1/attachment.html>


More information about the llvm-bugs mailing list