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

Unified Diff: crosstest/test_bitmanip_intrin.ll

Issue 390443005: Lower bitmanip intrinsics, assuming absence of BMI/SSE4.2 for now. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review Created 6 years, 5 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 | « crosstest/test_bitmanip.def ('k') | crosstest/test_bitmanip_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crosstest/test_bitmanip_intrin.ll
diff --git a/crosstest/test_bitmanip_intrin.ll b/crosstest/test_bitmanip_intrin.ll
new file mode 100644
index 0000000000000000000000000000000000000000..23df5382885ad720da478d12906847a26d8058fc
--- /dev/null
+++ b/crosstest/test_bitmanip_intrin.ll
@@ -0,0 +1,46 @@
+; Wrappers around the bit manipulation intrinsics, which use name mangling
+; for encoding the type in the name instead of plain "C" suffixes.
+; E.g., my_ctpop(unsigned long long) vs __builtin_popcountll(...)
+; Also, normalize the intrinsic to take a single parameter when there
+; can be two, as is the case for ctlz and cttz.
+
+target triple = "i686-pc-linux-gnu"
+
+declare i32 @llvm.ctlz.i32(i32, i1)
+declare i64 @llvm.ctlz.i64(i64, i1)
+
+declare i32 @llvm.cttz.i32(i32, i1)
+declare i64 @llvm.cttz.i64(i64, i1)
+
+declare i32 @llvm.ctpop.i32(i32)
+declare i64 @llvm.ctpop.i64(i64)
+
+define i32 @_Z7my_ctlzj(i32 %a) {
+ %x = call i32 @llvm.ctlz.i32(i32 %a, i1 0)
+ ret i32 %x
+}
+
+define i64 @_Z7my_ctlzy(i64 %a) {
+ %x = call i64 @llvm.ctlz.i64(i64 %a, i1 0)
+ ret i64 %x
+}
+
+define i32 @_Z7my_cttzj(i32 %a) {
+ %x = call i32 @llvm.cttz.i32(i32 %a, i1 0)
+ ret i32 %x
+}
+
+define i64 @_Z7my_cttzy(i64 %a) {
+ %x = call i64 @llvm.cttz.i64(i64 %a, i1 0)
+ ret i64 %x
+}
+
+define i32 @_Z8my_ctpopj(i32 %a) {
+ %x = call i32 @llvm.ctpop.i32(i32 %a)
+ ret i32 %x
+}
+
+define i64 @_Z8my_ctpopy(i64 %a) {
+ %x = call i64 @llvm.ctpop.i64(i64 %a)
+ ret i64 %x
+}
« no previous file with comments | « crosstest/test_bitmanip.def ('k') | crosstest/test_bitmanip_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698