| OLD | NEW |
| 1 ; Tests basics and corner cases of x86-32 sandboxing, using -Om1 in | 1 ; Tests basics and corner cases of x86-32 sandboxing, using -Om1 in |
| 2 ; the hope that the output will remain stable. When packing bundles, | 2 ; the hope that the output will remain stable. When packing bundles, |
| 3 ; we try to limit to a few instructions with well known sizes and | 3 ; we try to limit to a few instructions with well known sizes and |
| 4 ; minimal use of registers and stack slots in the lowering sequence. | 4 ; minimal use of registers and stack slots in the lowering sequence. |
| 5 | 5 |
| 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ | 6 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \ |
| 7 ; RUN: -ffunction-sections -sandbox | FileCheck %s | 7 ; RUN: -ffunction-sections -sandbox | FileCheck %s |
| 8 | 8 |
| 9 declare void @call_target() | 9 declare void @call_target() |
| 10 @global_byte = internal global [1 x i8] zeroinitializer | 10 @global_byte = internal global [1 x i8] zeroinitializer |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ; CHECK-NEXT: 20: {{.*}} mov WORD PTR | 89 ; CHECK-NEXT: 20: {{.*}} mov WORD PTR |
| 90 ; CHECK-NEXT: 29: {{.*}} mov WORD PTR | 90 ; CHECK-NEXT: 29: {{.*}} mov WORD PTR |
| 91 ; CHECK-NEXT: 32: {{.*}} mov WORD PTR | 91 ; CHECK-NEXT: 32: {{.*}} mov WORD PTR |
| 92 ; CHECK-NEXT: 3b: {{.*}} nop | 92 ; CHECK-NEXT: 3b: {{.*}} nop |
| 93 ; CHECK: 40: {{.*}} mov WORD PTR | 93 ; CHECK: 40: {{.*}} mov WORD PTR |
| 94 | 94 |
| 95 ; A zero-byte instruction (e.g. local label definition) at a bundle | 95 ; A zero-byte instruction (e.g. local label definition) at a bundle |
| 96 ; boundary should not trigger nop padding. | 96 ; boundary should not trigger nop padding. |
| 97 define void @label_at_boundary(i32 %arg) { | 97 define void @label_at_boundary(i32 %arg) { |
| 98 entry: | 98 entry: |
| 99 %cmp = icmp eq i32 %arg, 0 ; Create a var to select on below. |
| 99 call void @call_target() | 100 call void @call_target() |
| 100 ; bundle boundary | 101 ; bundle boundary |
| 101 %addr_short = bitcast [2 x i8]* @global_short to i16* | 102 %addr_short = bitcast [2 x i8]* @global_short to i16* |
| 102 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction | 103 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction |
| 103 %cmp = icmp eq i32 %arg, 0 ; 23-byte lowering sequence | 104 %dummy = select i1 %cmp, i32 3, i32 5 ; 23-byte lowering sequence |
| 104 ; label is here | 105 ; label is here |
| 105 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction | 106 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction |
| 106 ret void | 107 ret void |
| 107 } | 108 } |
| 108 ; CHECK-LABEL: label_at_boundary | 109 ; CHECK-LABEL: label_at_boundary |
| 109 ; CHECK: call | 110 ; CHECK: call |
| 110 ; We rely on the hideous 4-instruction 23-byte Om1 lowering sequence for icmp. | 111 ; We rely on the hideous 4-instruction 23-byte Om1 lowering sequence for select. |
| 111 ; CHECK-NEXT: 20: {{.*}} mov WORD PTR | 112 ; CHECK-NEXT: 20: {{.*}} mov WORD PTR |
| 112 ; CHECK-NEXT: 29: {{.*}} cmp DWORD PTR | 113 ; CHECK-NEXT: 29: {{.*}} cmp BYTE PTR |
| 113 ; CHECK-NEXT: 2e: {{.*}} mov DWORD PTR | 114 ; CHECK-NEXT: 2e: {{.*}} mov DWORD PTR |
| 114 ; CHECK-NEXT: 36: {{.*}} je 40 | 115 ; CHECK-NEXT: 36: {{.*}} jne 40 |
| 115 ; CHECK-NEXT: 38: {{.*}} mov DWORD PTR | 116 ; CHECK-NEXT: 38: {{.*}} mov DWORD PTR |
| 116 ; CHECK-NEXT: 40: {{.*}} mov WORD PTR | 117 ; CHECK-NEXT: 40: {{.*}} mov WORD PTR |
| 117 | 118 |
| 118 ; Bundle lock without padding. | 119 ; Bundle lock without padding. |
| 119 define void @bundle_lock_without_padding() { | 120 define void @bundle_lock_without_padding() { |
| 120 entry: | 121 entry: |
| 121 %addr_short = bitcast [2 x i8]* @global_short to i16* | 122 %addr_short = bitcast [2 x i8]* @global_short to i16* |
| 122 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction | 123 store i16 0, i16* %addr_short, align 1 ; 9-byte instruction |
| 123 ret void | 124 ret void |
| 124 } | 125 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ret void | 244 ret void |
| 244 } | 245 } |
| 245 ; CHECK-LABEL: checkpoint_restore_stack_adjustment | 246 ; CHECK-LABEL: checkpoint_restore_stack_adjustment |
| 246 ; CHECK: call | 247 ; CHECK: call |
| 247 ; CHECK: sub esp,0x10 | 248 ; CHECK: sub esp,0x10 |
| 248 ; The address of %arg should be [esp+0x20], not [esp+0x30]. | 249 ; The address of %arg should be [esp+0x20], not [esp+0x30]. |
| 249 ; CHECK-NEXT: mov [[REG:.*]],DWORD PTR [esp+0x20] | 250 ; CHECK-NEXT: mov [[REG:.*]],DWORD PTR [esp+0x20] |
| 250 ; CHECK-NEXT: mov DWORD PTR [esp],[[REG]] | 251 ; CHECK-NEXT: mov DWORD PTR [esp],[[REG]] |
| 251 ; CHECK: call | 252 ; CHECK: call |
| 252 ; CHECK: add esp,0x10 | 253 ; CHECK: add esp,0x10 |
| OLD | NEW |