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

Unified Diff: test/NaCl/X86/no-global-in-disp-x86-64.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « test/NaCl/X86/negative-addend.ll ('k') | test/NaCl/X86/pic-nacl-x8632.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/X86/no-global-in-disp-x86-64.ll
diff --git a/test/NaCl/X86/no-global-in-disp-x86-64.ll b/test/NaCl/X86/no-global-in-disp-x86-64.ll
new file mode 100644
index 0000000000000000000000000000000000000000..db911ccff9d6ceb3317e524c68b2dd94e7a5739f
--- /dev/null
+++ b/test/NaCl/X86/no-global-in-disp-x86-64.ll
@@ -0,0 +1,50 @@
+; RUN: pnacl-llc -O2 -mtriple=x86_64-none-nacl < %s | \
+; RUN: FileCheck %s --check-prefix=NACLON
+; RUN: pnacl-llc -O2 -mtriple=x86_64-linux < %s | \
+; RUN: FileCheck %s --check-prefix=NACLOFF
+
+; This test is derived from the following C code:
+;
+; int myglobal[100];
+; void test(int arg)
+; {
+; myglobal[arg] = arg;
+; myglobal[arg+1] = arg;
+; }
+; int main(int argc, char **argv)
+; {
+; test(argc);
+; }
+;
+; The goal is NOT to produce an instruction with "myglobal" as the
+; displacement value in any addressing mode, e.g. this (bad) instruction:
+;
+; movl %eax, %nacl:myglobal(%r15,%rax,4)
+;
+; The NACLOFF test is a canary that tries to ensure that the NACLON test is
+; testing the right thing. If the NACLOFF test starts failing, it's likely
+; that the LLVM -O2 optimizations are no longer generating the problematic
+; pattern that NACLON tests for. In that case, the test should be modified.
+
+
+@myglobal = global [100 x i32] zeroinitializer, align 4
+
+define void @test(i32 %arg) #0 {
+entry:
+; NACLON: test:
+; NACLON-NOT: mov{{.*}}nacl:myglobal(
+; NACLOFF: test:
+; NACLOFF: mov{{.*}}myglobal(
+ %arg.addr = alloca i32, align 4
+ store i32 %arg, i32* %arg.addr, align 4
+ %0 = load i32* %arg.addr, align 4
+ %1 = load i32* %arg.addr, align 4
+ %arrayidx = getelementptr inbounds [100 x i32]* @myglobal, i32 0, i32 %1
+ store i32 %0, i32* %arrayidx, align 4
+ %2 = load i32* %arg.addr, align 4
+ %3 = load i32* %arg.addr, align 4
+ %add = add nsw i32 %3, 1
+ %arrayidx1 = getelementptr inbounds [100 x i32]* @myglobal, i32 0, i32 %add
+ store i32 %2, i32* %arrayidx1, align 4
+ ret void
+}
« no previous file with comments | « test/NaCl/X86/negative-addend.ll ('k') | test/NaCl/X86/pic-nacl-x8632.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698