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

Unified Diff: tests_lit/llvm2ice_tests/randomize-immediates.ll

Issue 460233002: Subzero: Randomize immediates by constant blinding or pooling. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Comments round 1 Created 6 years, 4 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/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/llvm2ice_tests/randomize-immediates.ll
diff --git a/tests_lit/llvm2ice_tests/randomize-immediates.ll b/tests_lit/llvm2ice_tests/randomize-immediates.ll
new file mode 100644
index 0000000000000000000000000000000000000000..45a68f7047d68af3df727162829731817223c85a
--- /dev/null
+++ b/tests_lit/llvm2ice_tests/randomize-immediates.ll
@@ -0,0 +1,35 @@
+; This is a smoke test of constant blinding and constant pooling.
+
+; RUN: %llvm2ice -O2 -rng-seed=1 -randomize-immediates=constant-blinding %s \
+; RUN: | FileCheck %s --check-prefix=BLINDING
+; RUN: %llvm2ice -O2 -rng-seed=1 -randomize-immediates=constant-pooling %s \
+; RUN: | FileCheck %s --check-prefix=POOLING
+
+define i32 @add_arg_plus_200000(i32 %arg) {
+entry:
+ %res = add i32 200000, %arg
+ ret i32 %res
+; BLINDING-LABEL: add_arg_plus_200000:
+; BLINDING: mov [[REG:e[a-z]*]], 16807
+; BLINDING: xor [[REG]], 216295
+
+; POOLING-LABEL: add_arg_plus_200000:
+; POOLING: mov e{{[a-z]*}}, dword ptr [L$i32$0]
+}
+
+define float @load_arg_plus_200000(float* %arg) {
+entry:
+ %arg.int = ptrtoint float* %arg to i32
+ %addr.int = add i32 %arg.int, 200000
+ %addr.ptr = inttoptr i32 %addr.int to float*
+ %addr.load = load float* %addr.ptr, align 4
+ ret float %addr.load
+; BLINDING-LABEL: load_arg_plus_200000:
+; BLINDING: mov [[REG:e[a-z]*]], 282475249
+; BLINDING: xor [[REG]], 282408881
+; BLINDING: lea eax, dword ptr [eax+[[REG]]]
+
+; POOLING-LABEL: load_arg_plus_200000:
+; POOLING: mov [[REG:e[a-z]*]], dword ptr [L$i32$0]
+; POOLING: lea eax, dword ptr [eax+[[REG]]]
+}
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698