Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Unified Diff: src/opts/SkNx_neon.h

Issue 1059743002: Use switch operator[](int) to kth<int>() so we can use vget_lane. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPMFloat.h ('k') | src/opts/SkNx_sse.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkNx_neon.h
diff --git a/src/opts/SkNx_neon.h b/src/opts/SkNx_neon.h
index 01ea67c5d7a2211ddf8612d2b68e1cec0d022999..c8580bca5a4a0fd23b7e6baf4bf7cdf0a0db7c0c 100644
--- a/src/opts/SkNx_neon.h
+++ b/src/opts/SkNx_neon.h
@@ -16,8 +16,8 @@ public:
SkNi(int32x2_t vec) : fVec(vec) {}
SkNi() {}
- bool allTrue() const { return fVec[0] && fVec[1]; }
- bool anyTrue() const { return fVec[0] || fVec[1]; }
+ bool allTrue() const { return vget_lane_s32(fVec, 0) && vget_lane_s32(fVec, 1); }
+ bool anyTrue() const { return vget_lane_s32(fVec, 0) || vget_lane_s32(fVec, 1); }
private:
int32x2_t fVec;
};
@@ -28,8 +28,10 @@ public:
SkNi(int32x4_t vec) : fVec(vec) {}
SkNi() {}
- bool allTrue() const { return fVec[0] && fVec[1] && fVec[2] && fVec[3]; }
- bool anyTrue() const { return fVec[0] || fVec[1] || fVec[2] || fVec[3]; }
+ bool allTrue() const { return vgetq_lane_s32(fVec, 0) && vgetq_lane_s32(fVec, 1)
+ && vgetq_lane_s32(fVec, 2) && vgetq_lane_s32(fVec, 3); }
+ bool anyTrue() const { return vgetq_lane_s32(fVec, 0) || vgetq_lane_s32(fVec, 1)
+ || vgetq_lane_s32(fVec, 2) || vgetq_lane_s32(fVec, 3); }
private:
int32x4_t fVec;
};
@@ -98,9 +100,9 @@ public:
#endif
}
- float operator[] (int k) const {
+ template <int k> float kth() const {
SkASSERT(0 <= k && k < 2);
- return fVec[k];
+ return vget_lane_f32(fVec, k&1);
}
private:
@@ -114,8 +116,8 @@ public:
SkNi(int64x2_t vec) : fVec(vec) {}
SkNi() {}
- bool allTrue() const { return fVec[0] && fVec[1]; }
- bool anyTrue() const { return fVec[0] || fVec[1]; }
+ bool allTrue() const { return vgetq_lane_s64(fVec, 0) && vgetq_lane_s64(fVec, 1); }
+ bool anyTrue() const { return vgetq_lane_s64(fVec, 0) || vgetq_lane_s64(fVec, 1); }
private:
int64x2_t fVec;
};
@@ -170,9 +172,9 @@ public:
return est3;
}
- double operator[] (int k) const {
+ template <int k> double kth() const {
SkASSERT(0 <= k && k < 2);
- return fVec[k];
+ return vgetq_lane_f64(fVec, k&1);
}
private:
@@ -245,9 +247,9 @@ public:
#endif
}
- float operator[] (int k) const {
+ template <int k> float kth() const {
SkASSERT(0 <= k && k < 4);
- return fVec[k];
+ return vgetq_lane_f32(fVec, k&3);
}
private:
« no previous file with comments | « src/core/SkPMFloat.h ('k') | src/opts/SkNx_sse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698