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

Side by Side Diff: tests_lit/llvm2ice_tests/nonsfi.ll

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/adv-switch-opt.ll ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=1 \
2 ; RUN: | FileCheck --check-prefix=NONSFI %s
3 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=0 \
4 ; RUN: | FileCheck --check-prefix=DEFAULT %s
5
6 @G1 = internal global [4 x i8] zeroinitializer, align 4
7 @G2 = internal global [4 x i8] zeroinitializer, align 4
8
9 define internal void @testCallRegular() {
10 entry:
11 call void @testCallRegular()
12 ret void
13 }
14 ; Expect a simple direct call to testCallRegular.
15 ; NONSFI-LABEL: testCallRegular
16 ; NONSFI: call {{.*}} R_386_PC32 testCallRegular
17 ; DEFAULT-LABEL: testCallRegular
18
19 define internal double @testCallBuiltin(double %val) {
20 entry:
21 %result = frem double %val, %val
22 ret double %result
23 }
24 ; Expect a simple direct call to fmod.
25 ; NONSFI-LABEL: testCallBuiltin
26 ; NONSFI: call {{.*}} R_386_PC32 fmod
27 ; DEFAULT-LABEL: testCallBuiltin
28
29 define internal i32 @testLoadBasic() {
30 entry:
31 %a = bitcast [4 x i8]* @G1 to i32*
32 %b = load i32, i32* %a, align 1
33 ret i32 %b
34 }
35 ; Expect a load with a R_386_GOTOFF relocation.
36 ; NONSFI-LABEL: testLoadBasic
37 ; NONSFI: mov {{.*}} R_386_GOTOFF G1
38 ; DEFAULT-LABEL: testLoadBasic
39
40 define internal i32 @testLoadFixedOffset() {
41 entry:
42 %a = ptrtoint [4 x i8]* @G1 to i32
43 %a1 = add i32 %a, 4
44 %a2 = inttoptr i32 %a1 to i32*
45 %b = load i32, i32* %a2, align 1
46 ret i32 %b
47 }
48 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset.
49 ; NONSFI-LABEL: testLoadFixedOffset
50 ; NONSFI: mov {{.*}}+0x4] {{.*}} R_386_GOTOFF G1
51 ; DEFAULT-LABEL: testLoadFixedOffset
52
53 define internal i32 @testLoadIndexed(i32 %idx) {
54 entry:
55 %a = ptrtoint [4 x i8]* @G1 to i32
56 %a0 = mul i32 %idx, 4
57 %a1 = add i32 %a0, 12
58 %a2 = add i32 %a1, %a
59 %a3 = inttoptr i32 %a2 to i32*
60 %b = load i32, i32* %a3, align 1
61 ret i32 %b
62 }
63 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, plus a
64 ; scaled index register.
65 ; NONSFI-LABEL: testLoadIndexed
66 ; NONSFI: mov {{.*}}*4+0xc] {{.*}} R_386_GOTOFF G1
67 ; DEFAULT-LABEL: testLoadIndexed
68
69 define internal i32 @testLoadIndexedBase(i32 %base, i32 %idx) {
70 entry:
71 %a = ptrtoint [4 x i8]* @G1 to i32
72 %a0 = mul i32 %idx, 4
73 %a1 = add i32 %a0, %base
74 %a2 = add i32 %a1, %a
75 %a3 = add i32 %a2, 12
76 %a4 = inttoptr i32 %a3 to i32*
77 %b = load i32, i32* %a4, align 1
78 ret i32 %b
79 }
80 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, but
81 ; without the scaled index.
82 ; NONSFI-LABEL: testLoadIndexedBase
83 ; NONSFI: mov {{.*}}*1+0xc] {{.*}} R_386_GOTOFF G1
84 ; By contrast, without -nonsfi, expect a load with a *R_386_32* relocation plus
85 ; an immediate offset, and *with* the scaled index.
86 ; DEFAULT-LABEL: testLoadIndexedBase
87 ; DEFAULT: mov {{.*}},DWORD PTR [{{.*}}+{{.*}}*4+0xc] {{.*}} R_386_32 G1
88
89 define internal i32 @testLoadOpt() {
90 entry:
91 %a = bitcast [4 x i8]* @G1 to i32*
92 %b = load i32, i32* %a, align 1
93 %c = bitcast [4 x i8]* @G2 to i32*
94 %d = load i32, i32* %c, align 1
95 %e = add i32 %b, %d
96 ret i32 %e
97 }
98 ; Expect a load-folding optimization with a R_386_GOTOFF relocation.
99 ; NONSFI-LABEL: testLoadOpt
100 ; NONSFI: mov [[REG:e..]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G1
101 ; NONSFI-NEXT: add [[REG]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G2
102 ; DEFAULT-LABEL: testLoadOpt
103
104 define internal void @testRMW() {
105 entry:
106 %a = bitcast [4 x i8]* @G1 to i32*
107 %b = load i32, i32* %a, align 1
108 %c = add i32 %b, 1234
109 store i32 %c, i32* %a, align 1
110 ret void
111 }
112 ; Expect an RMW optimization with a R_386_GOTOFF relocation.
113 ; NONSFI-LABEL: testRMW
114 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF G1
115 ; DEFAULT-LABEL: testRMW
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/adv-switch-opt.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698