| 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 \ |
| 15 ; RUN: | FileCheck --check-prefix=CHECKO2UNSANDBOXED %s |
| 16 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 17 ; RUN: | FileCheck --check-prefix=CHECKO2UNSANDBOXEDREM %s |
| 10 | 18 |
| 11 ; RUN: %llvm2ice -O2 --verbose none %s \ | 19 ; RUN: %llvm2ice -O2 --verbose none %s \ |
| 12 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 20 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj |
| 13 ; RUN: %llvm2ice -Om1 --verbose none %s \ | 21 ; RUN: %llvm2ice -Om1 --verbose none %s \ |
| 14 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj | 22 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj |
| 15 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 23 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 16 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 24 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 17 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 25 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 18 ; RUN: | FileCheck --check-prefix=DUMP %s | 26 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 19 | 27 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 41 define i32 @test_nacl_read_tp() { | 49 define i32 @test_nacl_read_tp() { |
| 42 entry: | 50 entry: |
| 43 %ptr = call i8* @llvm.nacl.read.tp() | 51 %ptr = call i8* @llvm.nacl.read.tp() |
| 44 %__1 = ptrtoint i8* %ptr to i32 | 52 %__1 = ptrtoint i8* %ptr to i32 |
| 45 ret i32 %__1 | 53 ret i32 %__1 |
| 46 } | 54 } |
| 47 ; CHECK-LABEL: test_nacl_read_tp | 55 ; CHECK-LABEL: test_nacl_read_tp |
| 48 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 56 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
| 49 ; CHECKO2REM-LABEL: test_nacl_read_tp | 57 ; CHECKO2REM-LABEL: test_nacl_read_tp |
| 50 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 58 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
| 59 ; CHECKO2UNSANDBOXED-LABEL: test_nacl_read_tp |
| 60 ; CHECKO2UNSANDBOXED: call __nacl_read_tp |
| 61 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp |
| 62 ; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp |
| 51 | 63 |
| 52 define i32 @test_nacl_read_tp_more_addressing() { | 64 define i32 @test_nacl_read_tp_more_addressing() { |
| 53 entry: | 65 entry: |
| 54 %ptr = call i8* @llvm.nacl.read.tp() | 66 %ptr = call i8* @llvm.nacl.read.tp() |
| 55 %__1 = ptrtoint i8* %ptr to i32 | 67 %__1 = ptrtoint i8* %ptr to i32 |
| 56 %x = add i32 %__1, %__1 | 68 %x = add i32 %__1, %__1 |
| 57 %__3 = inttoptr i32 %x to i32* | 69 %__3 = inttoptr i32 %x to i32* |
| 58 %v = load i32* %__3, align 1 | 70 %v = load i32* %__3, align 1 |
| 59 %ptr2 = call i8* @llvm.nacl.read.tp() | 71 %ptr2 = call i8* @llvm.nacl.read.tp() |
| 60 %__6 = ptrtoint i8* %ptr2 to i32 | 72 %__6 = ptrtoint i8* %ptr2 to i32 |
| 61 %y = add i32 %__6, 4 | 73 %y = add i32 %__6, 4 |
| 62 %__8 = inttoptr i32 %y to i32* | 74 %__8 = inttoptr i32 %y to i32* |
| 63 store i32 %v, i32* %__8, align 1 | 75 store i32 %v, i32* %__8, align 1 |
| 64 ret i32 %v | 76 ret i32 %v |
| 65 } | 77 } |
| 66 ; CHECK-LABEL: test_nacl_read_tp_more_addressing | 78 ; CHECK-LABEL: test_nacl_read_tp_more_addressing |
| 67 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 79 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
| 68 ; CHECK: mov e{{.*}}, dword ptr gs:[0] | 80 ; CHECK: mov e{{.*}}, dword ptr gs:[0] |
| 69 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing | 81 ; CHECKO2REM-LABEL: test_nacl_read_tp_more_addressing |
| 70 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 82 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
| 71 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] | 83 ; CHECKO2REM: mov e{{.*}}, dword ptr gs:[0] |
| 84 ; CHECKO2UNSANDBOXED-LABEL: test_nacl_read_tp_more_addressing |
| 85 ; CHECKO2UNSANDBOXED: call __nacl_read_tp |
| 86 ; CHECKO2UNSANDBOXED: call __nacl_read_tp |
| 87 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_more_addressing |
| 88 ; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp |
| 89 ; CHECKO2UNSANDBOXEDREM: call __nacl_read_tp |
| 72 | 90 |
| 73 define i32 @test_nacl_read_tp_dead(i32 %a) { | 91 define i32 @test_nacl_read_tp_dead(i32 %a) { |
| 74 entry: | 92 entry: |
| 75 %ptr = call i8* @llvm.nacl.read.tp() | 93 %ptr = call i8* @llvm.nacl.read.tp() |
| 76 ; Not actually using the result of nacl read tp call. | 94 ; Not actually using the result of nacl read tp call. |
| 77 ; In O2 mode this should be DCE'ed. | 95 ; In O2 mode this should be DCE'ed. |
| 78 ret i32 %a | 96 ret i32 %a |
| 79 } | 97 } |
| 80 ; Consider nacl.read.tp side-effect free, so it can be eliminated. | 98 ; Consider nacl.read.tp side-effect free, so it can be eliminated. |
| 81 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead | 99 ; CHECKO2REM-LABEL: test_nacl_read_tp_dead |
| 82 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] | 100 ; CHECKO2REM-NOT: mov e{{.*}}, dword ptr gs:[0] |
| 101 ; CHECKO2UNSANDBOXEDREM-LABEL: test_nacl_read_tp_dead |
| 102 ; CHECKO2UNSANDBOXEDREM-NOT: call __nacl_read_tp |
| 83 | 103 |
| 84 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 104 define void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
| 85 entry: | 105 entry: |
| 86 %dst = inttoptr i32 %iptr_dst to i8* | 106 %dst = inttoptr i32 %iptr_dst to i8* |
| 87 %src = inttoptr i32 %iptr_src to i8* | 107 %src = inttoptr i32 %iptr_src to i8* |
| 88 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 108 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 89 i32 %len, i32 1, i1 0) | 109 i32 %len, i32 1, i1 0) |
| 90 ret void | 110 ret void |
| 91 } | 111 } |
| 92 ; CHECK-LABEL: test_memcpy | 112 ; CHECK-LABEL: test_memcpy |
| 93 ; CHECK: call memcpy | 113 ; CHECK: call memcpy |
| 114 ; CHECKO2REM-LABEL: test_memcpy |
| 115 ; CHECKO2UNSANDBOXEDREM-LABEL: test_memcpy |
| 94 | 116 |
| 95 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, | 117 ; TODO(jvoung) -- if we want to be clever, we can do this and the memmove, |
| 96 ; memset without a function call. | 118 ; memset without a function call. |
| 97 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { | 119 define void @test_memcpy_const_len_align(i32 %iptr_dst, i32 %iptr_src) { |
| 98 entry: | 120 entry: |
| 99 %dst = inttoptr i32 %iptr_dst to i8* | 121 %dst = inttoptr i32 %iptr_dst to i8* |
| 100 %src = inttoptr i32 %iptr_src to i8* | 122 %src = inttoptr i32 %iptr_src to i8* |
| 101 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 123 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 102 i32 8, i32 1, i1 0) | 124 i32 8, i32 1, i1 0) |
| 103 ret void | 125 ret void |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 478 } |
| 457 ; CHECK-LABEL: test_stacksave_multiple | 479 ; CHECK-LABEL: test_stacksave_multiple |
| 458 ; At least 3 copies of esp, but probably more from having to do the allocas. | 480 ; At least 3 copies of esp, but probably more from having to do the allocas. |
| 459 ; CHECK: mov {{.*}}, esp | 481 ; CHECK: mov {{.*}}, esp |
| 460 ; CHECK: mov {{.*}}, esp | 482 ; CHECK: mov {{.*}}, esp |
| 461 ; CHECK: mov {{.*}}, esp | 483 ; CHECK: mov {{.*}}, esp |
| 462 ; CHECK: mov esp, {{.*}} | 484 ; CHECK: mov esp, {{.*}} |
| 463 | 485 |
| 464 ; ERRORS-NOT: ICE translation error | 486 ; ERRORS-NOT: ICE translation error |
| 465 ; DUMP-NOT: SZ | 487 ; DUMP-NOT: SZ |
| OLD | NEW |