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

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: Function parameters are now pnacl abi compliant. 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 ; Make a call to a *different* function, plus use -ffunction-sections, to
14 ; force an appropriately-named relocation.
15 call i32 @testLoadBasic()
12 ret void 16 ret void
13 } 17 }
14 ; Expect a simple direct call to testCallRegular. 18 ; Expect a simple direct call to testCallRegular.
15 ; NONSFI-LABEL: testCallRegular 19 ; NONSFI-LABEL: testCallRegular
16 ; NONSFI: call {{.*}} R_386_PC32 testCallRegular 20 ; NONSFI: call {{.*}} R_386_PC32 {{.*}}testLoadBasic
17 ; DEFAULT-LABEL: testCallRegular 21 ; DEFAULT-LABEL: testCallRegular
18 22
19 define internal double @testCallBuiltin(double %val) { 23 define internal double @testCallBuiltin(double %val) {
20 entry: 24 entry:
21 %result = frem double %val, %val 25 %result = frem double %val, %val
22 ret double %result 26 ret double %result
23 } 27 }
24 ; Expect a simple direct call to fmod. 28 ; Expect a simple direct call to fmod.
25 ; NONSFI-LABEL: testCallBuiltin 29 ; NONSFI-LABEL: testCallBuiltin
26 ; NONSFI: call {{.*}} R_386_PC32 fmod 30 ; NONSFI: call {{.*}} R_386_PC32 fmod
27 ; DEFAULT-LABEL: testCallBuiltin 31 ; DEFAULT-LABEL: testCallBuiltin
28 32
29 define internal i32 @testLoadBasic() { 33 define internal i32 @testLoadBasic() {
30 entry: 34 entry:
31 %a = bitcast [4 x i8]* @G1 to i32* 35 %a = bitcast [4 x i8]* @G1 to i32*
32 %b = load i32, i32* %a, align 1 36 %b = load i32, i32* %a, align 1
33 ret i32 %b 37 ret i32 %b
34 } 38 }
35 ; Expect a load with a R_386_GOTOFF relocation. 39 ; Expect a load with a R_386_GOTOFF relocation.
36 ; NONSFI-LABEL: testLoadBasic 40 ; NONSFI-LABEL: testLoadBasic
37 ; NONSFI: mov {{.*}} R_386_GOTOFF G1 41 ; NONSFI: mov {{.*}} R_386_GOTOFF {{G1|.bss}}
38 ; DEFAULT-LABEL: testLoadBasic 42 ; DEFAULT-LABEL: testLoadBasic
39 43
40 define internal i32 @testLoadFixedOffset() { 44 define internal i32 @testLoadFixedOffset() {
41 entry: 45 entry:
42 %a = ptrtoint [4 x i8]* @G1 to i32 46 %a = ptrtoint [4 x i8]* @G1 to i32
43 %a1 = add i32 %a, 4 47 %a1 = add i32 %a, 4
44 %a2 = inttoptr i32 %a1 to i32* 48 %a2 = inttoptr i32 %a1 to i32*
45 %b = load i32, i32* %a2, align 1 49 %b = load i32, i32* %a2, align 1
46 ret i32 %b 50 ret i32 %b
47 } 51 }
48 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset. 52 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset.
49 ; NONSFI-LABEL: testLoadFixedOffset 53 ; NONSFI-LABEL: testLoadFixedOffset
50 ; NONSFI: mov {{.*}}+0x4] {{.*}} R_386_GOTOFF G1 54 ; NONSFI: mov {{.*}}+0x4] {{.*}} R_386_GOTOFF {{G1|.bss}}
51 ; DEFAULT-LABEL: testLoadFixedOffset 55 ; DEFAULT-LABEL: testLoadFixedOffset
52 56
53 define internal i32 @testLoadIndexed(i32 %idx) { 57 define internal i32 @testLoadIndexed(i32 %idx) {
54 entry: 58 entry:
55 %a = ptrtoint [4 x i8]* @G1 to i32 59 %a = ptrtoint [4 x i8]* @G1 to i32
56 %a0 = mul i32 %idx, 4 60 %a0 = mul i32 %idx, 4
57 %a1 = add i32 %a0, 12 61 %a1 = add i32 %a0, 12
58 %a2 = add i32 %a1, %a 62 %a2 = add i32 %a1, %a
59 %a3 = inttoptr i32 %a2 to i32* 63 %a3 = inttoptr i32 %a2 to i32*
60 %b = load i32, i32* %a3, align 1 64 %b = load i32, i32* %a3, align 1
61 ret i32 %b 65 ret i32 %b
62 } 66 }
63 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, plus a 67 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, plus a
64 ; scaled index register. 68 ; scaled index register.
65 ; NONSFI-LABEL: testLoadIndexed 69 ; NONSFI-LABEL: testLoadIndexed
66 ; NONSFI: mov {{.*}}*4+0xc] {{.*}} R_386_GOTOFF G1 70 ; NONSFI: mov {{.*}}*4+0xc] {{.*}} R_386_GOTOFF {{G1|.bss}}
67 ; DEFAULT-LABEL: testLoadIndexed 71 ; DEFAULT-LABEL: testLoadIndexed
68 72
69 define internal i32 @testLoadIndexedBase(i32 %base, i32 %idx) { 73 define internal i32 @testLoadIndexedBase(i32 %base, i32 %idx) {
70 entry: 74 entry:
71 %a = ptrtoint [4 x i8]* @G1 to i32 75 %a = ptrtoint [4 x i8]* @G1 to i32
72 %a0 = mul i32 %idx, 4 76 %a0 = mul i32 %idx, 4
73 %a1 = add i32 %a0, %base 77 %a1 = add i32 %a0, %base
74 %a2 = add i32 %a1, %a 78 %a2 = add i32 %a1, %a
75 %a3 = add i32 %a2, 12 79 %a3 = add i32 %a2, 12
76 %a4 = inttoptr i32 %a3 to i32* 80 %a4 = inttoptr i32 %a3 to i32*
77 %b = load i32, i32* %a4, align 1 81 %b = load i32, i32* %a4, align 1
78 ret i32 %b 82 ret i32 %b
79 } 83 }
80 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, but 84 ; Expect a load with a R_386_GOTOFF relocation plus an immediate offset, but
81 ; without the scaled index. 85 ; without the scaled index.
82 ; NONSFI-LABEL: testLoadIndexedBase 86 ; NONSFI-LABEL: testLoadIndexedBase
83 ; NONSFI: mov {{.*}}*1+0xc] {{.*}} R_386_GOTOFF G1 87 ; NONSFI: mov {{.*}}*1+0xc] {{.*}} R_386_GOTOFF {{G1|.bss}}
84 ; By contrast, without -nonsfi, expect a load with a *R_386_32* relocation plus 88 ; By contrast, without -nonsfi, expect a load with a *R_386_32* relocation plus
85 ; an immediate offset, and *with* the scaled index. 89 ; an immediate offset, and *with* the scaled index.
86 ; DEFAULT-LABEL: testLoadIndexedBase 90 ; DEFAULT-LABEL: testLoadIndexedBase
87 ; DEFAULT: mov {{.*}},DWORD PTR [{{.*}}+{{.*}}*4+0xc] {{.*}} R_386_32 G1 91 ; DEFAULT: mov {{.*}},DWORD PTR [{{.*}}+{{.*}}*4+0xc] {{.*}} R_386_32 {{G1|.bss} }
88 92
89 define internal i32 @testLoadOpt() { 93 define internal i32 @testLoadOpt() {
90 entry: 94 entry:
91 %a = bitcast [4 x i8]* @G1 to i32* 95 %a = bitcast [4 x i8]* @G1 to i32*
92 %b = load i32, i32* %a, align 1 96 %b = load i32, i32* %a, align 1
93 %c = bitcast [4 x i8]* @G2 to i32* 97 %c = bitcast [4 x i8]* @G2 to i32*
94 %d = load i32, i32* %c, align 1 98 %d = load i32, i32* %c, align 1
95 %e = add i32 %b, %d 99 %e = add i32 %b, %d
96 ret i32 %e 100 ret i32 %e
97 } 101 }
98 ; Expect a load-folding optimization with a R_386_GOTOFF relocation. 102 ; Expect a load-folding optimization with a R_386_GOTOFF relocation.
99 ; NONSFI-LABEL: testLoadOpt 103 ; NONSFI-LABEL: testLoadOpt
100 ; NONSFI: mov [[REG:e..]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G1 104 ; NONSFI: mov [[REG:e..]],{{.*}}+0x0] {{.*}} R_386_GOTOFF {{G1|.bss}}
101 ; NONSFI-NEXT: add [[REG]],{{.*}}+0x0] {{.*}} R_386_GOTOFF G2 105 ; NONSFI-NEXT: add [[REG]],{{.*}}+0x{{0|4}}] {{.*}} R_386_GOTOFF {{G2|.bss}}
102 ; DEFAULT-LABEL: testLoadOpt 106 ; DEFAULT-LABEL: testLoadOpt
103 107
104 define internal void @testRMW() { 108 define internal void @testRMW() {
105 entry: 109 entry:
106 %a = bitcast [4 x i8]* @G1 to i32* 110 %a = bitcast [4 x i8]* @G1 to i32*
107 %b = load i32, i32* %a, align 1 111 %b = load i32, i32* %a, align 1
108 %c = add i32 %b, 1234 112 %c = add i32 %b, 1234
109 store i32 %c, i32* %a, align 1 113 store i32 %c, i32* %a, align 1
110 ret void 114 ret void
111 } 115 }
112 ; Expect an RMW optimization with a R_386_GOTOFF relocation. 116 ; Expect an RMW optimization with a R_386_GOTOFF relocation.
113 ; NONSFI-LABEL: testRMW 117 ; NONSFI-LABEL: testRMW
114 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF G1 118 ; NONSFI: add DWORD PTR {{.*}}+0x0],0x4d2 {{.*}} R_386_GOTOFF {{G1|.bss}}
115 ; DEFAULT-LABEL: testRMW 119 ; DEFAULT-LABEL: testRMW
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698