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