OLD | NEW |
---|---|
1 ; This tests the NaCl intrinsics not related to atomic operations. | 1 ; This tests the NaCl intrinsics not related to atomic operations. |
2 | 2 |
3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s | 3 ; RUN: %llvm2ice -O2 --verbose none -sandbox %s | FileCheck %s |
4 ; RUN: %llvm2ice -Om1 --verbose none %s | FileCheck %s | 4 ; RUN: %llvm2ice -Om1 --verbose none -sandbox %s | FileCheck %s |
5 | 5 |
6 ; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1 | 6 ; Do another run w/ O2 and a different check-prefix (otherwise O2 and Om1 |
7 ; share the same "CHECK" prefix). This separate run helps check that | 7 ; share the same "CHECK" prefix). This separate run helps check that |
8 ; some code is optimized out. | 8 ; some code is optimized out. |
9 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s --check-prefix=CHECKO2REM | 9 ; RUN: %llvm2ice -O2 --verbose none -sandbox %s \ |
10 ; RUN: | FileCheck %s --check-prefix=CHECKO2REM | |
11 | |
12 ; Do O2 runs without -sandbox to make sure llvm.nacl.read.tp gets | |
13 ; lowered to __nacl_read_tp instead of gs:[0x0]. | |
14 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck --check-prefix=CHECKO2U %s | |
15 ; RUN: %llvm2ice -O2 --verbose none %s \ | |
16 ; RUN: | FileCheck --check-prefix=CHECKO2UREM %s | |
10 | 17 |
11 ; RUN: %llvm2ice -O2 --verbose none %s \ | 18 ; RUN: %llvm2ice -O2 --verbose none %s \ |
12 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 19 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj |
13 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 20 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
14 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 21 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj |
15 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 22 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
16 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 23 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
17 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 24 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
18 ; RUN: | FileCheck --check-prefix=DUMP %s | 25 ; RUN: | FileCheck --check-prefix=DUMP %s |
19 | 26 |
(...skipping 21 matching lines...) Expand all Loading... | |
41 define i32 @test_nacl_read_tp() { | 48 define i32 @test_nacl_read_tp() { |
42 entry: | 49 entry: |
43 %ptr = call i8* @llvm.nacl.read.tp() | 50 %ptr = call i8* @llvm.nacl.read.tp() |
44 %__1 = ptrtoint i8* %ptr to i32 | 51 %__1 = ptrtoint i8* %ptr to i32 |
45 ret i32 %__1 | 52 ret i32 %__1 |
46 } | 53 } |
47 ; CHECK-LABEL: test_nacl_read_tp | 54 ; CHECK-LABEL: test_nacl_read_tp |
48 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 55 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
49 ; CHECKO2REM-LABEL: test_nacl_read_tp | 56 ; CHECKO2REM-LABEL: test_nacl_read_tp |
50 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 57 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
58 ; CHECKO2U-LABEL: test_nacl_read_tp | |
59 ; CHECKO2U: call __nacl_read_tp | |
60 ; CHECKO2UREM-LABEL: test_nacl_read_tp | |
61 ; CHECKO2UREM: call __nacl_read_tp | |
51 | 62 |
52 define i32 @test_nacl_read_tp_more_addressing() { | 63 define i32 @test_nacl_read_tp_more_addressing() { |
53 entry: | 64 entry: |
54 %ptr = call i8* @llvm.nacl.read.tp() | 65 %ptr = call i8* @llvm.nacl.read.tp() |
55 %__1 = ptrtoint i8* %ptr to i32 | 66 %__1 = ptrtoint i8* %ptr to i32 |
56 %x = add i32 %__1, %__1 | 67 %x = add i32 %__1, %__1 |
57 %__3 = inttoptr i32 %x to i32* | 68 %__3 = inttoptr i32 %x to i32* |
58 %v = load i32* %__3, align 1 | 69 %v = load i32* %__3, align 1 |
59 %ptr2 = call i8* @llvm.nacl.read.tp() | 70 %ptr2 = call i8* @llvm.nacl.read.tp() |
60 %__6 = ptrtoint i8* %ptr2 to i32 | 71 %__6 = ptrtoint i8* %ptr2 to i32 |
61 %y = add i32 %__6, 4 | 72 %y = add i32 %__6, 4 |
62 %__8 = inttoptr i32 %y to i32* | 73 %__8 = inttoptr i32 %y to i32* |
63 store i32 %v, i32* %__8, align 1 | 74 store i32 %v, i32* %__8, align 1 |
64 ret i32 %v | 75 ret i32 %v |
65 } | 76 } |
66 ; CHECK-LABEL: test_nacl_read_tp_more_addressing | 77 ; CHECK-LABEL: test_nacl_read_tp_more_addressing |
67 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 78 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
68 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 79 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
69 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing | 80 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing |
70 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 81 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
71 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 82 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
83 ; CHECKO2U-LABEL: test_nacl_read_tp_more_addressing | |
84 ; CHECKO2U: call __nacl_read_tp | |
85 ; CHECKO2U: call __nacl_read_tp | |
86 ; CHECKO2UREM-LABEL: test_nacl_read_tp_more_addressing | |
87 ; CHECKO2UREM: call __nacl_read_tp | |
88 ; CHECKO2UREM: call __nacl_read_tp | |
72 | 89 |
73 define i32 @test_nacl_read_tp_dead(i32 %a) { | 90 define i32 @test_nacl_read_tp_dead(i32 %a) { |
74 entry: | 91 entry: |
75 %ptr = call i8* @llvm.nacl.read.tp() | 92 %ptr = call i8* @llvm.nacl.read.tp() |
76 ; Not actually using the result of nacl read tp call. | 93 ; Not actually using the result of nacl read tp call. |
77 ; In O2 mode this should be DCE'ed. | 94 ; In O2 mode this should be DCE'ed. |
78 ret i32 %a | 95 ret i32 %a |
79 } | 96 } |
80 ; Consider nacl.read.tp side-effect free, so it can be eliminated. | 97 ; Consider nacl.read.tp side-effect free, so it can be eliminated. |
81 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead | 98 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead |
82 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] | 99 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] |
100 ; CHECKO2UREM-LABEL: test_nacl_read_tp_dead | |
101 ; CHECKO2UREM-NOT: call __nacl_read_tp | |
83 | 102 |
84 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 103 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
85 entry: | 104 entry: |
86 %dst = inttoptr i32 %iptr_dst to i8* | 105 %dst = inttoptr i32 %iptr_dst to i8* |
87 %src = inttoptr i32 %iptr_src to i8* | 106 %src = inttoptr i32 %iptr_src to i8* |
88 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 107 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
89 i32 %len, i32 1, i1 0) | 108 i32 %len, i32 1, i1 0) |
90 ret void | 109 ret void |
91 } | 110 } |
92 ; CHECK-LABEL: test_memcpy | 111 ; CHECK-LABEL: test_memcpy |
93 ; CHECK: call memcpy | 112 ; CHECK: call memcpy |
113 ; CHECKO2UREM-LABEL: test_memcpy | |
jvoung (off chromium)
2014/08/25 21:01:34
I guess I should have added a CHECKO2REM-LABEL her
Jim Stichnoth
2014/08/25 21:32:09
Ah right, I went ahead and added that.
Also, fixe
| |
94 | 114 |
95 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, | 115 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, |
96 ; memset without a function call. | 116 ; memset without a function call. |
97 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { | 117 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { |
98 entry: | 118 entry: |
99 %dst = inttoptr i32 %iptr_dst to i8* | 119 %dst = inttoptr i32 %iptr_dst to i8* |
100 %src = inttoptr i32 %iptr_src to i8* | 120 %src = inttoptr i32 %iptr_src to i8* |
101 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 121 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
102 i32 8, i32 1, i1 0) | 122 i32 8, i32 1, i1 0) |
103 ret void | 123 ret void |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 } | 476 } |
457 ; CHECK-LABEL: test_stacksave_multiple | 477 ; CHECK-LABEL: test_stacksave_multiple |
458 ; At least 3 copies of esp, but probably more from having to do the allocas. | 478 ; At least 3 copies of esp, but probably more from having to do the allocas. |
459 ; CHECK: mov {{.*}}, esp | 479 ; CHECK: mov {{.*}}, esp |
460 ; CHECK: mov {{.*}}, esp | 480 ; CHECK: mov {{.*}}, esp |
461 ; CHECK: mov {{.*}}, esp | 481 ; CHECK: mov {{.*}}, esp |
462 ; CHECK: mov esp, {{.*}} | 482 ; CHECK: mov esp, {{.*}} |
463 | 483 |
464 ; ERRORS-NOT: ICE translation error | 484 ; ERRORS-NOT: ICE translation error |
465 ; DUMP-NOT: SZ | 485 ; DUMP-NOT: SZ |
OLD | NEW |