OLD | NEW |
1 ; This file checks support for address mode optimization. | 1 ; This file checks support for address mode optimization. |
2 | 2 |
3 ; RUN: %llvm2ice -O2 --verbose none %s \ | 3 ; RUN: %llvm2ice -O2 --verbose none %s \ |
4 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | 4 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ |
5 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 5 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s |
6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 6 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
7 | 7 |
8 define float @load_arg_plus_200000(float* %arg) { | 8 define float @load_arg_plus_200000(float* %arg) { |
9 entry: | 9 entry: |
10 %arg.int = ptrtoint float* %arg to i32 | 10 %arg.int = ptrtoint float* %arg to i32 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 %arg.int = ptrtoint float* %arg to i32 | 54 %arg.int = ptrtoint float* %arg to i32 |
55 %addr1.int = add i32 12, %arg.int | 55 %addr1.int = add i32 12, %arg.int |
56 %addr2.int = sub i32 %addr1.int, 4 | 56 %addr2.int = sub i32 %addr1.int, 4 |
57 %addr2.ptr = inttoptr i32 %addr2.int to float* | 57 %addr2.ptr = inttoptr i32 %addr2.int to float* |
58 %addr2.load = load float* %addr2.ptr, align 4 | 58 %addr2.load = load float* %addr2.ptr, align 4 |
59 ret float %addr2.load | 59 ret float %addr2.load |
60 ; CHECK-LABEL: address_mode_opt_chaining: | 60 ; CHECK-LABEL: address_mode_opt_chaining: |
61 ; CHECK: movss xmm0, dword ptr [eax + 8] | 61 ; CHECK: movss xmm0, dword ptr [eax + 8] |
62 } | 62 } |
63 | 63 |
| 64 define float @address_mode_opt_chaining_overflow(float* %arg) { |
| 65 entry: |
| 66 %arg.int = ptrtoint float* %arg to i32 |
| 67 %addr1.int = add i32 2147483640, %arg.int |
| 68 %addr2.int = add i32 %addr1.int, 2147483643 |
| 69 %addr2.ptr = inttoptr i32 %addr2.int to float* |
| 70 %addr2.load = load float* %addr2.ptr, align 4 |
| 71 ret float %addr2.load |
| 72 ; CHECK-LABEL: address_mode_opt_chaining_overflow: |
| 73 ; CHECK: 2147483640 |
| 74 ; CHECK: movss xmm0, dword ptr [{{.*}} + 2147483643] |
| 75 } |
| 76 |
| 77 define float @address_mode_opt_chaining_overflow_sub(float* %arg) { |
| 78 entry: |
| 79 %arg.int = ptrtoint float* %arg to i32 |
| 80 %addr1.int = sub i32 %arg.int, 2147483640 |
| 81 %addr2.int = sub i32 %addr1.int, 2147483643 |
| 82 %addr2.ptr = inttoptr i32 %addr2.int to float* |
| 83 %addr2.load = load float* %addr2.ptr, align 4 |
| 84 ret float %addr2.load |
| 85 ; CHECK-LABEL: address_mode_opt_chaining_overflow_sub: |
| 86 ; CHECK: 2147483640 |
| 87 ; CHECK: movss xmm0, dword ptr [{{.*}} - 2147483643] |
| 88 } |
| 89 |
| 90 define float @address_mode_opt_chaining_no_overflow(float* %arg) { |
| 91 entry: |
| 92 %arg.int = ptrtoint float* %arg to i32 |
| 93 %addr1.int = sub i32 %arg.int, 2147483640 |
| 94 %addr2.int = add i32 %addr1.int, 2147483643 |
| 95 %addr2.ptr = inttoptr i32 %addr2.int to float* |
| 96 %addr2.load = load float* %addr2.ptr, align 4 |
| 97 ret float %addr2.load |
| 98 ; CHECK-LABEL: address_mode_opt_chaining_no_overflow: |
| 99 ; CHECK: movss xmm0, dword ptr [{{.*}} + 3] |
| 100 } |
| 101 |
| 102 define float @address_mode_opt_add_pos_min_int(float* %arg) { |
| 103 entry: |
| 104 %arg.int = ptrtoint float* %arg to i32 |
| 105 %addr1.int = add i32 %arg.int, 2147483648 |
| 106 %addr1.ptr = inttoptr i32 %addr1.int to float* |
| 107 %addr1.load = load float* %addr1.ptr, align 4 |
| 108 ret float %addr1.load |
| 109 ; CHECK-LABEL: address_mode_opt_add_pos_min_int: |
| 110 ; CHECK: movss xmm0, dword ptr [{{.*}} - 2147483648] |
| 111 } |
| 112 |
| 113 define float @address_mode_opt_sub_min_int(float* %arg) { |
| 114 entry: |
| 115 %arg.int = ptrtoint float* %arg to i32 |
| 116 %addr1.int = sub i32 %arg.int, 2147483648 |
| 117 %addr1.ptr = inttoptr i32 %addr1.int to float* |
| 118 %addr1.load = load float* %addr1.ptr, align 4 |
| 119 ret float %addr1.load |
| 120 ; CHECK-LABEL: address_mode_opt_sub_min_int: |
| 121 ; CHECK: movss xmm0, dword ptr [{{.*}} - 2147483648] |
| 122 } |
| 123 |
| 124 |
| 125 |
64 ; ERRORS-NOT: ICE translation error | 126 ; ERRORS-NOT: ICE translation error |
OLD | NEW |