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

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

Issue 1531623007: Add option to force filetype=asm for testing (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review fixes. Tighter ABI checks. 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
OLDNEW
1 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=1 \ 1 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=1 \
2 ; RUN: --ffunction-sections \
2 ; RUN: | FileCheck --check-prefix=NONSFI %s 3 ; RUN: | FileCheck --check-prefix=NONSFI %s
3 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=0 \ 4 ; RUN: %p2i -i %s --filetype=obj --assemble --disassemble --args -O2 -nonsfi=0 \
5 ; RUN: --ffunction-sections \
4 ; RUN: | FileCheck --check-prefix=DEFAULT %s 6 ; RUN: | FileCheck --check-prefix=DEFAULT %s
5 7
6 @G1 = internal global [4 x i8] zeroinitializer, align 4 8 @G1 = internal global [4 x i8] zeroinitializer, align 4
7 @G2 = internal global [4 x i8] zeroinitializer, align 4 9 @G2 = internal global [4 x i8] zeroinitializer, align 4
8 10
9 define internal void @testCallRegular() { 11 define internal void @testCallRegular() {
10 entry: 12 entry:
11 call void @testCallRegular() 13 call i32 @testLoadBasic()
Jim Stichnoth 2016/01/12 14:54:03 It would be helpful to add a comment here explaini
sehr 2016/01/12 19:01:19 Done.
12 ret void 14 ret void
13 } 15 }
14 ; Expect a simple direct call to testCallRegular. 16 ; Expect a simple direct call to testCallRegular.
15 ; NONSFI-LABEL: testCallRegular 17 ; NONSFI-LABEL: testCallRegular
16 ; NONSFI: call {{.*}} R_386_PC32 testCallRegular 18 ; NONSFI: call {{.*}} R_386_PC32 {{.*}}testLoadBasic
17 ; DEFAULT-LABEL: testCallRegular 19 ; DEFAULT-LABEL: testCallRegular
18 20
19 define internal double @testCallBuiltin(double %val) { 21 define internal double @testCallBuiltin(double %val) {
20 entry: 22 entry:
21 %result = frem double %val, %val 23 %result = frem double %val, %val
22 ret double %result 24 ret double %result
23 } 25 }
24 ; Expect a simple direct call to fmod. 26 ; Expect a simple direct call to fmod.
25 ; NONSFI-LABEL: testCallBuiltin 27 ; NONSFI-LABEL: testCallBuiltin
26 ; NONSFI: call {{.*}} R_386_PC32 fmod 28 ; NONSFI: call {{.*}} R_386_PC32 fmod
27 ; DEFAULT-LABEL: testCallBuiltin 29 ; DEFAULT-LABEL: testCallBuiltin
28 30
29 define internal i32 @testLoadBasic() { 31 define internal i32 @testLoadBasic() {
30 entry: 32 entry:
31 %a = bitcast [4 x i8]* @G1 to i32* 33 %a = bitcast [4 x i8]* @G1 to i32*
32 %b = load i32, i32* %a, align 1 34 %b = load i32, i32* %a, align 1
33 ret i32 %b 35 ret i32 %b
34 } 36 }
35 ; Expect a load with a R_386_GOTOFF relocation. 37 ; Expect a load with a R_386_GOTOFF relocation.
36 ; NONSFI-LABEL: testLoadBasic 38 ; NONSFI-LABEL: testLoadBasic
37 ; NONSFI: mov {{.*}} R_386_GOTOFF G1 39 ; NONSFI: mov {{.*}} R_386_GOTOFF {{G1|.bss}}
38 ; DEFAULT-LABEL: testLoadBasic 40 ; DEFAULT-LABEL: testLoadBasic
39 41
40 define internal i32 @testLoadFixedOffset() { 42 define internal i32 @testLoadFixedOffset() {
41 entry: 43 entry:
42 %a = ptrtoint [4 x i8]* @G1 to i32 44 %a = ptrtoint [4 x i8]* @G1 to i32
43 %a1 = add i32 %a, 4 45 %a1 = add i32 %a, 4
44 %a2 = inttoptr i32 %a1 to i32* 46 %a2 = inttoptr i32 %a1 to i32*
45 %b = load i32, i32* %a2, align 1 47 %b = load i32, i32* %a2, align 1
46 ret i32 %b 48 ret i32 %b
47 } 49 }
48 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset. 50 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset.
49 ; NONSFI-LABEL: testLoadFixedOffset 51 ; NONSFI-LABEL: testLoadFixedOffset
50 ; NONSFI: mov {{.*}}+0x4] {{.*}} R_386_GOTOFF G1 52 ; NONSFI: mov {{.*}}+0x4] {{.*}} R_386_GOTOFF {{G1|.bss}}
51 ; DEFAULT-LABEL: testLoadFixedOffset 53 ; DEFAULT-LABEL: testLoadFixedOffset
52 54
53 define internal i32 @testLoadIndexed(i32 %idx) { 55 define internal i32 @testLoadIndexed(i32 %idx) {
54 entry: 56 entry:
55 %a = ptrtoint [4 x i8]* @G1 to i32 57 %a = ptrtoint [4 x i8]* @G1 to i32
56 %a0 = mul i32 %idx, 4 58 %a0 = mul i32 %idx, 4
57 %a1 = add i32 %a0, 12 59 %a1 = add i32 %a0, 12
58 %a2 = add i32 %a1, %a 60 %a2 = add i32 %a1, %a
59 %a3 = inttoptr i32 %a2 to i32* 61 %a3 = inttoptr i32 %a2 to i32*
60 %b = load i32, i32* %a3, align 1 62 %b = load i32, i32* %a3, align 1
61 ret i32 %b 63 ret i32 %b
62 } 64 }
63 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, plus a 65 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, plus a
64 ; scaled index register. 66 ; scaled index register.
65 ; NONSFI-LABEL: testLoadIndexed 67 ; NONSFI-LABEL: testLoadIndexed
66 ; NONSFI: mov {{.*}}*4+0xc] {{.*}} R_386_GOTOFF G1 68 ; NONSFI: mov {{.*}}*4+0xc] {{.*}} R_386_GOTOFF {{G1|.bss}}
67 ; DEFAULT-LABEL: testLoadIndexed 69 ; DEFAULT-LABEL: testLoadIndexed
68 70
69 define internal i32 @testLoadIndexedBase(i32 %base, i32 %idx) { 71 define internal i32 @testLoadIndexedBase(i32 %base, i32 %idx) {
70 entry: 72 entry:
71 %a = ptrtoint [4 x i8]* @G1 to i32 73 %a = ptrtoint [4 x i8]* @G1 to i32
72 %a0 = mul i32 %idx, 4 74 %a0 = mul i32 %idx, 4
73 %a1 = add i32 %a0, %base 75 %a1 = add i32 %a0, %base
74 %a2 = add i32 %a1, %a 76 %a2 = add i32 %a1, %a
75 %a3 = add i32 %a2, 12 77 %a3 = add i32 %a2, 12
76 %a4 = inttoptr i32 %a3 to i32* 78 %a4 = inttoptr i32 %a3 to i32*
77 %b = load i32, i32* %a4, align 1 79 %b = load i32, i32* %a4, align 1
78 ret i32 %b 80 ret i32 %b
79 } 81 }
80 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, but 82 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, but
81 ; without the scaled index. 83 ; without the scaled index.
82 ; NONSFI-LABEL: testLoadIndexedBase 84 ; NONSFI-LABEL: testLoadIndexedBase
83 ; NONSFI: mov {{.*}}*1+0xc] {{.*}} R_386_GOTOFF G1 85 ; NONSFI: mov {{.*}}*1+0xc] {{.*}} R_386_GOTOFF {{G1|.bss}}
84 ; By contrast, without -nonsfi, expect a load with a *R_386_32* relocation plus 86 ; By contrast, without -nonsfi, expect a load with a *R_386_32* relocation plus
85 ; an immediate offset, and *with* the scaled index. 87 ; an immediate offset, and *with* the scaled index.
86 ; DEFAULT-LABEL: testLoadIndexedBase 88 ; DEFAULT-LABEL: testLoadIndexedBase
87 ; DEFAULT: mov {{.*}},DWORD PTR [{{.*}}+{{.*}}*4+0xc] {{.*}} R_386_32 G1 89 ; DEFAULT: mov {{.*}},DWORD PTR [{{.*}}+{{.*}}*4+0xc] {{.*}} R_386_32 {{G1|.bss} }
88 90
89 define internal i32 @testLoadOpt() { 91 define internal i32 @testLoadOpt() {
90 entry: 92 entry:
91 %a = bitcast [4 x i8]* @G1 to i32* 93 %a = bitcast [4 x i8]* @G1 to i32*
92 %b = load i32, i32* %a, align 1 94 %b = load i32, i32* %a, align 1
93 %c = bitcast [4 x i8]* @G2 to i32* 95 %c = bitcast [4 x i8]* @G2 to i32*
94 %d = load i32, i32* %c, align 1 96 %d = load i32, i32* %c, align 1
95 %e = add i32 %b, %d 97 %e = add i32 %b, %d
96 ret i32 %e 98 ret i32 %e
97 } 99 }
98 ; Expect a load-folding optimization with a R_386_GOTOFF relocation. 100 ; Expect a load-folding optimization with a R_386_GOTOFF relocation.
99 ; NONSFI-LABEL: testLoadOpt 101 ; NONSFI-LABEL: testLoadOpt
100 ; NONSFI: mov [[REG:e..]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G1 102 ; NONSFI: mov [[REG:e..]],{{.*}}+0x0] {{.*}} R_386_GOTOFF {{G1|.bss}}
101 ; NONSFI-NEXT: add [[REG]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G2 103 ; NONSFI-NEXT: add [[REG]],{{.*}}+0x{{0|4}}] {{.*}} R_386_GOTOFF {{G2|.bss}}
102 ; DEFAULT-LABEL: testLoadOpt 104 ; DEFAULT-LABEL: testLoadOpt
103 105
104 define internal void @testRMW() { 106 define internal void @testRMW() {
105 entry: 107 entry:
106 %a = bitcast [4 x i8]* @G1 to i32* 108 %a = bitcast [4 x i8]* @G1 to i32*
107 %b = load i32, i32* %a, align 1 109 %b = load i32, i32* %a, align 1
108 %c = add i32 %b, 1234 110 %c = add i32 %b, 1234
109 store i32 %c, i32* %a, align 1 111 store i32 %c, i32* %a, align 1
110 ret void 112 ret void
111 } 113 }
112 ; Expect an RMW optimization with a R_386_GOTOFF relocation. 114 ; Expect an RMW optimization with a R_386_GOTOFF relocation.
113 ; NONSFI-LABEL: testRMW 115 ; NONSFI-LABEL: testRMW
114 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF G1 116 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF {{G1|.bss}}
115 ; DEFAULT-LABEL: testRMW 117 ; DEFAULT-LABEL: testRMW
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698